log4net:比较 adonetappender 和rollingfileappender

发布于 2024-08-19 02:50:54 字数 494 浏览 8 评论 0原文

我想看看这些附加器中哪一个性能更好(时间越短越好)。

RollingFileAppender 还是 ADONetAppender?

选择附加器时我应该考虑哪些其他参数?

我看到我的 Web 服务器“保留”了滚动文件。我可以设置类似的内容

<lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> 

(参考:log4net 文档中的 FileAppender 部分)在我的滚动文件附加器中,以便多个应用程序/服务器可以写入同一个文件?

我们的数据库服务器位于 SAN 驱动器中,但日志文件将本地写入硬盘驱动器(或者在不久的将来可能是 SAN 驱动器)

I am trying to see which one of these appenders would perform better (the shorter the time, the better).

RollingFileAppender or ADONetAppender?

What are the other parameters I should consider when choosing an appender ?

I saw that my WebServer "holds on" to the rollingfile. Can I set something like

<lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> 

(reference: FileAppender section in log4net documentation) in my rolling file appender so that multiple applications/servers can write to the same file ?

our DB server is in a SAN drive, but the log files would be written locally to the hard drive (or may be a SAN drive in the near future)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

风筝有风,海豚有海 2024-08-26 02:50:54

如果您的 ADONetAppender 失去连接,它将停止日志记录,但使用该选项

  <reconnectonerror value="true" />

它将尝试重新连接。

If your ADONetAppender loses the connection, it will stop logging, but with the option

  <reconnectonerror value="true" />

it will try to reconnect.

酷炫老祖宗 2024-08-26 02:50:54

使用滚动文件附加器我们运气更好。我们注意到,如果出现网络故障,ADO.NET 附加程序就会停止记录。例如,每周安装服务包后重新启动会杀死您的记录器。

请记住,如果您要使用文件附加器,这也意味着将日志保留在同一服务器上 - http://ferventcoder.com/archive/2009/07/16/log4net-note-always-keep-your-logs-on -the-same-server.aspx

我从未见过最小的锁定机制。如果您确实使用它,看起来确实会付出一些性能损失: http://logging.apache.org/log4net/release/sdk/log4net.Appender.FileAppender.MinimalLock.html

We have better luck using the rolling file appender. We've noticed that if there is a network glitch the ADO.NET appender stops logging. For example, a reboot after service pack installs on a weekly basis would kill your logger.

Keep in mind that also means keeping your logs on the same server if you are going with file appender - http://ferventcoder.com/archive/2009/07/16/log4net-note-always-keep-your-logs-on-the-same-server.aspx

I've never seen the minimal locking mechanism. It does look like you will pay some performance penalties if you do use it: http://logging.apache.org/log4net/release/sdk/log4net.Appender.FileAppender.MinimalLock.html

沩ん囻菔务 2024-08-26 02:50:54

我通常将 RollingFileAppender 用于本地磁盘 - 这是强大且快速的(如果您无法写入本地磁盘,则通常会遇到致命问题)。

写入 ADO.NET 可能会失败 - 例如,如果在应用程序运行时日志数据库出于备份目的而脱机。

由于性能开销,我还会避免使用 MinimalLock - 相反,为每个应用程序都有一个单独的日志文件。如果您偶尔需要查看合并的日志数据,可以合并日志的相关部分,或者只需在查看器中并排打开相关部分。

I generally use RollingFileAppender to a local disk - this is robust and fast (if you can't write to a local disk, you generally have a fatal problem).

Writing to ADO.NET can fail - for example if the logging database is taken offline for backup purposes while your application is running.

I would also avoid using MinimalLock because of the performance overhead - instead have a separate log file for each application. If you occasionally need to see consolidated log data, you can merge the relevant parts of the logs, or simply open the relevant parts side-by-side in a viewer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文