logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karim Bourouba <kar...@hotmail.com>
Subject RE: Defer file creation
Date Fri, 31 Jul 2009 15:05:48 GMT


Hi There,
 
I dont think I have an answer to your question just now - but can I ask why you would prefer
to defer creating the log file?



 



From: wolfgang@wollinet.com
To: log4net-user@logging.apache.org
Subject: Defer file creation
Date: Fri, 31 Jul 2009 16:15:28 +0200





Hi Everbody,
 
I’m looking for a way to defer the creation of the log file until the first entry is logged.
I want to use log4net for writing protocols for jobs that can be executed in my application.
With my current configuration the file is created during startup which makes no sense if the
job doesn’t run.  
 
My current configuration:
 
      <appender name="…" type="log4net.Appender.RollingFileAppender">
        <file value="....." />
        <appendToFile value="false" />
        <rollingStyle value="Date" />
        <datePattern value="yyyy_MM_dd.\tx\t" />
        <staticLogFileName value="false" />
        <threshold value="INFO" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%date;%level;%m%n" />
        </layout>
      </appender>
 
One possibility seems to be to generate the appender programmatically, but then I lose a lot
of flexibility. Another one is writing my own appender (or subclassing an existing one). Is
there another way ?
 
Any help is appreciated,
Wolfgang
 
_________________________________________________________________
Share your memories online with anyone you want.
http://clk.atdmt.com/UKM/go/134665338/direct/01/
Mime
View raw message