2 ways (both assuming you don't want to blow away the configuration for the server, but still use custom configuration for your application)

1.  If you deploy your app as a WAR file, then you can utilize child-first classloading.  As long as you include log4j.jar in WEB-INF/lib and log4j.properties (or log4j.xml) in WEB-INF/classes, then you will end up using your own config rather than the server's.

2.  Use a Repository Selector.  For more info, see.... http://wiki.apache.org/logging-log4j/AppContainerLogging


Jake


On Thu, 26 Aug 2010 11:49:08 +0200
 "Ben Stover" <bxsto...@yahoo.co.uk> wrote:
Assume a default log4j.properties file is setup for a whole application server.

Now I deploy a new, own java program into the application server which contains logging
statements like

log.info("....");

as well.
Currently the log output go to the default log file defined in the overall log4j.properties file.

But I want to use another, different logfile. This should be defined (as far as I can see) in a second log4j.properties file. But how can I access this jog4j.properties file when creating the logger in the java program?
Resp. how can I tell the environment to use another log4j.properties file ?

Ben






---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to