Asynchronous Logging To A Database .Net [closed]

2020-03-20 10:36发布

i Was wondering what people are using for logging in .net. We have log4net here, but am looking to do it async and to a database with a nice viewer.

What are the popular choices??

Regards.

6条回答
家丑人穷心不美
2楼-- · 2020-03-20 10:48

I've seen references to people having used the Microsoft Enterprise Library logging facility, in combination with MSMQ, to achieve asynchronous logging. No help on the viewer.

查看更多
▲ chillily
3楼-- · 2020-03-20 10:51

I would highly recommend looking into NLOG. It's very flexible and logs asynchronously. You can configure it to log to a specific file or DB. However, you'll need to build your own log viewer.

We use NLOG religiously and couldn't be happier with it.

查看更多
混吃等死
4楼-- · 2020-03-20 10:52

Log4Net delivers log messages to appenders synchronously, but the appenders can behave asynchronously according to this. The SqlServerAppender has a bufferSize property that controls how many log events are collected in the buffer before they are written to the database. If that doesn't meet your needs, you could write your own appender. A reply in this post appears to give a working example.

查看更多
别忘想泡老子
5楼-- · 2020-03-20 10:57

When we did this, we simply wrote to a simple internal queue and had a thread do the actual write. This way our code that was logging is minimally impacted, and the simple queue and thread managed keeping us up to date.

查看更多
聊天终结者
6楼-- · 2020-03-20 11:00

We simply log to the database on error because we are a heavily used OLTP system.

If the DB goes down, then the system is down: asynch logging when the phones are red hot is redundant...

查看更多
▲ chillily
7楼-- · 2020-03-20 11:05

Try logFaces, it's centralized log server, aggregator and viewer, works nicely with log4net UDP appender.

Disclosure: I am the author of this product.

查看更多
登录 后发表回答