You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jon Wilmoth <JW...@starbucks.com> on 2005/12/13 21:16:10 UTC
log4j-1.3alpha-7 - config load/reload? and watchdog?
I'm trying to upgrade to log4j-1.3alpha-7, but not seeing what I would
expect...which is hopefully user error.
First, I thought I could replace my call to
DOMConfigurator.configureAndWatch(<LOG4J_CONFIG_FILE>,
<LOG4J_CONFIG_FILE_CHECK>);
With:
JoranConfigurator joran = new JoranConfigurator();
joran.doConfigure(<LOG4J_CONFIG_FILE>,
LogManager.getLoggerRepository());
However, I don't see log events being sent to my appender. Inserting
the following: System.setProperty("log4j.configuration",
<LOG4J_CONFIG_FILE>);
Forces the events to the log file appender I've set up.
Secondly, how do I force a reload of the config?
Third and finally can I specify any other a %d conversion specifier in
the FileNamePattern param for the TimeBasedRollingPolicy? I have two
server that I'd like to share the same log4j config, but I'd like the
server log files to go to two different directories. Ideally I could
specify the following (where %s{server.name} is a jvm system property
that evaluates to "server1" for one server and "server2" from another
jvm):
<appender name="LOGFILE"
class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy
class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern"
value="/var/tmp/%s{server.name}/server.%d{yyyy-MM-dd}.log.gz"/>
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{MMM-dd-yyyy h:mm:ss:SSS
a, z} [%-5p] (%l) - %m\n"/>
</layout>
</appender>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org