Don't know if this has been mentioned before, but is there any reason why the spy properties can't be loaded using Class.getResourceAsStream ? It is a real hassle to specify the classpath when this is typically done by the app server.
For instance I would like to bundle my properties inside a war file. Could P6Utils.loadProperties first try the system class path then if that fails, call P6Utils.class.getResourseAsStream("spy.properties") or P6Utils.class.getResourseAsStream("META-INF/spy.properties") ? This would be much better, IMO.
I will write the code if people think this is a good idea.
I think this sounds like a fantastic idea. If you want to write the code and send me an email to firstname.lastname@example.org, I would be more than happy to integrate it into the software ASAP.
Thanks for the suggestion,
OK, I've made a patch, but need to test a bit more. It seems that Resin 2.1.3+ has a problem when getResourceAsStream is called before the web app is fully initialised.
I am not sure if the problem I ran across is the same explained here, but I use P6Spy to log in a webapp as well and my priority is to put the spy.properties file in a place inside my webapp and let P6Spy know the location by a an entry in the web.xml file or have it look somewhere in WEB-INF/classes or WEB-INF/lib.
If I get it right the version of P6Spy I use already has the P6Utils.loadProperties / P6Utils.class.getResourseAsStream patch in (please confirm if that's the case) but still it does not find the spy.properties file that way as well as only the p6spy.jar file gets onto the classpath and the properties file is not inside the jar file.
I am not sure what the appropriate mechanism would be as P6Spy is not specific to web apps which makes it hard to find some meachanism that works for both webapps and any other app.
Has this code ever been implemented? This functionality would be very helpful to me as well.
I think it was ....
but check out the P6spy version in SVN and see.
Further development at : https://github.com/patmoore/p6spy
The location on github for p6spy has changed to https://github.com/p6spy/p6spy