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-02-10 08:11:33
|
Hi Log::Log4perl enthusiasts, Log::Log4perl 1.15 has just been pushed to the log4perl.com website. Here's what's new in this maintenance release: 1.15 (2008/02/10) * (ms) appender_thresholds_adjust() with a parameter of 0 now does nothing (requested by Oliver Koch). * (kg) Added 'defer_connection' to Socket appender so it's more useful under Apache. * (ms) [rt.cpan.org #32738] fixed caller_depth for error_warn() (reported by Felix Antonius Wilhelm Ostmann) * (ms) [rt.cpan.org #32942] fixed get_logger() for subclassed Log4perl (reported by Felix Antonius Wilhelm Ostmann) If all goes well, it'll be pushed to CPAN in a couple of days. Enjoy! -- Mike Mike Schilli m...@pe... |
From: Mike S. <m...@pe...> - 2008-02-09 19:02:26
|
On Sat, 9 Feb 2008, Kevin M. Goess wrote: > It's possible, but it's probably less than straightforward. Each > appender has exactly one layout, so what you'll need to do is create > two appenders, and use some combination of thresholds and filters so > that one appender only logs WARN messages and the other appender logs > everything else. Exactly, something along these lines: use Log::Log4perl qw(:easy); my $conf = q{ log4perl.logger = DEBUG, AppWarn, AppRest # Filter to match level WARN log4perl.filter.MatchWarn = Log::Log4perl::Filter::LevelMatch log4perl.filter.MatchWarn.LevelToMatch = WARN log4perl.filter.MatchWarn.AcceptOnMatch = true # Filter to match everything but WARN log4perl.filter.MatchRest = Log::Log4perl::Filter::LevelMatch log4perl.filter.MatchRest.LevelToMatch = WARN log4perl.filter.MatchRest.AcceptOnMatch = false # Elaborate layout for WARN messages log4perl.appender.AppRest = Log::Log4perl::Appender::Screen log4perl.appender.AppRest.layout = PatternLayout log4perl.appender.AppRest.layout.ConversionPattern = %F-%L %m%n log4perl.appender.AppRest.Filter = MatchWarn # Normal layout for the rest log4perl.appender.AppWarn = Log::Log4perl::Appender::Screen log4perl.appender.AppWarn.layout = PatternLayout log4perl.appender.AppWarn.layout.ConversionPattern: %m%n log4perl.appender.AppWarn.Filter = MatchRest }; Log::Log4perl->init(\$conf); DEBUG "debug message"; WARN "warn message"; ERROR "error message"; will print debug message ./t-38 warn message error message -- Mike Mike Schilli m...@pe... |
From: Kevin M. G. <ke...@go...> - 2008-02-09 15:49:53
|
It's possible, but it's probably less than straightforward. Each appender has exactly one layout, so what you'll need to do is create two appenders, and use some combination of thresholds and filters so that one appender only logs WARN messages and the other appender logs everything else. On Feb 8, 2008, at 5:01 PM, Kristis Makris wrote: > Hello, > > I recently started toying with log4perl, and incorporated it in an > application. I need the capability to define a log layout for WARN > messages that is a lot more user-friendly/readable than the others. > > After reading the documentation at: > > http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/ > Log4perl.html#1d6b5 > > and the tutorial, I haven't seen a way to define such different > layouts > per level. Did I just miss it ? Is this possible using log4perl ? > > Thanks, > Kristis > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |
From: Kristis M. <kri...@as...> - 2008-02-09 01:01:57
|
Hello, I recently started toying with log4perl, and incorporated it in an application. I need the capability to define a log layout for WARN messages that is a lot more user-friendly/readable than the others. After reading the documentation at: http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4perl.html#1d6b5 and the tutorial, I haven't seen a way to define such different layouts per level. Did I just miss it ? Is this possible using log4perl ? Thanks, Kristis |
From: Kevin M. G. <cp...@go...> - 2008-02-08 17:03:08
|
>> local $Log::Log4perl::caller_depth = >> $Log::Log4perl::caller_depth + 2; > > I should have said I knew I could do this but a) there > are an awful lot of methods b) when logging is not > enabled each method has the overhead of the above > statement for nothing. Well, that's true, but the overhead is dwarfed by what it's already costing you to subclass the DBI methods. On my box I can process 196,002 child-method calls per second, and that decreases to 176,991 calls per second when adding the manipulation of $caller_depth. On the other hand, calling the parent method would have run at 1,689,189 per second. And you could probably improve the performance of manipulating $caller_depth by skipping it unless $h->{logger}->is_debug is true. call_local: 3 wallclock secs ( 1.92 usr + 0.00 sys = 1.92 CPU) @ 2604166.67/s (n=5000000) child_with_local: 29 wallclock secs (28.19 usr + 0.06 sys = 28.25 CPU) @ 176991.15/s (n=5000000) childmethod: 26 wallclock secs (25.47 usr + 0.04 sys = 25.51 CPU) @ 196001.57/s (n=5000000) supermethod: 3 wallclock secs ( 2.95 usr + 0.01 sys = 2.96 CPU) @ 1689189.19/s (n=5000000) ---------------- use strict; use Benchmark; $Log::Log4perl::caller_depth = 0; { package testpackage; sub runmethod {} } { package child::testpackage; push our @ISA, 'testpackage'; sub runmethod { my($sth, @args) = @_; my $h = $sth->{private_DBIx_Log4perl}; my $res = $sth->SUPER::runmethod(@args); } #the same thing, but with a local() call added sub runmethod_with_local { my($sth, @args) = @_; local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 2 if ; my $h = $sth->{private_DBIx_Log4perl}; my $res = $sth->SUPER::runmethod(@args); } } my $dbh = {}; bless $dbh, 'testpackage'; my $dbhX = {private_DBIX_Log4perl => 1}; bless $dbhX, 'child::testpackage'; my @args = (1,2,3); timethese( 5000000, { supermethod => sub { $dbh->runmethod(@args) }, childmethod => sub { $dbhX->runmethod(@args) }, child_with_local => sub { $dbhX->runmethod_with_local(@args) }, call_local => sub { local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 2; }, }); |
From: Mike S. <m...@pe...> - 2008-02-08 08:50:52
|
On Wed, 6 Feb 2008, Kevin M. Goess wrote: > If you want to send "info" messages too, then do this, changing ERROR > to INFO: > > log4perl.rootLogger=INFO, LOGFILE > > That will send all messages of level "info", "warn", "error" and "fatal" > to your LOGFILE. ... and just in case: if you want to capture INFO messages in one file, and ERROR messages in another, here's the answer to that: http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#c7fa8 -- Mike Mike Schilli m...@pe... > > Does that answer your question? > > Fernando Sousa wrote: > > Hi all, > > > > probably you can give some help on this topic. > > I'm using the Log-Log4perl-1.14 and I've initialize the following > > log.conf file: > > > > [root@ test]# cat log.conf > > ############################## > > ############################## > > # A simple root logger with a Log::Log4perl::Appender::File > > # file appender in Perl. > > ############################################################ > > > > log4perl.rootLogger=ERROR, LOGFILE > > > > log4perl.appender.LOGFILE=Log::Log4perl::Appender::File > > log4perl.appender.LOGFILE.filename=/tmp/myerrs.log > > log4perl.appender.LOGFILE.mode=append > > > > log4perl.appender.LOGFILE.layout=PatternLayout > > log4perl.appender.LOGFILE.layout.ConversionPattern=%d %p> %F{1}:%L %M - %m%n > > > > > > With this setup, log4perl will catch all Errros and stores it at > > /tmp/myerrs.log file. > > My intention is to capture ERRORs and also the INFOs traces. > > Something like "log4perl.rootLogger=ERROR and INFO, LOGFILE". > > > > Is it possible to do ?? if yes, how it does?? > > > > > > Best Regards, > > Fernando > > > > > > ------------------------------------------------------------------------ > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio 2008. > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > log4perl-devel mailing list > > log...@li... > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |
From: Kevin M. G. <cp...@go...> - 2008-02-07 17:17:47
|
Martin, Have you tried something like this? It would go in each wrapper method in your st.pm and db.pm, at the beginning of the method: local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 2; It's a package variable, so no, there is no other way to set it per-logger. There's some discussion of this in the FAQ ("perldoc Log::Log4perl::FAQ"). Martin J. Evans wrote: > Hi, > > I mailed this question some months ago and did not get any response so I > thought I'd have one last go slightly reworded. > > I have many different loggers in the same application in the program > itself and various modules. One module is a wrapper class around DBI and > has to set the caller_depth to 2 but caller_depth seems to be global and > hence this affects all other loggers in the same program. Is there any > way to set caller_depth per logger? > > My precise example was in my post on this list 3-dec-07. > > Thanks > > Martin |
From: Martin E. <mar...@ea...> - 2008-02-07 17:16:19
|
Thanks for the reply Kevin. Kevin M. Goess wrote: > Martin, > > Have you tried something like this? It would go in each wrapper method > in your st.pm and db.pm, at the beginning of the method: > > local $Log::Log4perl::caller_depth = > $Log::Log4perl::caller_depth + 2; I should have said I knew I could do this but a) there are an awful lot of methods b) when logging is not enabled each method has the overhead of the above statement for nothing. > It's a package variable, so no, there is no other way to set it per-logger. Shame. > There's some discussion of this in the FAQ ("perldoc Log::Log4perl::FAQ"). I haven't yet looked at the code - do you know how difficult it would be to make caller_depth per logger? Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com > Martin J. Evans wrote: >> Hi, >> >> I mailed this question some months ago and did not get any response so I >> thought I'd have one last go slightly reworded. >> >> I have many different loggers in the same application in the program >> itself and various modules. One module is a wrapper class around DBI and >> has to set the caller_depth to 2 but caller_depth seems to be global and >> hence this affects all other loggers in the same program. Is there any >> way to set caller_depth per logger? >> >> My precise example was in my post on this list 3-dec-07. >> >> Thanks >> >> Martin > > |
From: Martin J. E. <mar...@ea...> - 2008-02-07 16:17:24
|
Hi, I mailed this question some months ago and did not get any response so I thought I'd have one last go slightly reworded. I have many different loggers in the same application in the program itself and various modules. One module is a wrapper class around DBI and has to set the caller_depth to 2 but caller_depth seems to be global and hence this affects all other loggers in the same program. Is there any way to set caller_depth per logger? My precise example was in my post on this list 3-dec-07. Thanks Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com |
From: Kevin M. G. <cp...@go...> - 2008-02-06 18:21:32
|
Fernando, if I understand your question correctly, this line that you have: log4perl.rootLogger=ERROR, LOGFILE tells log4perl to send all messages whose log level is "error" or "fatal" to your LOGFILE appender. If you want to send "info" messages too, then do this, changing ERROR to INFO: log4perl.rootLogger=INFO, LOGFILE That will send all messages of level "info", "warn", "error" and "fatal" to your LOGFILE. Does that answer your question? Fernando Sousa wrote: > Hi all, > > probably you can give some help on this topic. > I'm using the Log-Log4perl-1.14 and I've initialize the following > log.conf file: > > [root@ test]# cat log.conf > ############################## > ############################## > # A simple root logger with a Log::Log4perl::Appender::File > # file appender in Perl. > ############################################################ > > log4perl.rootLogger=ERROR, LOGFILE > > log4perl.appender.LOGFILE=Log::Log4perl::Appender::File > log4perl.appender.LOGFILE.filename=/tmp/myerrs.log > log4perl.appender.LOGFILE.mode=append > > log4perl.appender.LOGFILE.layout=PatternLayout > log4perl.appender.LOGFILE.layout.ConversionPattern=%d %p> %F{1}:%L %M - %m%n > > > With this setup, log4perl will catch all Errros and stores it at > /tmp/myerrs.log file. > My intention is to capture ERRORs and also the INFOs traces. > Something like "log4perl.rootLogger=ERROR and INFO, LOGFILE". > > Is it possible to do ?? if yes, how it does?? > > > Best Regards, > Fernando > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel |
From: Kevin M. G. <cp...@go...> - 2008-02-06 18:16:23
|
The simple way to do a startup-handler is to put something like this in your apache config: PerlRequire /path/to/handler.pl You can init log4perl in there. That gets run when apache starts up, and so that initialization will affect the perl interpreter thereafter. The fancy way to do a handler is described here: http://perl.apache.org/docs/1.0/guide/getwet.html#A_Simple_Apache_Perl_Content_Handler One or the other may be more or less appropriate depending on the rest of the environment you're in, for instance: http://www.masonhq.com/docs/manual/Admin.html#writing_a_wrapper Berg, Eric wrote: > I'm setting up apache 1.3 to serve up an app that uses my modules that > make extensive use of Log4perl, but I'm not sure how to initialize it. > I've read > > http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4 > perl.html#a36c1 > Log::Log4perl - Log4j implementation for Perl > > and > http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4 > perl/FAQ.html#792b4 > Log::Log4perl::FAQ - Frequently Asked Questions on Log::Log4perl > > but have had no luck finding out exactly what a "startup handler" is. > > Does anybody have any example code, including apache config, for > initializing l4p in a mod_perl context? > > Thanks > > Eric D. Berg > Lehman Brothers >> Fixed Income Research >> 745 7th Avenue, 15th floor >> New York, NY 10019 >> Phone +1 212 526 8118 >> >> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. > > -------- > IRS Circular 230 Disclosure: > Please be advised that any discussion of U.S. tax matters contained within this communication (including any attachments) is not intended or written to be used and cannot be used for the purpose of (i) avoiding U.S. tax related penalties or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein. > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel |
From: Fernando S. <fer...@gm...> - 2008-02-06 10:49:52
|
Hi all, probably you can give some help on this topic. I'm using the Log-Log4perl-1.14 and I've initialize the following log.conffile: [root@ test]# cat log.conf ############################################################ # A simple root logger with a Log::Log4perl::Appender::File # file appender in Perl. ############################################################ log4perl.rootLogger=ERROR, LOGFILE log4perl.appender.LOGFILE=Log::Log4perl::Appender::File log4perl.appender.LOGFILE.filename=/tmp/myerrs.log log4perl.appender.LOGFILE.mode=append log4perl.appender.LOGFILE.layout=PatternLayout log4perl.appender.LOGFILE.layout.ConversionPattern=%d %p> %F{1}:%L %M - %m%n With this setup, log4perl will catch all Errros and stores it at /tmp/myerrs.log file. My intention is to capture ERRORs and also the INFOs traces. Something like "log4perl.rootLogger=ERROR and INFO, LOGFILE". Is it possible to do ?? if yes, how it does?? Best Regards, Fernando |
From: Berg, E. <eri...@le...> - 2008-02-05 17:24:15
|
I'm setting up apache 1.3 to serve up an app that uses my modules that make extensive use of Log4perl, but I'm not sure how to initialize it. I've read http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4 perl.html#a36c1 Log::Log4perl - Log4j implementation for Perl and http://log4perl.sourceforge.net/releases/Log-Log4perl/docs/html/Log/Log4 perl/FAQ.html#792b4 Log::Log4perl::FAQ - Frequently Asked Questions on Log::Log4perl but have had no luck finding out exactly what a "startup handler" is. Does anybody have any example code, including apache config, for initializing l4p in a mod_perl context? Thanks Eric D. Berg Lehman Brothers > Fixed Income Research > 745 7th Avenue, 15th floor > New York, NY 10019 > Phone +1 212 526 8118 > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. -------- IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax matters contained within this communication (including any attachments) is not intended or written to be used and cannot be used for the purpose of (i) avoiding U.S. tax related penalties or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein. |
From: Mike S. <m...@pe...> - 2008-01-26 07:18:12
|
On Fri, 25 Jan 2008, Steven Lembark wrote: > + sub debug > + { > + local $Log::Log4perl::caller_depth ||= 1; > + > + ... > + } Hmm ... do you mean local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1; by any chance? See http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#73200 for a similar case. -- Mike Mike Schilli m...@pe... |
From: Steven L. <le...@wr...> - 2008-01-25 21:52:26
|
--- lib/Log/Log4perl.pm.orig 2008-01-24 18:20:30.319775285 -0500 +++ lib/Log/Log4perl.pm 2008-01-25 16:51:51.220863874 -0500 @@ -2329,7 +2329,7 @@ =head1 Using Log::Log4perl from wrapper classes -If you don't use C<Log::Log4perl> as described above, +If you don't use C<Log::Log4perl> as described above, but from a wrapper class (like your own Logging class which in turn uses C<Log::Log4perl>), the pattern layout will generate wrong data for %F, %C, %L and the like. @@ -2338,11 +2338,25 @@ one (or more) wrapper classes, C<Log::Log4perl> will indicate where your logger classes called the loggers, not where your application called your wrapper, which is probably what you want in this case. -But don't dispair, there's a solution: Just increase the value + +But don't despair, there's a solution: Just increase the value of C<$Log::Log4perl::caller_depth> (defaults to 0) by one for every wrapper that's in between your application and C<Log::Log4perl>, then C<Log::Log4perl> will compensate for the difference. +Using a local variable avoids problems with anyone who +uses Log4perl directly; using ||= allows people to wrap +YOUR wrappers without accidentally resetting the value +too low. + + sub debug + { + local $Log::Log4perl::caller_depth ||= 1; + + ... + } + + =head1 Access to Internals The following methods are only of use if you want to peek/poke in |
From: Steven L. <le...@wr...> - 2008-01-25 19:50:38
|
The wrapper-level variable probably should be localized by any class that wraps L4p: there's no guarantee that no-one will call an un-wrapped method in L4p and botch the sequcnes. =head1 Using Log::Log4perl from wrapper classes If you don't use C<Log::Log4perl> as described above, but from a wrapper class (like your own Logging class which in turn uses C<Log::Log4perl>), the pattern layout will generate wrong data for %F, %C, %L and the like. Reason for this is that C<Log::Log4perl>'s loggers assume a static caller depth to the application that's using them. If you're using one (or more) wrapper classes, C<Log::Log4perl> will indicate where your logger classes called the loggers, not where your application called your wrapper, which is probably what you want in this case. But don't despair, there's a solution: Just increase the value of C<$Log::Log4perl::caller_depth> (defaults to 0) by one for every wrapper that's in between your application and C<Log::Log4perl>, then C<Log::Log4perl> will compensate for the difference. Using a local variable avoids problems with anyone who uses Log4perl directly; using ||= allows people to wrap YOUR wrappers without accidentally resetting the value too low. sub debug { local $Log::Log4perl::caller_depth ||= 1; ... } -- Steven Lembark +1 888 359 3508 Workhorse Computing 85-09 90th St le...@wr... Woodhaven, NY 11421 |
From: Steven L. <le...@wr...> - 2008-01-24 19:16:46
|
It appears that I have XML::DOM v/1.44 installed: cpan> i XML::DOM CPAN: Storable loaded ok Going to read /scratch/CPAN/Metadata Database was generated on Thu, 24 Jan 2008 00:30:58 GMT Strange distribution name [XML::DOM] Module id = XML::DOM DESCRIPTION Implements Level 1 of W3's DOM CPAN_USERID TJMATHER (T.J. Mather <tjm...@ma...>) CPAN_VERSION 1.44 CPAN_FILE T/TJ/TJMATHER/XML-DOM-1.44.tar.gz DSLI_STATUS bmpO (beta,mailing-list,perl,object-oriented) MANPAGE XML::DOM - A perl module for building DOM Level 1 compliant document structures INST_FILE /usr/lib/perl5/vendor_perl/5.8.8/XML/DOM.pm INST_VERSION 1.44 Running perl Makefile.PL + make test skips some test for lack of XML::DOM > 1.29? Or the message supposed to tell me that the tests are skipped if the XML::DOM version is above 1.29? root@frobnicate:Log-Log4perl-1.14-UKjvyO # make test PERL_DL_NONLAZY=1 /opt/perl/5.10/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 <snip> 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...............ok t/049Unhide............ok t/050Buffer............ok t/051Extra.............ok t/052Utf8..............ok t/053Resurrect.........ok All tests successful. Files=54, Tests=626, 27 wallclock secs ( 0.31 usr 0.08 sys + 6.32 cusr 0.53 csys = 7.24 CPU) Result: PASS -- Steven Lembark +1 888 359 3508 Workhorse Computing 85-09 90th St le...@wr... Woodhaven, NY 11421 |
From: Mike S. <m...@pe...> - 2008-01-23 08:20:17
|
On Mon, 21 Jan 2008, Steven Lembark wrote: > Our config's are in a static configuration, so I need to find some way > of specifying: > > log4perl.appender.VERBOSE = # i.e., nada, no appenders by default Hmm, would a threshold setting suffice? log4perl.appender.VERBOSE.Threshold = OFF > Q: Is there any way to create a logger whose root has an appender for, > say, the screen but whose "log4per.appender.VERBOSE = <whatever>" > entry fully overrides this with no appenders at all? I'm not sure I'm interpreting the question correctly, but I'd say that's a threshold setting as well: http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#a6c81 -- Mike Mike Schilli m...@pe... |
From: Steven L. <le...@wr...> - 2008-01-21 16:16:46
|
Goal: have a logger with no appenders normally used for trace-level output that would swamp the system: my $hugely_verbose_logger = L::L4p->get_logger ( 'VERBOSE::' . __PACKAGE__ ); ... $huggely_verbose_logger->trace( ... ); Our config's are in a static configuration, so I need to find some way of specifying: log4perl.appender.VERBOSE = # i.e., nada, no appenders by default Looking through all of the appenders, I cannot find a "no-op" (vs. one that has the overhead of formatting the data and then dumping it into /dev/null after putting in the effort to format the data). I also cannot seem to specify any collection of values for appender that override the root definition of screen. Q: Is there any way to create a logger whose root has an appender for, say, the screen but whose "log4per.appender.VERBOSE = <whatever>" entry fully overrides this with no appenders at all? thanx -- Steven Lembark +1 888 359 3508 Workhorse Computing 85-09 90th St le...@wr... Woodhaven, NY 11421 |
From: Mike S. <m...@pe...> - 2008-01-17 04:29:59
|
On Wed, 16 Jan 2008 luc...@be... wrote: > I am testing it and it looks like it is working OK. I am wondering if > it is possible to do what I want to with it. I want, when the file > rotate every day to change the file name to include the date in the > > But like I read in the documentation, the sub are executed only once > at the time the config file is read. So the date in the file name is > always the date when I start the program. That's correct, only the appender or an external program can take care of renaming the log file. Log::Dispatch::FileRotate (which is not part of Log4perl but a 3rd party module) renames log files as file.log.1, file.log.2, etc., but that's not what you want. Instead, I'd suggest you use an external rotator and let it take care of the renaming issue. Make sure you read the gotchas regarding external rotators, first: http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#2d0d0 Then I'd probably use a configuration like this: log4perl.category = WARN, Logfile log4perl.appender.Logfile = Log::Log4perl::Appender::File log4perl.appender.Logfile.filename = test.log log4perl.appender.Logfile.recreate = 1 log4perl.appender.Logfile.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.Logfile.layout.ConversionPattern = %d %F{1} %L> %m%n and an external rotator that kicks in right after midnight every day as a cronjob: 01 00 * * * cd /my/logs; mv test.log test.log.`date +%F` Because of the 'recreate' flag set in the Log4perl configuration, Log4perl will notice when the file is missing (until it does notice, it will keep writing to the moved file, which is fine if you hold off on compressing it until the switch is made). The Log::Log4perl::Appender::File documentation lists more details on the 'recreate' flag. Hope that helps! -- Mike Mike Schilli m...@pe... |
From: Mark B. <ma...@ex...> - 2007-12-14 10:26:33
|
On 13 Dec 2007, at 17:52, Kevin M. Goess wrote: > Mark Blackman wrote: >> In the Appender::DBI man page, we see the following sentence, >> "If there are more '?' placeholders than there are values in >> your message, it will use undef for the rest." However, I was >> unable to observe this behaviour with my configuration. > > Odd, it looks like it's working to me. What was the behavior you *did* > obverve? Can you send a test case to demonstrate the problem? Well, I think the existing implementation isn't sufficiently general to handle my requirement. I didn't examine the existing code in excruciating detail, but I believe the code path you mention is only executed if you have at least one bind param defined in your config. i.e if ($self->{bind_value_layouts}) { Secondly, as far as I could tell the implementation below also seems to assume that the largest numbered bind param will correspond to the last placeholder. i.e. I couldn't spot in the code where the number of placeholders expected in the prepared statemente was counted or evaluated, only the largest numbered bind param. On reflection, I could probably have achieved my requirement to call the logger with between 1 and 4 arguments, but using an artificially inserted bind param in the config file for a fifth placeholder and the code path below would have taken care of the undefs for me. I've attached the details of my config, call and DBI_TRACE output below if you're that keen to look at it. > > Here's the part of the existing code that handles the case, it > looks ok > to me: > > #here handle cases where we ran out of message bits > #before we ran out of bind_value_layouts, just keep > going > }elsif (ref $p->{message} eq 'ARRAY'){ > $msg = undef; > $p->{message} = undef; > > I just added test cases to the unit test to demonstrate the > behavior and > it looks ok. Could you download this guy and see if it runs for you? > (You'll need to 'mkdir -p t/tmp/') > > http://log4perl.cvs.sourceforge.net/*checkout*/log4perl/Log- > Log4perl/t/034DBI.t?revision=1.15&content-type=text%2Fplain > Your test runs fine for me, although I suspect it's because the DBD::CSV driver doesn't mind getting too few arguments for a prepared statement ->execute and the DBD::Pg driver does object to too few arguments. That's pure speculation at this point though. I made a brief attempt to convert the test to use DBD::Pg but hit too many issues to carry on. Perhaps I've missed some important point, and if so please educate me. - Mark log4perl config: ========================================= log4perl.category.events = DEBUG, fx-dbi log4perl.addivity.events = 0 log4perl.appender.fx-dbi=Log::Log4perl::Appender::DBI log4perl.appender.fx-dbi.datasource = dbi:Pg:dbname=fx;host=127.0.0.1 log4perl.appender.fx-dbi.username = postgres81 log4perl.appender.fx-dbi.sql = \ INSERT INTO event_log \ (event, user_id,payment_id,order_id) \ VALUES (?,?,?,?) log4perl.appender.fx-dbi.layout = Log::Log4perl::Layout::NoopLayout log4perl.appender.fx-dbi.warp_message = 0 log4perl.appender.fx-dbi.usePreparedStmt = 1 my log4perl caller (snippet): ============================================= use Log::Log4perl qw(get_logger); my $events=get_logger('events'); $events->info('hello chuck'); DBI_TRACE=1 output: ============================================= <- prepare('INSERT INTO event_log (event, user_id,payment_id,order_id) VALUES (?,?,?,?)')= DBI::st=HASH (0x1a93bac) at DBI.pm line 88 !! ERROR: -1 'called with 1 bind variables when 4 are needed' (err#0) <- execute('hello chuck')= undef at DBI.pm line 137 ERROR: -1 'called with 1 bind variables when 4 are needed' (err#0) <- ping= 1 at DBI.pm line 147 <- prepare('INSERT INTO event_log (event, user_id,payment_id,order_id) VALUES (?,?,?,?)')= DBI::st=HASH (0x1a93da4) at DBI.pm line 88 <- DESTROY(DBI::st=HASH(1a93b94))= undef at DBI.pm line 168 !! ERROR: -1 'called with 1 bind variables when 4 are needed' (err#0) <- execute('hello chuck')= undef at DBI.pm line 137 Log4perl: DBI appender failed to reconnect to database after 1 attempt at /Volumes/cs/MBlackman/ffx/fx-live/FX/script/../lib/FX.pm line 85 Compilation failed in require at FX/script/fx_server.pl line 52. |
From: Kevin M. G. <cp...@go...> - 2007-12-13 17:52:22
|
Mark Blackman wrote: > In the Appender::DBI man page, we see the following sentence, > "If there are more '?' placeholders than there are values in > your message, it will use undef for the rest." However, I was > unable to observe this behaviour with my configuration. Odd, it looks like it's working to me. What was the behavior you *did* obverve? Can you send a test case to demonstrate the problem? Here's the part of the existing code that handles the case, it looks ok to me: #here handle cases where we ran out of message bits #before we ran out of bind_value_layouts, just keep going }elsif (ref $p->{message} eq 'ARRAY'){ $msg = undef; $p->{message} = undef; I just added test cases to the unit test to demonstrate the behavior and it looks ok. Could you download this guy and see if it runs for you? (You'll need to 'mkdir -p t/tmp/') http://log4perl.cvs.sourceforge.net/*checkout*/log4perl/Log-Log4perl/t/034DBI.t?revision=1.15&content-type=text%2Fplain |
From: Mark B. <ma...@ex...> - 2007-12-13 15:47:20
|
Hi, In the Appender::DBI man page, we see the following sentence, "If there are more '?' placeholders than there are values in your message, it will use undef for the rest." However, I was unable to observe this behaviour with my configuration. I used the following tiny patch to Appender::DBI.pm to get the described behaviour and it may be of general interest. It does rely on the DBI statement handle attribute NUM_OF_PARAMS which is driver dependent, however I can't currently see any other way of achieving this. --- ./original/Log/Log4perl/Appender/DBI.pm 2007-03-15 07:53:47.000000000 +0000 +++ ./patched/Log/Log4perl/Appender/DBI.pm 2007-12-13 15:00:48.000000000 +0000 @@ -134,6 +134,13 @@ for my $attempt (0..$self->{reconnect_attempts}) { #warn "Exe: @qmarks"; # TODO + + # if we're short of bind variables, fill in the remainder with undef + if( $sth->{NUM_OF_PARAMS}-1 > $#qmarks ){ + # use the old "assign past the end of array to extend it" thing. + undef $qmarks[$sth->{NUM_OF_PARAMS}-1]; + } + if(! $sth->execute(@qmarks)) { # Exe failed # warn "Log4perl: DBI->execute failed $DBI::errstr, \n". - Mark |
From: Mike S. <m...@pe...> - 2007-12-12 08:38:25
|
On Wed, 12 Dec 2007 Oli...@Li... wrote: > I'm trying to implement a framwork for my perl scripts using your > excellent library log4perl and I'm really happy with it. Great, thanks for the kind words! > I have just a short question, to the function > appender_thresholds_adjust(). I found, that a threshold offset of > 0 has the same effect as a threshold offset of -1. This seems to be > an inconcistency for me. I would expect, that an offset of 0 leaves > the threshold unchanged. Hmm, that's a bug. I've checked in a fix for Log::Log4perl 1.15 to let appender_thresholds_adjust() return right away if the 'delta' is set to 0. Until 1.15 goes out to CPAN (might be a month or so), please check for the "==0" case explicitly and suppress the call to appender_thresholds_adjust(). Thanks for letting us know! -- Mike Mike Schilli m...@pe... > > This makes sense, when I want to make some arithmetic with the log level: > Standard log level = WARN ($StandardLogLevel = 1;) > command line: --verbosity=x ($Verbosity = x;) > Levels: Errors: x=0 > Warnings: x=1 > Info: x=2 > Debug: x=3 > All: x=4 > Perl: Log::Log4perl->appender_thresholds_adjust($StandardLogLevel - > $Verbosity); > > Or is there any special reason, why the function was implemented that way? > > Regards, > > Oliver > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |
From: <Oli...@Li...> - 2007-12-12 07:32:46
|
Hi everyone, I'm trying to implement a framwork for my perl scripts using your excellent library log4perl and I'm really happy with it. I have just a short question, to the function appender_thresholds_adjust(). I found, that a threshold offset of 0 has the same effect as a threshold offset of -1. This seems to be an inconcistency for me. I would expect, that an offset of 0 leaves the threshold unchanged. This makes sense, when I want to make some arithmetic with the log level: Standard log level = WARN ($StandardLogLevel = 1;) command line: --verbosity=x ($Verbosity = x;) Levels: Errors: x=0 Warnings: x=1 Info: x=2 Debug: x=3 All: x=4 Perl: Log::Log4perl->appender_thresholds_adjust($StandardLogLevel - $Verbosity); Or is there any special reason, why the function was implemented that way? Regards, Oliver |