You say log4j.properties is in your WEB-INF/classes directory, but where is log4j.jar? Is it in WEB-INF/lib? And if so, is your server also set up to use child-first classloading behavior like Tomcat is by default? Most servers actually *don't* do this by default. It's usually something you have to turn on.
Now, even if log4j.jar is in WEB-INF/lib *and* child-first classloading behavior is enabled, you are still left in the cold if somewhere there is a directory or jar in the classpath that has log4j.xml which is in the default package. I think this is about the 20th time this past week or two that I've brought this up, but I'll say it again. If you want to use the default initialization and you don't want to specify your file via a system property provided at the command line upon JVM startup (something like -Dlog4j.configuration=file:///path/to/config), which would end up applying to every application in the server, then you should use log4j.xml because it gets picked up in preference to log4j.properties if both are found on the classpath. log4j.xml could even be in a parent classloader and will still get used in preference to WEB-INF/classes/log4j.properties when using child-first classloading.
Of course, if you aren't using child-first classloading, there's your problem right there. Even if you have log4j.jar in WEB-INF/lib and log4j.xml in WEB-INF/classes, but you also have log4j.jar in some parent classloader, then that instance of log4j will start with the server and every webapp under the server will use it rather than log4j.jar in WEB-INF/lib. And, of course, automatic initialization will have been performed on server startup with a config file that, most likely, is not the one in your webapp.
Jake At 03:45 PM 1/4/2006 -0800, you wrote: >I did have log4j set up on a computer, but then it died and I can't seem to >get my new development environment to behave as well. I'm using log4j 1.2.8 >on a struts application, and using an oc4j standalone server for >development. I'm hoping someone would be so kind as to suggest what I'm >missing/doing wrong now. > >Here is the contents of my log4j.properties file: ># Create appenders: >log4j.rootLogger=INFO, stdout, F > ># Configure the stdout appender <- no need when not in development >log4j.appender.stdout=org.apache.log4j.ConsoleAppender >log4j.appender.stdout.layout=org.apache.log4j.PatternLayout >log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %x - %m%n > ># Configure the file appender >log4j.appender.F=org.apache.log4j.RollingFileAppender ># Do not write to application log specified in orion-application.xml >(barts.log) ># as OC4J puts an exclusive lock on this file: attempts to append will fail >log4j.appender.F.File=C:\\WORK\\bart\\barts_log4j.log >log4j.appender.F.MaxFileSize=1MB >log4j.appender.F.MaxBackupIndex=1 >log4j.appender.F.layout=org.apache.log4j.PatternLayout >log4j.appender.F.layout.ConversionPattern=%d [%t] %-5p %x - %m%n > ># Turn some of the more verbose stuff off, I'm more interested in my logging >log4j.logger.org.apache.commons=warn >log4j.logger.org.apache.struts=warn > > >But despite the "warns", I get lots of lines like this: >111843 [HttpRequestHandler-3513371] DEBUG >org.apache.struts.tiles.TilesRequestProcessor - '.login' - processed as >definition >or >103718 [HttpRequestHandler-3513371] DEBUG >org.apache.commons.beanutils.ConvertUtils - Convert string 'false' to class >'boolean' > >The log4j.properties is located in my \WEB-INF\classes directory. > >Thanks for your help! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
