Hi Stefan,

Thank you, but it didnt work :(

For the second appender I specified: <lockingModel
type="log4net.Appender.FileAppender+MinimalLock" />

http://old.nabble.com/file/p32639452/20111012115258.png 

but it still creates the empty log file (and I dont log any FATAL errors).









Stefan Bodewig wrote:
> 
> On 2011-10-12, Sigourney_Weaver wrote:
> 
>> Hi I am using this configuration that is supposed to create one log file
>> for
>> business (INFO & ERROR) and another - for system errors (FATAL).
> 
>> http://old.nabble.com/file/p32638170/Fk2dH.png
> 
>> Both log files are created right away when I execute:
>> LogManager.GetLogger(typeof(Program));
>> I dont want SystemErrorsLog log file to be created, unless I actually log
>> FATAL error, log.Fatal("System Error". Otherwise it would be just
>> redundant
>> empty log file. Is there any way this can be done, maybe some attribute I
>> am
>> not familiar with?
> 
> In general FileAppender opens the file immediately once it gets
> configured.  In fact it is not FileAppender itself but the LockingModel
> it uses.
> 
> At least with log4net 1.2.11 the MinimalLock locking model will not open
> the file until the first message is logged.  It opens and closes the
> file for each message.  While this might avoid the empty log file it
> also implies a performance hit which may be quite significant if you
> have many FATAL errors.  This may be acceptable if FATAL errors almost
> never happen - which I'd hope to be the case.
> 
> Stefan
> 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-prevent-creating-log-file-----tp32638170p32639452.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Reply via email to