You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(38) |
Sep
(126) |
Oct
(23) |
Nov
(72) |
Dec
(36) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(76) |
Feb
(32) |
Mar
(19) |
Apr
(6) |
May
(54) |
Jun
(40) |
Jul
(45) |
Aug
(35) |
Sep
(51) |
Oct
(67) |
Nov
(10) |
Dec
(50) |
2004 |
Jan
(51) |
Feb
(22) |
Mar
(22) |
Apr
(28) |
May
(53) |
Jun
(99) |
Jul
(38) |
Aug
(49) |
Sep
(23) |
Oct
(29) |
Nov
(30) |
Dec
(48) |
2005 |
Jan
(15) |
Feb
(21) |
Mar
(25) |
Apr
(16) |
May
(131) |
Jun
|
Jul
(8) |
Aug
(5) |
Sep
(15) |
Oct
|
Nov
(15) |
Dec
(12) |
2006 |
Jan
(15) |
Feb
(20) |
Mar
(8) |
Apr
(10) |
May
(3) |
Jun
(16) |
Jul
(15) |
Aug
(11) |
Sep
(17) |
Oct
(27) |
Nov
(11) |
Dec
(12) |
2007 |
Jan
(19) |
Feb
(18) |
Mar
(33) |
Apr
(4) |
May
(15) |
Jun
(22) |
Jul
(19) |
Aug
(20) |
Sep
(14) |
Oct
(4) |
Nov
(34) |
Dec
(11) |
2008 |
Jan
(8) |
Feb
(18) |
Mar
(2) |
Apr
(4) |
May
(26) |
Jun
(9) |
Jul
(8) |
Aug
(8) |
Sep
(3) |
Oct
(17) |
Nov
(14) |
Dec
(4) |
2009 |
Jan
(6) |
Feb
(41) |
Mar
(21) |
Apr
(10) |
May
(21) |
Jun
|
Jul
(8) |
Aug
(4) |
Sep
(3) |
Oct
(8) |
Nov
(6) |
Dec
(5) |
2010 |
Jan
(14) |
Feb
(13) |
Mar
(7) |
Apr
(12) |
May
(4) |
Jun
(1) |
Jul
(11) |
Aug
(5) |
Sep
|
Oct
(1) |
Nov
(10) |
Dec
|
2011 |
Jan
(7) |
Feb
(3) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(1) |
Jul
(6) |
Aug
(6) |
Sep
(10) |
Oct
(5) |
Nov
(4) |
Dec
(5) |
2012 |
Jan
(4) |
Feb
(5) |
Mar
(1) |
Apr
(7) |
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
(5) |
Oct
(5) |
Nov
(4) |
Dec
(5) |
2013 |
Jan
(6) |
Feb
|
Mar
(14) |
Apr
(9) |
May
(3) |
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
(4) |
Dec
(6) |
2014 |
Jan
|
Feb
(1) |
Mar
(10) |
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
(1) |
Nov
|
Dec
(4) |
2015 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: Mike S. <m...@pe...> - 2008-12-10 06:17:19
|
Hi Log4perl enthusiasts, Log4perl 1.20 has just been released to log4perl.com, here's what's new: 1.20 (2008/12/09) * (ms) Using semctl to reset the value of the semaphore in the Synchronized appender to prevent "Numerical result out of range" problem caused by an unbalanced SEM_UNDO when incrementing it. Reported by John Little. * (ms) Added parameters in curly braces to cspecs in PatternLayout. * (ms) As explained in http://rt.cpan.org/Ticket/Display.html?id=41505 the latest LWP release (5.822) got rid of all of its internal debugging functions, making infiltrate_lwp() and its test case useless. Disabling it for LWP>=5.822. If all goes well, it'll go to CPAN in a couple of days. -- Mike Mike Schilli m...@pe... |
From: Mike S. <m...@pe...> - 2008-12-10 03:39:48
|
On Tue, 9 Dec 2008, Mike Schilli wrote: > Interesting, which version of LWP::UserAgent do you have installed? Never mind, I found it, it's caused by the latest LWP release (5.822), which got rid of all of its internal debugging functions. I'll fix the Log4perl test suite to omit this test in case LWP>=5.822 is installed. Thanks for your report! -- Mike Mike Schilli m...@pe... > > -- Mike > > Mike Schilli > m...@pe... > On Tue, 9 Dec 2008, Martin Armbrecht wrote: > >> I just tried to install Log::Log4perl on Solaris 10 (SPARC) with Perl >> 5.10.0 and ran into the test failure below. >> >> t/048lwp.............1/3 # Failed test at t/048lwp.t line 45. >> # '' # doesn't match '(?-xism:GET\ >> file\:\/tmp\/l4p\-tmpfile\-5804\-3150241)' |
From: Mike S. <m...@pe...> - 2008-12-09 20:19:05
|
On Tue, 9 Dec 2008, Martin Armbrecht wrote: > I just tried to install Log::Log4perl on Solaris 10 (SPARC) with Perl > 5.10.0 and ran into the test failure below. > > t/048lwp.............1/3 # Failed test at t/048lwp.t line 45. > # '' # doesn't match '(?-xism:GET\ > file\:\/tmp\/l4p\-tmpfile\-5804\-3150241)' Interesting, which version of LWP::UserAgent do you have installed? -- Mike Mike Schilli m...@pe... > > # Failed test at t/048lwp.t line 90. > # '' > # doesn't match '(?-xism:LWP/UserAgent.pm-\d+)' > # Looks like you failed 2 tests of 3. > t/048lwp............. Dubious, test returned 2 (wstat 512, 0x200) > Failed 2/3 subtests > t/049Unhide..........ok > t/050Buffer..........ok > t/051Extra...........ok > t/052Utf8............ok > t/053Resurrect.......ok > t/054Subclass........ok > t/055AppDestroy......ok > > Test Summary Report > ------------------- > t/048lwp (Wstat: 512 Tests: 3 Failed: 2) > Failed tests: 1, 3 > Non-zero exit status: 2 > Files=56, Tests=604, 43 wallclock secs ( 1.00 usr 0.46 sys + 16.76 cusr 1.71 > csys = 19.93 CPU) > Result: FAIL > Failed 1/56 test programs. 2/604 subtests failed. > make: *** [test_dynamic] Error 255 > MSCHILLI/Log-Log4perl-1.19.tar.gz > /usr/local/bin/make test -- NOT OK > //hint// to see the cpan-testers results for installing this module, try: > reports MSCHILLI/Log-Log4perl-1.19.tar.gz > Running make install > make test had returned bad status, won't install without force > Failed during this command: > MSCHILLI/Log-Log4perl-1.19.tar.gz : make_test NO > --->8--- > > ------------------------------------------------------------------------------ > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. > The future of the web can't happen without you. Join us at MIX09 to help > pave the way to the Next Web now. Learn more and register at > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |
From: Martin A. <arm...@hb...> - 2008-12-09 14:06:46
|
Hi, I just tried to install Log::Log4perl on Solaris 10 (SPARC) with Perl 5.10.0 and ran into the test failure below. Any hints? Regards Martin ---8<--- Running make test PERL_DL_NONLAZY=1 /files/tools/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/001Level...........ok t/002Logger..........ok t/003Layout..........ok t/004Config..........ok t/005Config-Perl.....ok t/006Config-Java.....skipped: only with Log::Dispatch t/007LogPrio.........ok t/008ConfCat.........ok t/009Deuce...........ok t/010JConsole........skipped: only with Log::Dispatch t/011JFile...........skipped: only with Log::Dispatch t/012Deeper..........skipped: only with Log::Dispatch t/013Bench...........ok t/014ConfErrs........ok t/015fltmsg..........ok t/016Export..........ok t/017Watch...........ok t/018Init............ok t/019Warn............ok t/020Easy............ok t/020Easy2...........ok t/021AppThres........ok t/022Wrap............ok t/023Date............ok t/024WarnDieCarp.....ok t/025CustLevels......ok t/026FileApp.........ok t/027Watch2..........ok t/027Watch3..........ok t/028Additivity......ok t/029SysWide.........ok t/030LDLevel.........ok t/031NDC.............ok t/032JRollFile.......skipped: only with Log::Dispatch::FileRotate 1.10 t/033UsrCspec........ok t/034DBI.............skipped: DBD::CSV or SQL::Statement 1.005 not installed, skipping tests t/035JDBCAppender....skipped: only with Log::Dispatch and DBD::CSV t/036JSyslog.........ok t/037JWin32Event.....skipped: only with Log::Dispatch::Win32EventLog t/038XML-DOM1........skipped: only with XML::DOM > 1.29 t/039XML-DOM2........skipped: only with XML::DOM > 1.29 t/040Filter..........ok t/041SafeEval........ok t/042SyncApp.........skipped: - only with L4P_ALL_TESTS t/043VarSubst........ok t/044XML-Filter......skipped: only with XML::DOM > 1.29 t/045Composite.......ok t/046RRDs............skipped: (RRDs not installed) t/048lwp.............1/3 # Failed test at t/048lwp.t line 45. # '' # doesn't match '(?-xism:GET\ file\:\/tmp\/l4p\-tmpfile\-5804\-3150241)' # Failed test at t/048lwp.t line 90. # '' # doesn't match '(?-xism:LWP/UserAgent.pm-\d+)' # Looks like you failed 2 tests of 3. t/048lwp............. Dubious, test returned 2 (wstat 512, 0x200) Failed 2/3 subtests t/049Unhide..........ok t/050Buffer..........ok t/051Extra...........ok t/052Utf8............ok t/053Resurrect.......ok t/054Subclass........ok t/055AppDestroy......ok Test Summary Report ------------------- t/048lwp (Wstat: 512 Tests: 3 Failed: 2) Failed tests: 1, 3 Non-zero exit status: 2 Files=56, Tests=604, 43 wallclock secs ( 1.00 usr 0.46 sys + 16.76 cusr 1.71 csys = 19.93 CPU) Result: FAIL Failed 1/56 test programs. 2/604 subtests failed. make: *** [test_dynamic] Error 255 MSCHILLI/Log-Log4perl-1.19.tar.gz /usr/local/bin/make test -- NOT OK //hint// to see the cpan-testers results for installing this module, try: reports MSCHILLI/Log-Log4perl-1.19.tar.gz Running make install make test had returned bad status, won't install without force Failed during this command: MSCHILLI/Log-Log4perl-1.19.tar.gz : make_test NO --->8--- |
From: Mike S. <m...@pe...> - 2008-11-21 05:48:11
|
On Thu, 20 Nov 2008, Matthias Weiser wrote: > I am following the FAQs and try to send SMTP mail via Log4Perl. > I first tried this configuration: > > log4perl.category = FATAL, Mailer > log4perl.appender.Mailer = Log::Dispatch::Email::MailSend > log4perl.appender.Mailer.to = x@z.com > log4perl.appender.Mailer.from = y@z.com > log4perl.appender.Mailer.subject = Something's broken! > log4perl.appender.Mailer.layout = SimpleLayout > log4perl.appender.Mailer.Server = x.x.x.x > log4perl.appender.Mailer.smtp = 1 > log4perl.appender.Mailer.buffer=0 Hi Matthias, it looks good to me, I just verified that it works with my SMTP server. > This did not work as smtp is a scalar reference in the constructor of > Mail::Mailer and log4perl seems to call it only with hashes. Not sure what you're using, but my Mail::Mailer's constructor looks like $mailer = Mail::Mailer->new($type, @args); so there's no references, and that's how I think the code in Log::Dispatch::Email::MailSend uses it as well. > Then I tried the suggestion of the module desciption for > Log::Dispatch::Email::MailSend and tried "use Mail::Mailer 'smtp', > Server => 'foo.example.com';" which did not work either. (Cannot > locate 'Server' at log4Perl.pl line 1 Warning: something's wrong at > /opt/ActivePerl-5.8/site/lib/Mail/Mailer.pm line 278). Hmm, your version of Mail::Mailer seems to be different from the one on CPAN -- which one are you using? -- Mike Mike Schilli m...@pe... |
From: Matthias W. <mat...@ya...> - 2008-11-21 05:29:36
|
Hello, I am following the FAQs and try to send SMTP mail via Log4Perl. I first tried this configuration: log4perl.category = FATAL, Mailer log4perl.appender.Mailer = Log::Dispatch::Email::MailSend log4perl.appender.Mailer.to = x@z.com log4perl.appender.Mailer.from = y@z.com log4perl.appender.Mailer.subject = Something's broken! log4perl.appender.Mailer.layout = SimpleLayout log4perl.appender.Mailer.Server = x.x.x.x log4perl.appender.Mailer.smtp = 1 log4perl.appender.Mailer.buffer=0 This did not work as smtp is a scalar reference in the constructor of Mail::Mailer and log4perl seems to call it only with hashes. Then I tried the suggestion of the module desciption for Log::Dispatch::Email::MailSend and tried "use Mail::Mailer 'smtp', Server => 'foo.example.com';" which did not work either. (Cannot locate 'Server' at log4Perl.pl line 1 Warning: something's wrong at /opt/ActivePerl-5.8/site/lib/Mail/Mailer.pm line 278). If possible I would like to avoid writing my own appender. Does someone use Log4Perl with SMTP and can help me? Thanks in advance, Matthias |
From: Mike S. <m...@pe...> - 2008-11-17 06:59:38
|
On Wed, 12 Nov 2008, Anatoliy wrote: > I'm going to use POE library for performing multitasks and I'd like to > use POEs session specific values in the MDC. > > POE doesn't use threads/processes, so I can't make it with global variables. > Is there any thing equal to MDC but for using with $logger object? not > Log::Log4perl class. Thank you for Log::Log4perl anyway :) You're welcome, and that's a very good question, I've added an anwer to the FAQ and made some changes to Log4perl: =head2 How can I access POE heap values from Log4perl's layout? POE is a framework for creating multitasked applications running in a single process and a single thread. POE's threads equivalents are 'sessions' and since they run quasi-simultaneously, you can't use Log4perl's global NDC/MDC to hold session-specific data. However, POE already maintains a data store for every session. It is called 'heap' and is just a hash storing session-specific data in key-value pairs. To access this per-session heap data from a Log4perl layout, define a custom cspec and reference it with the newly defined pattern in the layout: use strict; use POE; use Log::Log4perl qw(:easy); Log::Log4perl->init( \ q{ log4perl.logger = DEBUG, Screen log4perl.appender.Screen = Log::Log4perl::Appender::Screen log4perl.appender.Screen.layout = PatternLayout log4perl.appender.Screen.layout.ConversionPattern = %U %m%n log4perl.PatternLayout.cspec.U = \ sub { POE::Kernel->get_active_session->get_heap()->{ user } } } ); for (qw( Huey Lewey Dewey )) { POE::Session->create( inline_states => { _start => sub { $_[HEAP]->{user} = $_; POE::Kernel->yield('hello'); }, hello => sub { DEBUG "I'm here now"; } } ); } POE::Kernel->run(); exit; The code snippet above defines a new layout placeholder (called 'cspec' in Log4perl) %U which calls a subroutine, retrieves the active session, gets its heap and looks up the entry specified ('user'). Starting with Log::Log4perl 1.20, cspecs also support parameters in curly braces, so you can say log4perl.appender.Screen.layout.ConversionPattern = %U{user} %U{id} %m%n log4perl.PatternLayout.cspec.U = \ sub { POE::Kernel->get_active_session-> \ get_heap()->{ $_[0]->{curlies} } } and print the POE session heap entries 'user' and 'id' with every logged message. For more details on cpecs, read the PatternLayout manual. Hope that helps! -- Mike Mike Schilli m...@pe... |
From: John L. <joh...@gm...> - 2008-11-09 04:02:35
|
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 |
From: John L. <joh...@gm...> - 2008-11-09 03:58:02
|
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 |
From: John L. <joh...@gm...> - 2008-11-09 02:11:11
|
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 |
From: Mike S. <m...@pe...> - 2008-11-08 07:07:17
|
On Sat, 8 Nov 2008, John Little wrote: > 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. Can you provide code to reproduce the problem? I'd be happy to track it down. -- Mike Mike Schilli m...@pe... |
From: John L. <joh...@gm...> - 2008-11-08 05:38:41
|
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 |
From: Mike S. <m...@pe...> - 2008-11-08 04:21:48
|
On Sat, 8 Nov 2008, John Little wrote: > 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 ^@^@^@^@^@^@^@^@^A^@^@^P) failed: Numerical result out > of range at Got it, it's not really related to threads, there was a bug in the semaphore code that caused this, I've fixed it in CVS, it'll roll out with the next release (1.20). 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 http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl/FAQ.pm#How_can_I_synchronize_access_to_an_appender -- Mike Mike Schilli m...@pe... |
From: John L. <joh...@gm...> - 2008-11-08 00:51:23
|
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 ^@^@^@^@^@^@^@^@^A^@^@^P) failed: Numerical result out of range at /usr/local/lib/perl5/site_perl/5.10.0/Log/Log4perl/Util/Semaphore.pm line 192, <GEN3277> chunk 2. semop(1343496 ^@^@^@^@^@^@^@^@^A^@^@^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 |
From: Mike S. <m...@pe...> - 2008-11-06 23:06:56
|
On Thu, 6 Nov 2008, Mathieu Longtin wrote: > I have a program that processes a bunch of separate items, logging stuff as > it goes. I would like to be able to capture what gets logged during the > processing on one item, and email the whole thing if the processing failed. > The log messages should go to a file regardless. > > Is there a way to do that in log4perl currently? You could use one of the Log::Dispatch::Email::* modules on CPAN and set it to 'buffered': http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl/FAQ.pm#How_can_I_configure_Log::Log4perl_to_send_me_email_if_something_happens? When it is time to flush it, retrieve the appender by name and call its flush() method. But I'd probably just use Log4perl to write everything to a log file (use overwrite mode to start a new log file every time) and at the end of the program run a check and send off the logfile via a CPAN module like Mail::DWIM. -- Mike Mike Schilli m...@pe... |
From: Mathieu L. <ma...@cl...> - 2008-11-06 20:22:54
|
I have a program that processes a bunch of separate items, logging stuff as it goes. I would like to be able to capture what gets logged during the processing on one item, and email the whole thing if the processing failed. The log messages should go to a file regardless. Is there a way to do that in log4perl currently? Thanks -- Mathieu Longtin 1-514-803-8977 |
From: Mathieu L. <ma...@cl...> - 2008-11-06 20:05:54
|
I have a program that processes a bunch of separate items, logging stuff as it goes. I would like to be able to capture what gets logged during the processing on one item, and email the whole thing if the processing failed. Is there a way to do that in log4perl currently? -- Mathieu Longtin 1-514-803-8977 |
From: John L. <joh...@gm...> - 2008-11-06 04:38:38
|
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 |
From: Erskine, T. \(IT\) <Tho...@mo...> - 2008-10-30 18:33:44
|
That's got it. Thanks muchly. Thomas Erskine Consultant | Technology 2000 Barrington St | Suite 300 | Floor 04 Halifax, NS B3J3K1 Phone: +1 902 442-4709 Tho...@mo... > -----Original Message----- > From: Mike Schilli [mailto:m...@pe...] > Sent: Thursday, October 30, 2008 3:19 PM > To: Erskine, Thomas (IT) > Cc: Mike Schilli; log...@li... > Subject: RE: [log4perl-devel] activating appenders > > On Thu, 30 Oct 2008, Erskine, Thomas (IT) wrote: > > > The problem with setting a threshold on the appender to > cause it not > > ot log is that I don't see a way to programmatically set > the threshold > > to a specific level. It can be bumped up or down, but that > requires > > the program to know where the threshold was set in the > configuration. > > I.E. configuration in the program, which I'm trying to avoid. > > It's a bit tricky because you need access to Log4perl's > appender wrapper, not the appender itself: > > "The previously mentioned method "appender_by_name()" returns > a refer- rence to the real appender object. If you want > access to the wrapper class (e.g. if you want to modify the > appender’s threshold), use the hash > $Log::Log4perl::Logger::APPENDER_BY_NAME{...} instead, which > holds references all appender wrapper objects." [perldoc > Log::Log4perl] > > So, if you have a disabled appender like > > log4perl.appender.SCREEN=Log::Log4perl::Appender::Screen > log4perl.appender.SCREEN.layout = SimpleLayout > log4perl.appender.SCREEN.Threshold = OFF > > in your configuration, you can retrieve its threshold setting via > > my $app = $Log::Log4perl::Logger::APPENDER_BY_NAME{"SCREEN"}; > my $threshold = $app->threshold(); > > and print it out like > > print "Threshold set to ", > Log::Log4perl::Level::to_level( $threshold ), > "\n"; > > If you want to enable the appender, set > > $threshold = $app->threshold( $ALL ); > > If you want to disable it again, set > > $threshold = $app->threshold( $OFF ); > > -- Mike > > Mike Schilli > m...@pe... > > > > > The best I've been able to come up with is to define a > logger with a > > threshold which won't log, call it deactivated, and assign this > > appender to it. Then to activate this appender, I can use > > appender_by_name(...) and get_root_logger()->add_appender(...). It > > took me a while to find it as get_root_logger is only defined on > > Log::Log4perl::Logger, not in Log::Log4perl. > > > > Thomas Erskine > > Consultant | Technology > > 2000 Barrington St | Suite 300 | Floor 04 Halifax, NS B3J3K1 > > Phone: +1 902 442-4709 > > Tho...@mo... > > > > > >> -----Original Message----- > >> From: Mike Schilli [mailto:m...@pe...] > >> Sent: Wednesday, October 29, 2008 5:29 PM > >> To: Erskine, Thomas (IT) > >> Cc: log...@li... > >> Subject: Re: [log4perl-devel] activating appenders > >> > >> On Wed, 29 Oct 2008, Erskine, Thomas (IT) wrote: > >> > >>> I want to be able to define an appender in the log4perl > >> config file, > >>> but not activated and then activate it programmatically However, > >>> Log::Log4perl->appender_by_name('SCREENDEBUG') returns undef. > >>> > >>> I guess I could add SCREENDEBUG to the log4perl.logger line > >> and define > >>> it with a threshold which won't log anything and then bump the > >>> threshold up at runtime, but it seems wrong somehow. > >> > >> An appender that's not assigned to any logger in the > >> configuration is ignored by Log4perl at this point -- I think > >> that using a threshold, as you've suggested, is a perfectly > >> valid solution, though. > >> > >> Alternatively, you can define the appender programmatically > >> and add it to the logger via add_appender(). > >> > >> -- Mike > >> > >> Mike Schilli > >> m...@pe... > >> > > -------------------------------------------------------- > > > > NOTICE: If received in error, please destroy and notify > sender. Sender does not intend to waive confidentiality or > privilege. Use of this email is prohibited when received in error. > > > -------------------------------------------------------- NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. |
From: Mike S. <m...@pe...> - 2008-10-30 18:19:26
|
On Thu, 30 Oct 2008, Erskine, Thomas (IT) wrote: > The problem with setting a threshold on the appender to cause it not > ot log is that I don't see a way to programmatically set the threshold > to a specific level. It can be bumped up or down, but that requires > the program to know where the threshold was set in the configuration. > I.E. configuration in the program, which I'm trying to avoid. It's a bit tricky because you need access to Log4perl's appender wrapper, not the appender itself: "The previously mentioned method "appender_by_name()" returns a refer- rence to the real appender object. If you want access to the wrapper class (e.g. if you want to modify the appender’s threshold), use the hash $Log::Log4perl::Logger::APPENDER_BY_NAME{...} instead, which holds references all appender wrapper objects." [perldoc Log::Log4perl] So, if you have a disabled appender like log4perl.appender.SCREEN=Log::Log4perl::Appender::Screen log4perl.appender.SCREEN.layout = SimpleLayout log4perl.appender.SCREEN.Threshold = OFF in your configuration, you can retrieve its threshold setting via my $app = $Log::Log4perl::Logger::APPENDER_BY_NAME{"SCREEN"}; my $threshold = $app->threshold(); and print it out like print "Threshold set to ", Log::Log4perl::Level::to_level( $threshold ), "\n"; If you want to enable the appender, set $threshold = $app->threshold( $ALL ); If you want to disable it again, set $threshold = $app->threshold( $OFF ); -- Mike Mike Schilli m...@pe... > > The best I've been able to come up with is to define a logger with a > threshold which won't log, call it deactivated, and assign this appender > to it. Then to activate this appender, I can use appender_by_name(...) > and get_root_logger()->add_appender(...). It took me a while to find it > as get_root_logger is only defined on Log::Log4perl::Logger, not in > Log::Log4perl. > > Thomas Erskine > Consultant | Technology > 2000 Barrington St | Suite 300 | Floor 04 > Halifax, NS B3J3K1 > Phone: +1 902 442-4709 > Tho...@mo... > > >> -----Original Message----- >> From: Mike Schilli [mailto:m...@pe...] >> Sent: Wednesday, October 29, 2008 5:29 PM >> To: Erskine, Thomas (IT) >> Cc: log...@li... >> Subject: Re: [log4perl-devel] activating appenders >> >> On Wed, 29 Oct 2008, Erskine, Thomas (IT) wrote: >> >>> I want to be able to define an appender in the log4perl >> config file, >>> but not activated and then activate it programmatically However, >>> Log::Log4perl->appender_by_name('SCREENDEBUG') returns undef. >>> >>> I guess I could add SCREENDEBUG to the log4perl.logger line >> and define >>> it with a threshold which won't log anything and then bump the >>> threshold up at runtime, but it seems wrong somehow. >> >> An appender that's not assigned to any logger in the >> configuration is ignored by Log4perl at this point -- I think >> that using a threshold, as you've suggested, is a perfectly >> valid solution, though. >> >> Alternatively, you can define the appender programmatically >> and add it to the logger via add_appender(). >> >> -- Mike >> >> Mike Schilli >> m...@pe... >> > -------------------------------------------------------- > > NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. > |
From: Erskine, T. \(IT\) <Tho...@mo...> - 2008-10-30 18:14:13
|
Hi Mike. According to the docs, it ought to have worked but it doesn't. I've got a config like: ------ begin config ------ layout = %d{yyyy-MM-ddTHH:mm:ss} %P %p %c %H %m%n # Assign various things to various appenders log4perl.rootlogger = TRACE, FILE, SCREEN log4perl.logger.deactivated = OFF, SCREENDEBUG # Log everything to a file log4perl.appender.FILE = Log::Log4perl::Appender::File log4perl.appender.FILE.filename = sub { main::get_log_name(); } log4perl.appender.FILE.mode = clobber log4perl.appender.FILE.Threshold = TRACE log4perl.appender.FILE.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.FILE.layout.ConversionPattern = FILE ${layout} log4perl.appender.SCREEN = Log::Log4perl::Appender::Screen log4perl.appender.SCREEN.Threshold = ERROR log4perl.appender.SCREEN.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.SCREEN.layout.ConversionPattern = SCREEN ${layout} log4perl.appender.SCREENDEBUG = Log::Log4perl::Appender::ScreenColoredLevels log4perl.appender.SCREENDEBUG.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.SCREENDEBUG.layout.ConversionPattern = SCREENDEBUG ${layout} ------ end ------ The code looks like: ------ begin code ------ Log::Log4perl::init_and_watch($CONFIG_FILE, 10); my $logger = Log::Log4perl->get_logger(); if ( $screen eq 'SCREENDEBUG' ) { my $app = Log::Log4perl->appender_by_name('SCREENDEBUG'); $logger->add_appender($app); eval { $app = Log::Log4perl->appender_by_name('SCREEN'); Log::Log4perl::Logger->get_root_logger()->remove_appender($app); }; if ($@) { warn("can't remove SCREEN appender: $@"); } } The first part (adding SCREENDEBUG workd; the second doesn't. The error I get is: can't remove SCREEN appender: No such appender: Log::Log4perl::Appender::Screen=HASH(0x843cf28) at //ms/dist/perl5/PROJ/Log-Log4perl/1.13/lib/perl5/Log/Log4perl/Logger.pm line 607. Which is strange as, running under the debugger, I can see both appenders listed in the root logger. Any ideas? ------ end ------ Thomas Erskine Consultant | Technology 2000 Barrington St | Suite 300 | Floor 04 Halifax, NS B3J3K1 Phone: +1 902 442-4709 Tho...@mo... > -----Original Message----- > From: Erskine, Thomas (IT) > Sent: Thursday, October 30, 2008 12:03 PM > To: 'Mike Schilli' > Cc: log...@li... > Subject: RE: [log4perl-devel] activating appenders > > Hi Mike. > > I want to have the appender defined in the configuration for > doccumentation and because having log configuration external > to the program is (at least) half the point of a logging system IMHO. > > The problem with setting a threshold on the appender to cause > it not ot log is that I don't see a way to programmatically > set the threshold to a specific level. It can be bumped up > or down, but that requires the program to know where the > threshold was set in the configuration. I.E. configuration > in the program, which I'm trying to avoid. > > The best I've been able to come up with is to define a logger > with a threshold which won't log, call it deactivated, and > assign this appender to it. Then to activate this appender, > I can use appender_by_name(...) and > get_root_logger()->add_appender(...). It took me a while to > find it as get_root_logger is only defined on > Log::Log4perl::Logger, not in Log::Log4perl. > > Thomas Erskine > Consultant | Technology > 2000 Barrington St | Suite 300 | Floor 04 Halifax, NS B3J3K1 > Phone: +1 902 442-4709 > Tho...@mo... > > > > -----Original Message----- > > From: Mike Schilli [mailto:m...@pe...] > > Sent: Wednesday, October 29, 2008 5:29 PM > > To: Erskine, Thomas (IT) > > Cc: log...@li... > > Subject: Re: [log4perl-devel] activating appenders > > > > On Wed, 29 Oct 2008, Erskine, Thomas (IT) wrote: > > > > > I want to be able to define an appender in the log4perl > > config file, > > > but not activated and then activate it programmatically However, > > > Log::Log4perl->appender_by_name('SCREENDEBUG') returns undef. > > > > > > I guess I could add SCREENDEBUG to the log4perl.logger line > > and define > > > it with a threshold which won't log anything and then bump the > > > threshold up at runtime, but it seems wrong somehow. > > > > An appender that's not assigned to any logger in the > configuration is > > ignored by Log4perl at this point -- I think that using a > threshold, > > as you've suggested, is a perfectly valid solution, though. > > > > Alternatively, you can define the appender programmatically > and add it > > to the logger via add_appender(). > > > > -- Mike > > > > Mike Schilli > > m...@pe... > > -------------------------------------------------------- NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. |
From: Erskine, T. \(IT\) <Tho...@mo...> - 2008-10-30 15:03:28
|
Hi Mike. I want to have the appender defined in the configuration for doccumentation and because having log configuration external to the program is (at least) half the point of a logging system IMHO. The problem with setting a threshold on the appender to cause it not ot log is that I don't see a way to programmatically set the threshold to a specific level. It can be bumped up or down, but that requires the program to know where the threshold was set in the configuration. I.E. configuration in the program, which I'm trying to avoid. The best I've been able to come up with is to define a logger with a threshold which won't log, call it deactivated, and assign this appender to it. Then to activate this appender, I can use appender_by_name(...) and get_root_logger()->add_appender(...). It took me a while to find it as get_root_logger is only defined on Log::Log4perl::Logger, not in Log::Log4perl. Thomas Erskine Consultant | Technology 2000 Barrington St | Suite 300 | Floor 04 Halifax, NS B3J3K1 Phone: +1 902 442-4709 Tho...@mo... > -----Original Message----- > From: Mike Schilli [mailto:m...@pe...] > Sent: Wednesday, October 29, 2008 5:29 PM > To: Erskine, Thomas (IT) > Cc: log...@li... > Subject: Re: [log4perl-devel] activating appenders > > On Wed, 29 Oct 2008, Erskine, Thomas (IT) wrote: > > > I want to be able to define an appender in the log4perl > config file, > > but not activated and then activate it programmatically However, > > Log::Log4perl->appender_by_name('SCREENDEBUG') returns undef. > > > > I guess I could add SCREENDEBUG to the log4perl.logger line > and define > > it with a threshold which won't log anything and then bump the > > threshold up at runtime, but it seems wrong somehow. > > An appender that's not assigned to any logger in the > configuration is ignored by Log4perl at this point -- I think > that using a threshold, as you've suggested, is a perfectly > valid solution, though. > > Alternatively, you can define the appender programmatically > and add it to the logger via add_appender(). > > -- Mike > > Mike Schilli > m...@pe... > -------------------------------------------------------- NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. |
From: Mike S. <m...@pe...> - 2008-10-29 20:29:16
|
On Wed, 29 Oct 2008, Erskine, Thomas (IT) wrote: > I want to be able to define an appender in the log4perl config file, > but not activated and then activate it programmatically However, > Log::Log4perl->appender_by_name('SCREENDEBUG') returns undef. > > I guess I could add SCREENDEBUG to the log4perl.logger line and define > it with a threshold which won't log anything and then bump the threshold > up at runtime, but it seems wrong somehow. An appender that's not assigned to any logger in the configuration is ignored by Log4perl at this point -- I think that using a threshold, as you've suggested, is a perfectly valid solution, though. Alternatively, you can define the appender programmatically and add it to the logger via add_appender(). -- Mike Mike Schilli m...@pe... |
From: Erskine, T. \(IT\) <Tho...@mo...> - 2008-10-29 13:09:40
|
Hi folks. I want to be able to define an appender in the log4perl config file, but not activated and then activate it programmatically. I.E. I have: log4perl.logger = TRACE, FILE, SCREEN log4perl.appender.FILE = Log::Log4perl::Appender::File ... [definition snipped] log4perl.appender.SCREEN = Log::Log4perl::Appender::Screen ... [definition snipped] log4perl.appender.SCREENDEBUG = Log::Log4perl::Appender::ScreenColoredLevels ... [definition snipped] However, Log::Log4perl->appender_by_name('SCREENDEBUG') returns undef. I guess I could add SCREENDEBUG to the log4perl.logger line and define it with a threshold which won't log anything and then bump the threshold up at runtime, but it seems wrong somehow. Is there a way to do this, using the public API, or am I stuck with diddling the threshiold? Thomas Erskine Consultant | Technology 2000 Barrington St | Suite 300 | Floor 04 Halifax, NS B3J3K1 Phone: +1 902 442-4709 Tho...@mo... -------------------------------------------------------- NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. |
From: Mike S. <m...@pe...> - 2008-10-26 01:19:24
|
Hi Log4perl enthusiasts, the 1.19 maintenance release has just hit the website. Here are the changes: 1.19 (2008/10/22) * (ms) Applied patch by Peter Rabbitson, which fixes the caller() level when calling get_logger() on a subclass of Log4perl. * (ms) Added documentation on is_xxx() methods and clarified that it doesn't necessarily mean that a message gets logged if they're returning true (requested by Conway Allen via [rt.cpan.org #39085]. * (ms) Applied patch by Lee Johnson to appender_by_name() to allow for undefined appender names without issuing a warning, which was occurring with Catalyst::Log4perl. * (ms) Added docs on numerical levels and level strings in Log::Log4perl::Level. * (ms) Applied patch by Anthony Foiani for support of literal text in DateFormat format strings. Give it a whirl: http://log4perl.sourceforge.net/releases/Log-Log4perl-1.19.tar.gz If all goes well, it'll hit CPAN in a couple of days. Enjoy! -- Mike Mike Schilli m...@pe... |