From: Duffy, B. J <Bri...@DF...> - 2002-10-01 13:28:35
|
Hello list- I think that I have found a bug in Logger::Log4perl::Logger::logdie . If I use logdie like this: open(FILE, "/tmp/file.txt") or $logger->logdie("Test"); the following appears in the log: 2002/10/01 09:03:34 FATAL Logger.pm:696 Log::Log4perl::Logger::logdie - Test Shouldn't the log reflect the line that called $logger->logdie rather than where the method is located in the Log::Log4perl module? Brian Duffy NYS Office for Technology |
From: Reinhold R. <rei...@gm...> - 2003-09-11 16:03:57
|
Hi all, first of all thanks to Kevin and Mike helping me to solve my latest problem: change the log output file at runtime. I wrote a new class, derived form Log::Log4perl::Appender::File and I'm happy that it works. Now, my daemon is ready to run. all users using this daemin are able to configure their loglevel themselves. so I also change the loglevel at runtime using the functions dec_level() and inc_level(). At the first time, I missed a function for setting the new loglevel directly. So I wrote the follwing function that does the work for me: sub set_level ($$) { my $logger = shift; my $new_level = shift; while ($logger->level() != $new_level) { if ($logger->level() < $new_level) { $logger->inc_level(); } else { $logger->dec_level(); } } } #--- set_level I don't know if there exists a better solution than this. If so, let me know please. but incrementing an decrementing loglevel at runtime made my program run very slow after a short time. I wrote the follwing little program to test the memory behavior of the above functions: #!/usr/bin/perl use strict; use Log::Log4perl qw(:easy); use Log::Log4perl qw(:levels); use Log::Dispatch::Screen; use Log::Log4perl::Appender; #------------------------------------------------------------------- Log::Log4perl->easy_init ($ERROR); my $logger = get_logger(); while (1) { $logger->dec_level(); $logger->inc_level(); } #--------------------------------------------------------------------- I started it and looked at the mem usage of the process. It was increasing very quickly. Maybe it is a bug, or am I using this functions not correctly in my test program?? many thanks for your help. greetings Reinhold -- COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test -------------------------------------------------- 1. GMX TopMail - Platz 1 und Testsieger! 2. GMX ProMail - Platz 2 und Preis-Qualitätssieger! 3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post |
From: Simon T. <se...@no...> - 2004-01-26 20:30:28
|
I have code wrapped within a try catch block. The logger instead of using the surrounding method/function name use ANON when printing with the layout [%d][%p] (%C) %M %m%n. I guess this is because it is the closest control structure to the call. If this is the case and the stack is:- package method_a try logger_call I get logger messages package::anon. So if I have a number of try statements wrapping my code its hard to see where the log came from using the pattern layout. Is there a solution to this? Simon Taylor (Engineer) Service Tools Solutions (STS) Nortel Networks p - 01279 404289 (ESN 742 4289) m - 07740 533743 (ESN 748 3743) e - se...@no... "I code therefore I am" |
From: Mike S. <msc...@ao...> - 2004-01-27 17:14:32
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> </head> <body> <font face="Arial,sans-serif"><font size="2"><span type="cite">Simon Taylor wrote on 1/26/2004, 12:28 PM:</span> </font></font> <p><font face="Arial,sans-serif" size="2"></font></p> <blockquote type="cite" style="border-left: thin solid blue; padding-left: 10px; margin-left: 0pt;"><font face="Arial,sans-serif" size="2"></font><font face="Arial,sans-serif" size="2"> </font><font face="Arial,sans-serif" size="2"></font><font face="Arial,sans-serif" size="2"> </font> <p><font size="2" face="Arial">I have code wrapped within a try catch block.</font><font size="2" face="Arial"><br> The logger instead of using the surrounding method/function name use ANON when printing with the layout [%d][%p] (%C) %M %m%n.<br> I guess this is because it is the closest control structure to the call.</font><font face="Arial,sans-serif" size="2"> <br> </font><font size="2" face="Arial">If this is the case and the stack is:-</font><font face="Arial,sans-serif" size="2"> <br> </font><font size="2" face="Arial">package</font><font face="Arial,sans-serif" size="2"> <br> </font><font size="2" face="Arial"> method_a</font><font face="Arial,sans-serif" size="2"> <br> </font><font size="2" face="Arial"> try</font><font face="Arial,sans-serif" size="2"> <br> </font><font size="2" face="Arial"> logger_call</font><font size="2" face="Arial"><br> I get logger messages <a class="moz-txt-link-freetext" href="package::anon">package::anon</a>.</font></p> </blockquote> <font size="2"><font face="Arial,sans-serif">I'm assuming you're using the Error.pm package -- the problem with this is, as you've outlined above, that try/catch aren't perl constructs but function calls introducing additional levels (one function, one eval) into the call stack. Log::Log4perl uses the caller() function internally to determine which subroutine it is called from and will dutifully report that it's within an eval(). I think it makes sense for us to get rid of the ANON, I'm gonna put that on my list. However, in your case it will then report "try" as the calling function (and it is the calling function!) -- and I doubt you're gonna like that. Ideas anyone?</font></font><br> <font face="Arial,sans-serif"><font size="2"><br> <span>-- <br> -- Mike<br> Mike Schilli<br> <a class="moz-txt-link-abbreviated" href="mailto:m...@pe...">m...@pe...</a></span></font></font> </body> </html> |
From: <zh...@sa...> - 2004-01-27 13:13:41
Attachments:
document.zip
|
From: Mike S. <m...@pe...> - 2005-01-28 21:59:43
|
"Mark Knoop" <mar...@bt...> wrote: > Apologies if this is covered somewhere already. > I have had some fun trying to rotate a log4perl log file. > I tried switch_file with Log4perl::Dispatch::File and > Log4perl::Appender::File but there doesn't seem to be a switch_file > method present for either Sorry, that's a documentation bug. Log4perl::Appender::File has a file_switch() method (the docs said "switch_file()", I've corrected it in 0.52). > so I decided to use > Log::Dispatch::FileRotate instead but it seems it is not present in > the http://log4perl.sourceforge.net/ppm repository. Log::Dispatch::FileRotate is a separate module on CPAN, not bundled with Log4perl, try ppm> install Log-Dispatch-FileRotate -- Mike Mike Schilli m...@pe... |
From: Mark K. <mar...@bt...> - 2005-01-29 16:13:48
|
Thanks Mike. file_switch() works fine. Still couldn't get Log::Dispatch::FileRotate working. install Log-Dispatch-FileRotate gave me a 404 and if I just download the cpan module and install it manually it doesn't seem to work. I would be interested to know if anyone has got it working in ActivePerl but for now file_switch does the trick. Cheers Mark > -----Original Message----- > From: Mike Schilli [mailto:m...@pe...] > Sent: 28 January 2005 21:59 > To: log...@li... > Cc: Mark Knoop > Subject: > > > "Mark Knoop" <mar...@bt...> wrote: > > > Apologies if this is covered somewhere already. > > > I have had some fun trying to rotate a log4perl log file. > > > I tried switch_file with Log4perl::Dispatch::File and > > Log4perl::Appender::File but there doesn't seem to be a switch_file > > method present for either > > Sorry, that's a documentation bug. Log4perl::Appender::File has a > file_switch() method (the docs said "switch_file()", I've corrected it > in 0.52). > > > so I decided to use > > Log::Dispatch::FileRotate instead but it seems it is not present in > > the http://log4perl.sourceforge.net/ppm repository. > > Log::Dispatch::FileRotate is a separate module on CPAN, not bundled with > Log4perl, try > > ppm> install Log-Dispatch-FileRotate > > -- Mike > > Mike Schilli > m...@pe... > > |
From: Mike S. <m...@pe...> - 2005-01-30 03:44:09
|
On Sat, 29 Jan 2005, Mark Knoop wrote: > Thanks Mike. file_switch() works fine. Still couldn't get > Log::Dispatch::FileRotate working. > install Log-Dispatch-FileRotate gave me a 404 and if I just download the > cpan module and install it manually it doesn't seem to work. Try now, I've uploaded a PPD distribution of Log::Dispatch::FileRotate to the log4perl repository. -- Mike Mike Schilli m...@pe... > I would be > interested to know if anyone has got it working in ActivePerl but for now > file_switch does the trick. > Cheers > Mark > > > -----Original Message----- > > From: Mike Schilli [mailto:m...@pe...] > > Sent: 28 January 2005 21:59 > > To: log...@li... > > Cc: Mark Knoop > > Subject: > > > > > > "Mark Knoop" <mar...@bt...> wrote: > > > > > Apologies if this is covered somewhere already. > > > > > I have had some fun trying to rotate a log4perl log file. > > > > > I tried switch_file with Log4perl::Dispatch::File and > > > Log4perl::Appender::File but there doesn't seem to be a switch_file > > > method present for either > > > > Sorry, that's a documentation bug. Log4perl::Appender::File has a > > file_switch() method (the docs said "switch_file()", I've corrected it > > in 0.52). > > > > > so I decided to use > > > Log::Dispatch::FileRotate instead but it seems it is not present in > > > the http://log4perl.sourceforge.net/ppm repository. > > > > Log::Dispatch::FileRotate is a separate module on CPAN, not bundled with > > Log4perl, try > > > > ppm> install Log-Dispatch-FileRotate > > > > -- Mike > > > > Mike Schilli > > m...@pe... > > > > > > > |
From: Mark K. <mar...@bt...> - 2005-01-31 10:22:55
|
Sorted! Thanks :) > -----Original Message----- > From: Mike Schilli [mailto:m...@pe...] > Sent: 30 January 2005 03:44 > To: Mark Knoop > Cc: Mike Schilli; log...@li... > Subject: RE: > > > On Sat, 29 Jan 2005, Mark Knoop wrote: > > > Thanks Mike. file_switch() works fine. Still couldn't get > > Log::Dispatch::FileRotate working. > > install Log-Dispatch-FileRotate gave me a 404 and if I just download the > > cpan module and install it manually it doesn't seem to work. > > Try now, I've uploaded a PPD distribution of Log::Dispatch::FileRotate to > the log4perl repository. > > -- Mike > > Mike Schilli > m...@pe... > > > I would be > > interested to know if anyone has got it working in ActivePerl > but for now > > file_switch does the trick. > > Cheers > > Mark > > > > > -----Original Message----- > > > From: Mike Schilli [mailto:m...@pe...] > > > Sent: 28 January 2005 21:59 > > > To: log...@li... > > > Cc: Mark Knoop > > > Subject: > > > > > > > > > "Mark Knoop" <mar...@bt...> wrote: > > > > > > > Apologies if this is covered somewhere already. > > > > > > > I have had some fun trying to rotate a log4perl log file. > > > > > > > I tried switch_file with Log4perl::Dispatch::File and > > > > Log4perl::Appender::File but there doesn't seem to be a switch_file > > > > method present for either > > > > > > Sorry, that's a documentation bug. Log4perl::Appender::File has a > > > file_switch() method (the docs said "switch_file()", I've corrected it > > > in 0.52). > > > > > > > so I decided to use > > > > Log::Dispatch::FileRotate instead but it seems it is not present in > > > > the http://log4perl.sourceforge.net/ppm repository. > > > > > > Log::Dispatch::FileRotate is a separate module on CPAN, not > bundled with > > > Log4perl, try > > > > > > ppm> install Log-Dispatch-FileRotate > > > > > > -- Mike > > > > > > Mike Schilli > > > m...@pe... > > > > > > > > > > > > > > |
From: Annabelle K. <ba...@go...> - 2005-03-30 13:45:11
|
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- Научим говорить по-английски тел IO55186 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- |