If this helps: I am using Log4Perl in a typical forked-to-background-daemon.
I had to do a little thinking to figure out the best place to initialize Log4Perl. The problem is, that the utilized shared vars lost their sharedness in the child proc. Maybe you have to initialize your Log4Perl-Object in each thread that want to use Log4Perl in. (I guess this is the saved thing at all... but ram usage and i/o behaviour might change, and race conditions on the logfile (if you only use one in total) may occure. You will notice that by cutted lines in the log.) Bye, D. Rob Coops <[EMAIL PROTECTED]> hat am 16. Oktober 2008 um 07:47 geschrieben: > On Wed, Oct 15, 2008 at 9:47 PM, Chas. Owens <[EMAIL PROTECTED]> wrote: > > > On Wed, Oct 15, 2008 at 06:04, Rob Coops <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > > > > I am a little stumped here, I have a nice little application that makes > > use > > > of Log4perl (which I really like a lot) and now that all the basic > > > functionality is in there I have started working on makking things go a > > > little faster. One of the things is optimizing the way data is fetched > > (all > > > data gets pulled in from a webbased API), of couse sending a single > > request > > > at a time is not realy optimal usage so threads where introduced in order > > to > > > process up to 10 requests at the same time, which speeds things up quite > > a > > > bit, but... > > > > > > Does Log4perl work well with threads? > > > > > > - It seems to as I am not seeing any errors > > > - All threads log to the same file which so far every time contains all > > > lines expected > > > - The Log4perl documentation does not state clearly if it is thread > > safe > > > or not > > > > > > > > > I have looked at the Log4perl source code and at the > > > Log::Log4perl::Appender::File module that I am using to write the logs > > but > > > they do not seem to take into account multiple treads. Yet my knowledge > > of > > > threads and perl is not good enough to say for certain that this means, > > so > > > far I have just been lucky and in a strange situation things might still > > > blow up in my face or there is nothing to worry about and things will be > > > fine. > > > > > > Does anyone on the list have experiance with Log4perl and threads, or is > > > able to confirm in another way if Log4perl is thread safe? > > > > > > Thanks, > > > > > > Rob > > > > > > > Based on a cursory glance at the FAQ*, it looks as if it is > > thread-safe. You may also want to ask on the log4perl mailing list**. > > > > * > > http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4perl/FAQ.html > > specifically: > > > > http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4perl/FAQ.html#04256 > > > > ** https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > > -- > > Chas. Owens > > wonkden.net > > The most important skill a programmer can have is the ability to read. > > > > > Thank you, that is what I mentioned it seems to be thread safe looking at > the FAQ but there is no definite yes or no anywhere. I'll ask on that > mailing list to make sure then.