问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/3180752/log4perl-bundling-logging-from-several-programs-into-one-log