How can I run Log::Log4perl under mod_perl?
In persistent environments it’s important to play by the rules outlined in section “Initialize once and only once” in Log::Log4perl. If you haven’t read this yet, please go ahead and read it right now. It’s very important. And no matter if you use a startup handler to init() Log::Log4perl or use the init_once() strategy (added in 0.42), either way you’re very likely to have unsynchronized writes to logfiles. If Log::Log4perl is configured with a log file appender, and it is initialized via the Apache startup handler, the file handle created initially will be shared among all Apache processes. Similarly, with the init_once() approach: although every process has a separate L4p configuration, processes are gonna share the appender file names instead, effectively opening several different file handles on the same file. Now, having several appenders using the same file handle or having several appenders logging to the same file unsynchronized, this might result in overlapping messages. Some
In persistent environments it’s important to play by the rules outlined in section Initialize once and only once in the Log::Log4perl manpage. If you haven’t read this yet, please go ahead and read it right now. It’s very important. And no matter if you use a startup handler to init() Log::Log4perl or use the init_once() strategy (added in 0.42), either way you’re very likely to have unsynchronized writes to logfiles. If Log::Log4perl is configured with a log file appender, and it is initialized via the Apache startup handler, the file handle created initially will be shared among all Apache processes. Similarly, with the init_once() approach: although every process has a separate L4p configuration, processes are gonna share the appender file names instead, effectively opening several different file handles on the same file. Now, having several appenders using the same file handle or having several appenders logging to the same file unsynchronized, this might result in overlapping mess