logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominik Psenner" <dpsen...@gmail.com>
Subject AW: Thread Safety in Log
Date Fri, 06 Sep 2013 06:32:44 GMT
At this point I usually quote Hector Correa:




You can verify that log4net is indeed thread safe with a 3 liner console
application. However,  most people confuse thread safety with process
safety. log4net is – like many other programs - not process safe and that
has been written down in the FAQ several years ago:




If log4net does not what you want it to do, then you’re probably using it in
a way it was not intended to be used.


Von: Rafael Thome Guimaraes [mailto:p-rguimaraes@bvmf.com.br] 
Gesendet: Freitag, 6. September 2013 00:52
An: Bill Sorensen; Log4NET User
Betreff: RE: Thread Safety in Log


Hi Bill!


Thanks for your answer!


My case is exactly the one of the l4ndash link you passed. I am using
“RollingFileAppender” through the ILog interface.





//Class field

private static ILog log =




//In the class constructor

log4net.GlobalContext.Properties["LogName"] =


log.Logger.Repository.Configured = true;




//Log call







In another file I just got, The trimmed message and the trimming message
came from the same thread! That eliminates the Thread Safety hypothesis.


Any ideas?



Rafael Thomé Guimarães



' +55 11 2565-7006

* p-rguimaraes@bvmf.com.br <mailto:p-bpedroso@bvmf.com.br> 


www.bmfbovespa.com.br <http://www.bmfbovespa.com.br/> 



Evite imprimir. Colabore com o Meio Ambiente!




From: Bill Sorensen [mailto:bsorensen@idtdna.com] 
Sent: quinta-feira, 5 de setembro de 2013 19:16
To: Rafael Thome Guimaraes; Log4NET User
Subject: RE: Thread Safety in Log


One of our developers (Eric Borman) researched this recently, so I’ll quote


The short answer is that log4net is thread safe, the appenders are not.
log4net takes this into account and ensures proper serialization of logging
events. So as long as you use the logging API and don’t access the appender
directly you are safe.






That does not make them process safe. So using a web garden will cause






Bill Sorensen

Patterns, Platforms and Practices

Integrated DNA Technologies

www.idtdna.com <http://www.idtdna.com> 


From: Rafael Thome Guimaraes [mailto:p-rguimaraes@bvmf.com.br] 
Sent: Thursday, September 05, 2013 3:49 PM
To: Log4NET User
Subject: Thread Safety in Log


Hi all!


Anyone knows if Log4Net is Thread Safe or I need to put locks in the calls?



Rafael Thomé Guimarães



Esta mensagem pode conter informação confidencial e/ou privilegiada. Se você
não for o destinatário ou a pessoa autorizada a receber esta mensagem, não
deverá utilizar, copiar, alterar, divulgar a informação nela contida ou
tomar qualquer ação baseada nessas informações. Se você recebeu esta
mensagem por engano, por favor avise imediatamente o remetente, respondendo
o e-mail e em seguida apague-o. Agradecemos sua cooperação.

This message may contain confidential and/or privileged information. If you
are not the addressee or authorized to receive this for the addressee, you
must not use, copy, disclose, change, take any action based on this message
or any information herein. If you have received this message in error,
please advise the sender immediately by reply e-mail and delete this
message. Thank you for your cooperation.

View raw message