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: Asynchronous logging
Date Wed, 21 May 2014 14:52:45 GMT
Hey Jesper

 

http://logging.apache.org/log4net/release/faq.html#thread-safe

 

You should be able to trust the timestamps, but when it comes to threading
issues you can trust only two guys:

 

1] your brain

2] the debugger if configured to break all threads

 

As far as I see your issue I can say that adding random locks doesn't
improve thread-safety. :) Rethink your situation, bearing in mind how two
persons would drink out of one cup but both of them want to drink it all.
The answer is: only the first one will empty the glass and the second one
will find the glass empty.

 

Cheers

 

Von: Jesper Lund Stocholm [mailto:Jesper.LundStocholm@ciber.dk] 
Gesendet: Mittwoch, 21. Mai 2014 09:06
An: log4net-user@logging.apache.org
Betreff: Asynchronous logging

 

I am having a threading issue [0] in my code, where I have used log4net to
try to figure out what is going on (so the issue is not about log4net)

 

Can you guys confirm a couple of things for me:

 

1. log4net logs asynchronously such that logging does not affect my primary
code

2. The timestamps of the log entries are synchronous according to the "main
code" and not created somewhere deep within log4net?

 

The reason I am asking (in particular) the last question is that I am in
doubt on whether I can trust the timestamps of the log (in a
rollingfileappender) and thereby be able to deduct the timing of my code?

 

An example of my logs is here:

 

2014-05-20 15:20:45,855 INFO - IgnorableTurbines get lock

2014-05-20 15:20:45,855 INFO - Getting ignorable turbines

2014-05-20 15:20:45,857 INFO - IgnorableTurbines update locked

2014-05-20 15:20:45,863 INFO - Item removed: ignorableturbines

2014-05-20 15:20:45,866 INFO - IgnorableTurbines re-added

2014-05-20 15:20:45,867 INFO - IgnorableTurbines update released

2014-05-20 15:20:45,868 INFO - IgnorableTurbines get released

2014-05-20 15:20:45,871 ERROR - Value cannot be null.

 

The log entries 3, 4, 5, 6 (starting from 1) are created by an event being
fired when an item is removed from my cache. The other log entries are
created by my main thread.

 

Can you help me clarify this?

 

[0] My issue is described in detail here:
http://stackoverflow.com/questions/23761310/preventing-dirty-reads-when-refr
eshing-memorycache-via-cacheentryremovedcallback 

 

Med venlig hilsen / Best regards

 

Jesper Lund Stocholm

Senior Architect

 

t:   +4544662466 

m: +4530945570

jesper.stocholm@ciber.com 

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

 



 

 

 <http://www.facebook.com/ciber>   <http://twitter.com/ciberinc>
<http://www.linkedin.com/groups?mostPopular=&gid=123828> 

 <https://mvp.support.microsoft.com/profile/Jesper.Lund.Stocholm> 

 


Mime
View raw message