If you don't want the configuration in your log4j.xml or log4j.properties to be loaded right away, then don't put it in the classpath. Put it in, for instance, WEB-INF. Then, in your servlet context listener, set things up the way you want and then perform manual configuration on the config file of your choice.
You might want to put a dummy minimal log4j.xml file in WEB-INF/classes that will get picked the first time a class referencing Logger is classloaded (which will, in turn load LogManager, which performs the auto-config in a static block) just to make sure it doesn't pick up some arbitrary config file somewhere in the parent classloader (assuming you are using Tomcat's child-first classloading behavior). Jake [EMAIL PROTECTED] wrote: > Hi > > > > I am using a web application which is deployed on tomcat server. I am using > log4j for logging purpose and use a customize Appender class > DailyMaxRollingFileAppender which extends DailyRollingFileAppender. I have > configured my log4j.properties file for DailyMaxRollingFileAppender. Inside > DailyMaxRollingFileAppender class, I am trying to access a property from a > property resource bundle. I have loaded property resource bundle in > ServletContextListener. When DailyMaxRollingFileAppender is loaded by log4j, > it throws NullPointerException while trying to access property resource > bundle. I am confued why my property resource bundle is not loaded? Does > log4j loads before the ServletContextListner is loaded? If yes , then what > is the remedy for it. I mean how come I pass my attribute/parameter to my > DailyMaxRollingFileAppender class. > > > > > > > > Regards, > > Yasir > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
