Microsoft Enterprise Library 5.0日志记录应用程序块线程安全吗? [英] Is the Microsoft Enterprise Library 5.0 Logging Application Block thread safe?

查看:100
本文介绍了Microsoft Enterprise Library 5.0日志记录应用程序块线程安全吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些代码将从不同线程使用Enterprise Library 5.0中的Logging Application Block进行记录. LAB线程安全吗?我可以从不同的线程像正常日志一样记录日志,还是需要同步日志记录代码,以便一次只能在一个线程中使用?

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?

推荐答案

Enterprise Library 5.0日志记录是线程安全的.

Enterprise Library 5.0 logging is thread safe.

在记录之前,EL将检查TraceListenerIsThreadSafe属性.如果特定的TraceListener不是线程安全的,则它将在调用侦听器的TraceData方法之前执行Monitor.Enter(listener);.

Before logging, EL checks the IsThreadSafe property of the TraceListener. If the specific TraceListener is not thread safe then it will perform a Monitor.Enter(listener); before calling the listener's TraceData method.

这篇关于Microsoft Enterprise Library 5.0日志记录应用程序块线程安全吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆