简体   繁体   English

.NET:寻找log4net的最佳性能附加器

[英].NET: Looking for best performing appender of log4net

We are currently using the log4net appender (web.config snippet): 我们目前正在使用log4net附加程序(web.config片段):

<appender name="FileAppender" type="log4net.Appender.RollingFileAppender">

Looking for experience using other appenders. 寻找使用其他appender的经验。

我以前的公司实际上发现NLog更快。

We use SmtpAppender for ERROR and FATAL levels to "mail home" exception reports. 我们将SmtpAppender用于ERROR和FATAL级别以“邮寄”异常报告。 Also ConsoleAppender when running a Windows Service in a console. 在控制台中运行Windows服务时,也请使用ConsoleAppender

For FileAppender we set <staticLogFileName value="false" /> to avoid an ever-increasing delay when rolling over to a new file and the folder contains lots of files. 对于FileAppender我们设置<staticLogFileName value="false" />以避免在过渡到新文件并且文件夹包含许多文件时不断增加的延迟。

We're also using the SmtpAppender to log fatal errors and send back the exception reports, though this is used in conjunction with a custom error handler, which also sends an email with a bit more information such as page url, session variables, request values, etc (as the SmtpAppender only sends some of the log and the exception details). 我们还使用SmtpAppender记录致命错误并发送异常报告,尽管该报告与自定义错误处理程序结合使用,该错误处理程序还发送了一封包含更多信息的电子邮件,例如页面url,会话变量,请求值,等等(因为SmtpAppender仅发送一些日志和异常详细信息)。

For file-based logging, we're using the RollingFileAppender, and having it generate a new log file for each day, to avoid ending up with huge log files. 对于基于文件的日志记录,我们使用RollingFileAppender,并让它每天生成一个新的日志文件,以避免最终产生大量的日志文件。

For console applications, we're using the ColoredConsoleAppender. 对于控制台应用程序,我们使用ColoredConsoleAppender。

I've seen some web applications using the AdoNetAppender, but avoid using it personally as I'm not sure how good the performance would be, though it could be a good idea to log error and fatal messages to the database (which would be less often than debug messages). 我已经看过一些使用AdoNetAppender的Web应用程序,但是请避免亲自使用它,因为我不确定性能如何,尽管将错误和致命消息记录到数据库中可能是一个好主意(这会少一些)通常比调试消息)。

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

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