I have some code that will be logging using the Logging Application Block in Enterprise Library 5.0 from different threads. Is the LAB thread safe? Can I log like normal from different threads or will I need to synchronize the logging code so that is only used from one thread at a time?
相关问题
- I want to trace logs using a Macro multi parameter
- Error message 'No handlers could be found for
- convert logback.xml to log4j.properties
- Django management command doesn't show logging
- apache modules ap_log_perror is at a different lev
相关文章
- how do I log requests and responses for debugging
- Android Studio doesn't display logs by package
- Stacktrace does not print in Glassfish 4.1 Cluster
- Copy constructor with non-const argument suggested
- Out of curiosity — why don't logging APIs impl
- Laravel log file based on date
- Java -How to get logger to work in shutdown hook?
- Java XPathFactory thread-safety
As far as I know,Enterprise Library 3.1 Logging is not thread safe. There is not lock around GetAvailableTraceListeners(IList traceListeners) call in LogWriter class, which used static in Logger class.
Enterprise Library 5.0 logging is thread safe.
Before logging, EL checks the
IsThreadSafe
property of theTraceListener
. If the specific TraceListener is not thread safe then it will perform aMonitor.Enter(listener);
before calling the listener'sTraceData
method.