logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James A. N. Stauffer" <stauffer.ja...@gmail.com>
Subject Re: Appenders writing log file when not called apon
Date Wed, 29 Aug 2007 14:30:49 GMT
Log4j does creates files for every appender when initialized.  You
could write your own appender to change that.

On 8/29/07, Niraj Patel <nirajbpatel@googlemail.com> wrote:
> I have a log4j.xml file which is used by dozens of classes throughout the
> day. One of these classes needs to log some data into a separate file, so I
> created the following config:
>
> <appender name="XXX" class="org.apache.log4j.DailyRollingFileAppender">
>     <param name="File" value="../logs/XXX.log"/>
>     <param name="Append" value="true"/>
>     <param name="DatePattern" value="'.'yyyy-MM-dd" />
> </appender>
>
> <category name="a.b.c.XXXClass">
>     <appender-ref ref="XXX" />
> </category>
>
> Although the XXX.log file is written to disk (albeit empty) every time the
> log4j engine is initialised by the other classes.
>
> Am I correct in saying that the Log4J engine will parse all appenders and
> write any log files not on disk, to disk?
>
> Is there a way to stop this? I only want the log file to be written onto
> disk when XXXClass logs data.
>
> Cheers in advance,
>
> Niraj
>


-- 
James A. N. Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

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