Re: Configure multiple log files in single EAR
Sunday, December 23, 2007 12:36 PM
I think your problem may be that log4j is sort of global for a single JVM; the configured log4j properties are static fields in the classes, I think, so you only get one set of configuration values across the whole JVM.
And WebLogic does weird nonstandard things sometimes, and perhaps it is just giving you one parent classloader for your entire EAR, encompassing all your WAR's. This may be something you can change in the admin GUI for the app server, maybe even some weblogic specific file in individual WAR's or in the EAR (I remember there used to be a "weblogic.xml" that you could put some weblogic-specific settings in).
So if you want different web applications writing to different log files, and if you are indeed stuck with one single copy of the log4j classes loaded and being shared by all the apps you've deployed together, then configure different loggers + appenders for the different files, and get them in the classes, by the fully qualified classnames, so that they are all distinct, across the entire EAR.