Re: [log4perl-devel] Wide Character errors
Bill Moseley got "Wide character in" errors. I encountered this a few days ago. I've found it hard to reproduce. It seems perl has a "Don't ask, don't tell" attitude, but once you've got the utf8 bit set on some data then it worries about it thereafter. The ".utf8 = 1" directive only works for the File appender. See perldoc Log::Log4perl::FAQ. Using binmode STDERR, ":utf8"; avoids the wide character errors for the screen appender. You could try binmode SYSLOG, ":utf8"; as the only calls to syswrite in Sys/Syslog.pm are to SYSLOG. Regards, John - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] A threading question
Mike Schilli said: > It would be great if you could provide test results / bug reports of > running Log4perl with Perl threads, though. > > That being said, there are synchronization mechanisms for file > appenders: > > http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#23804 I've tried using Log4perl in a multi-threaded server script and the synchronized appender fails consistently after logging exactly 32768 lines, with (piped through cat -v): Thread 1 terminated abnormally: semop(1343496 [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@^P) failed: Numerical result out of range at /usr/local/lib/perl5/site_perl/5.10.0/Log/Log4perl/Util/Semaphore.pm line 192, chunk 2. semop(1343496 [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@^P) failed: Numerical result out of range at /usr/local/lib/perl5/site_perl/5.10.0/Log/Log4perl/Util/Semaphore.pm line 192. OS is CentOS 5.2 under xen. In one case there were three threads. Without using the synchronized appender, in heavy testing overwrites occurred. I'll try to replicate the failure in my test environment (Kubuntu 8.04). Regards, John - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] A threading question
Mike > Got it, ... , it'll roll out with the next release (1.20). Thank you! > By the way, have you tried using the 'syswrite' option of the file > appender instead? It prevents overlapping messages as well and it's > easier to use than the synchronizing appender: > >log4perl.appender.Logfile.syswrite = 1 No, didn't know about that. A colleague's been testing with the synchronizer removed, at about 15 messages per second, with no overwriting so far, which is what I'd expected on Linux initially. The next restart will pick up the syswrite option above. Which reminds me, I couldn't get init_and_watch($conf_file, 'HUP') to work with threads, which is not surprising, given that perl threads and signals don't mix very well. Regards, John - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] A threading question
Mike > Can you provide code to reproduce the problem? I'd be happy to track it > down. I haven't been able to reproduce the strife I was having; most use of signals was failing. However, there is the obvious. My perl 5.10 is delivering all OS signals to the 'main' thread, so the logger in it gets the HUP but not the others (cloned from the first by the threads mechanism). A simple fix is: Log::Log4perl->init_and_watch("dllog.conf", 'HUP', {preinit_callback => \&propagate_hup} ); sub propagate_hup { for my $t (threads->list) { $t->kill('HUP'); } return 1; } I'll use this and report any trouble. Regards, John - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] A threading question
Mike, all, > A simple fix is: > > Log::Log4perl->init_and_watch("dllog.conf", 'HUP', >{preinit_callback => \&propagate_hup} ); > sub propagate_hup { >for my $t (threads->list) { $t->kill('HUP'); } >return 1; > } A little too simple upon reflection; I don't know why it didn't chase its tail indefinitely. Better: my $main_tid = threads->tid; sub propagate_hup { if (threads->tid == $main_tid) { for my $t (threads->list) { $t->kill('HUP') unless $t-> == $main_tid; } } return 1; } Regards, John - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] A threading question
Hi Of course, that should be my $main_tid = threads->tid; sub propagate_hup { if (threads->tid == $main_tid) { for my $t (threads->list) { $t->kill('HUP') unless $t->tid == $main_tid; } } return 1; } Regards, John - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel