Log4Perl将多个程序的日志记录捆绑到一个日志中 [英] Log4Perl bundling logging from several programs into one log

查看:91
本文介绍了Log4Perl将多个程序的日志记录捆绑到一个日志中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CPAN上是否有任何Logger,使我可以将两个程序中的日志捆绑到一个文件中,并且当两个程序同时运行并并行调用log4Perl时,可以同步并行日志记录。

背景是我使用的一个自定义的附加程序,它编写电子邮件,如果邮件服务器出现问题,我希望将所有电子邮件作为一个备份捆绑在一起。

Is there any Logger on CPAN which allows me to bundle logs from several programs into one file with synchronising parallel logging when two programs run the same time and call log4Perl in parallel.
Background is that I use a custom appender which writes Emails and I would like to bundle all emails in a single file as a backup in case the mail server has problems.

推荐答案

您可以通过两种主要方式进行操作:

You can do that in two main ways:

  • with Log::Log4perl::Appender::File (and its descendants) with the 'syswrite' option, which guarantees atomic writes, and
  • with Log::Log4perl::Appender::Synchronized.

这篇关于Log4Perl将多个程序的日志记录捆绑到一个日志中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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