logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Kjome" <h...@visi.com>
Subject Re: How to use a second log4j.properties file for a special java program?
Date Thu, 26 Aug 2010 18:25:50 GMT
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.... 


On Thu, 26 Aug 2010 11:49:08 +0200
  "Ben Stover" <bxstover@yahoo.co.uk> wrote:
> Assume a default log4j.properties file is setup for a whole application 
> 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-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org

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

View raw message