freddo411 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I'm looking for a reasonable solution to the following (Reasonable is defined as: minimized additional coding, minimized additional modules).

I have several simultaneous threads, and I'd like to log messages from each into the same log file. There is one parent thread (long lived) and a number of short lived children.

I'm already using Log4perl, if that helps.

The work of the threads is otherwise independent, so I am not already communicating with signals or IPC.

Thanks in advance.

-------------------------------------
Nothing is too wonderful to be true
-- Michael Faraday

Replies are listed 'Best First'.
Re: How to log from multiple threads into one logfile?
by Gangabass (Vicar) on Jul 13, 2010 at 03:24 UTC
      Turns out that log4perl has a FAQ on this.

      I added this:

      log4perl.appender.Logfile.syswrite = 1
      to my config. Seems allow thread safe logging for me.

      -------------------------------------
      Nothing is too wonderful to be true
      -- Michael Faraday