logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalcevich, Daniel" <dkalcev...@firstam.com>
Subject Two Loggers - overwriting files
Date Mon, 28 Nov 2005 18:49:04 GMT
Everyone,

 

I have an application that runs from a Web Interface as well as from a
command line state.  The problem I am having is that when the batch job
runs, that it truncates any data that is in the log file that the web
has been writing to.  I want the output from both places to be kept in a
single log file.  My log4j configuration looks like the following:

 

log4j.logger.batch.notifyAgents=INFO, notifyAgents

log4j.additivity.batch.notifyAgents=false

 

log4j.appender.notifyAgents=org.apache.log4j.DailyRollingFileAppender

log4j.appender.notifyAgents.File/logs/notifyAgents.log

log4j.appender.notifyAgents.Threshold=INFO

log4j.appender.notifyAgents.DatePattern='.'yyyy-MM-dd

log4j.appender.notifyAgents.append=true

log4j.appender.notifyAgents.layout=org.apache.log4j.PatternLayout

log4j.appender.notifyAgents.layout.ConversionPattern=%d [%t] %-5p %c ::
%m%n

 

And in the java code, I call the following to load the file from a
packaged jar file:

 

Properties props = new Properties();

URL log4jURL =
Thread.currentThread().getContextClassLoader().getResource(log4JFile ); 

props.load( log4jURL.openStream() );

PropertyConfigurator.configure(props);

 

Are there any properties that can be set to allow the batch job to run
and write to the file (if it already exists), rather than truncate whats
there and then write the data?  Any help is greatly appreciated.
Thanks.

 

Daniel

 


Mime
View raw message