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: log4j-1.3alpha-7 - config load/reload? and watchdog?
Date Wed, 14 Dec 2005 05:18:54 GMT
At 12:16 PM 12/13/2005 -0800, you wrote:
 >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());
 >

This should work fine, but I haven't verified this lately.  I know it used 
to work.

 >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.
 >

You may want to report a bug on this in Apache's Bugzilla.

 >Secondly, how do I force a reload of the config?
 >

Look into the watchdogs.  I haven't really used them, so I can't give much 
direction.  Maybe Mark Womack can help since he was pretty heavily involved 
in their design?  Otherwise, you can use something like LogWeb to have a 
manual updating process.  You can even upload config files.  Unfortunately, 
LogWeb doesn't build against Log4j-1.3 without a couple tweaks.  I keep 
meaning to create a patch and send it to the developer of LogWeb.  Makes it 
run with either Log4j-1.2.xx or Log4j-1.3.

 >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):
 >

Just use ${server.name}.  That will work just fine.

<param name="FileNamePattern" 
value="/var/tmp/${server.name}/server.%d{yyyy-MM-dd}.log.gz"/>

 ><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


---------------------------------------------------------------------
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