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: log settings an administrator's job?
Date Wed, 20 Aug 2008 14:20:43 GMT
It's not a bad idea.  Log4j 1.2.xx gives you one option.  On the command line 
that starts the server, the sysadmin can add...

java -Dlog4j.configuration=/path/to/log4j.xml .....

Of course, if you have more than one app running on the server and you want 
separate config files per app (assuming you have the inherent capability for 
separation via child-first classloading or a custom repository selector), then 
you'll have to come up with something more like you idea about configuring it 
as a JNDI String resource.

Such capability was implemented in the abandoned 1.3 experiment as the 
ContextJNDISelector [1].  You could adapt this code to your liking.  I would 
actually like to see this in the extras and in Log4j 2.0 if it ever comes into 
being.

[1] 
http://svn.apache.org/repos/asf/logging/log4j/branches/BRANCH_1_3_ABANDONED/src/main/java/org/apache/log4j/selector/ContextJNDISelector.java


Jake

On Wed, 20 Aug 2008 13:45:55 +0100
  "Paul Pepper" <sip.sniffa@gmail.com> wrote:
> Placing log4j settings in the log4j.properties (or log4j.xml) file
> under WEB-INFO/classes effectively requires the developer to configure
> logging - e.g. unexploded war files. Shouldn't it be the job of the
> system admin who deploys the application to configure things like log
> file location? Or have I missed something?
> 
> I would like to give the system admin the ability to set the location
> of the log4j log file in my applications (as with access log info when
> a sys admin can use org.apache.catalina.valves.AccessLogValve in
> Tomcat's server.xml). The server.xml (or context.xml) seems like the
> right place to set the location of the log4j log file - maybe as a
> JNDI string resource.
> 
> Can anyone suggest a way of giving system administrators the means of
> setting log4j configuration settings? Or, can anyone explain why this
> would be a bad idea?
> 
> Thanks,
> 
> Paul.
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message