简体   繁体   English

企业库记录器

[英]enterprise library logger

I have a BIG client-serve application that uses Enterprise Library v4.0 我有一个使用Enterprise Library v4.0的BIG客户端服务应用程序

It uses the Enterprise Library logger each time when there is a new connection to the DB. 每次与DB建立新连接时,它都使用Enterprise Library记录器。 When I shut down the logger (by using comments or my on/off boolean in the web.config and app.config) batch operations (eg requesting 100 records) it takes about 6-7 seconds. 当我关闭记录器(通过在web.config和app.config中使用注释或我的开/关布尔)批处理操作(例如,请求100条记录)时,大约需要6-7秒。 When I put the logger on, it takes about 20 seconds. 当我打开记录器时,大约需要20秒。

My question is how exactly the Enterprise Library operates the logger, Is it by using threads or not? 我的问题是企业库是如何操作记录器的,是否通过使用线程? How exactly can I tell? 我怎么能告诉你?

I'm asking this question because I would like to call the logger using threads but if the library already uses threads, it will not be successful. 我问这个问题是因为我想使用线程来调用记录器,但是如果库已经使用了线程,那么它就不会成功。 Also, is using threads preferable for this operation? 另外,是否使用优先于此操作的线程? Do you think I need to use other logger, eg Log4Net and such? 你认为我需要使用其他记录器,例如Log4Net等吗?

Enterprise Library Logging Application Block is thread-safe. 企业库日志记录应用程序块是线程安全的。 If you want to see how the Logger operates, check out the source code . 如果您想了解Logger的运行方式,请查看源代码

The Enterprise Library Logger handles requests synchronously so it is not spawning threads to process write requests. Enterprise Library Logger同步处理请求,因此它不会产生线程来处理写请求。

If you want to see what threads are being created, then you can monitor the threads in Visual Studio while debugging. 如果要查看正在创建的线程,则可以在调试时监视Visual Studio中的线程。

Your application could always start a thread to log the information but I would be vigilant in determining if starting potentially a large number of short lived threads actually helps performance. 您的应用程序总是可以启动一个线程来记录信息,但我会保持警惕,确定是否可能启动大量短期线程实际上有助于提高性能。

I would recommend profiling to determine what is taking all the time. 我会建议分析以确定一直在进行什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM