See replies intermixed. -----Original Message----- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 21, 2001 11:52 AM To: [EMAIL PROTECTED] Subject: Answer three simple questions and I will be thrilled. Hi, I am trying to get a handle on Log4J and I have three problems/questions I am trying to get around. First I am trying to use log4j with a web app that is distributed in a standard war file. I want to be able to distribute this file, along with the logging class and not worry about configuring log4j. In my code I have PropertyConfigurator.configure("path to myLog.properties"); As a result I have to set this path every time I distribute the war file. Is it possible to set this up so that the class file looks to where it has been installed and looks for myLog.properties there. This way I don't have to worry about setting to myLog.properties. You can use ServletContext.getResource/getResourceAsStream or the same methods on the ClassLoader. This might give you a URL similar to jar://path_to_WAR:entry_in_war_file, which might not be writable. Second, I have a rolling file set in myLog.properties via: log4j.appender.R.File="/myRollingLog.log" How can I do the same as in step one, have this file default to where the war file was installed? There is one problem with this - what happens if its installed into a web server that doesn't expand WAR files? The spec does not require the files be expanded, and you can't necessary add files to existing WARs though the normal writing methods. If you want to find the directory that the WAR is in then you could use ServletContext.getRealPath("some file we know exists") and then chop off the end. Third, I have the following code in each of my class files: Category cat=Category.getinstance(myclass.class.getName()); How can I have the above through reflection find its own class name and therefore I would have a default statement? Something like Category cat=Category.getInstance("Find_What_Class_This_Is).class.getName())? This one I'm not sure about. From within an instance you can call getClass() that returns a handle to the java.lang.Class object of this class, but I don't think this works from a static context. If your have some form of a pre-processor you can run on your code you might be able to do a text replacement on the code, but I don't think this is possible in straight java. Thanks for any help. Alex ===== Regards Alex Colic, HBA, B. Ed PopWare Inc. "Driving down the cost of conversions" E-Mail: [EMAIL PROTECTED] Tel: 1-905-777-8171 ext. 104 Fax: 1-905-777-0132 __________________________________________________ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]