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: Ateeq A. <Ate...@ta...> - 2006-10-10 13:36:46
|
Sorry I should have given a better description, the problem occurs when using %M in the appender layout pattern. Here's a sample of the log output: otter# cat /var/tmp/fetch.log 2006/10/10 12:02:52 main::Download DEBUG Connecting to hostftp.talis.com 2006/10/10 12:02:52 main::Download DEBUG Logging in as user staff 2006/10/10 12:02:52 Log::Log4perl::Logger::logcroak FATAL Can't change remote directory to /fetch/test1: 2006/10/10 12:02:52 Log::Log4perl::Logger::logcroak FATAL /fetch/test1: No such file or directory. 2006/10/10 12:02:52 Log::Log4perl::Logger::logcroak FATAL at fetch.pl line 217 2006/10/10 12:02:52 Log::Log4perl::Logger::logcroak FATAL main::Download('XML::LibXML::Element=3DSCALAR(0x4dd404)', '/tmp/fetch') called at fetch.pl line 159 2006/10/10 12:02:52 Log::Log4perl::Logger::logcroak FATAL main::ProcessDataset('XML::LibXML::Element=3DSCALAR(0x4dd404)', 'XML::LibXML::Element=3DSCALAR(0x4cc748)', '/tmp/fetch') called at fetch.pl line 76 $log->logcroak() was called in main::Download. Using: Log::Log4perl->init(\qq{ log4perl.logger =3D DEBUG, LogFile, Screen log4perl.appender.LogFile =3D Log::Log4perl::Appender::File log4perl.appender.LogFile.filename =3D $LogFile log4perl.appender.LogFile.layout =3D PatternLayout log4perl.appender.LogFile.layout.ConversionPattern =3D %d %M %p %m%n log4perl.appender.Screen =3D Log::Log4perl::Appender::Screen log4perl.appender.Screen.Threshold =3D INFO log4perl.appender.Screen.layout =3D PatternLayout log4perl.appender.Screen.layout.ConversionPattern =3D %M %m%n }); Let me know if you still need sample code. Thanks Ateeq -----Original Message----- From: Mike Schilli [mailto:m...@pe...]=20 Sent: 10 October 2006 03:19 To: Ateeq Altaf Cc: log...@li... Subject: Re: [log4perl-devel] Log::Log4Perl::Logger Carp functions missing depth adjustment On Mon, 9 Oct 2006, Ateeq Altaf wrote: > The Carp related logcarp/croak/confess/cluck messages log at the wrong > caller depth. You sure? Please provide a snippet of test code that shows the error. Here's a quick test: $ test.pl croak at ./t line 9 main::foo() called at ./t line 13 $ test.pl 1 2006/10/09 19:09:39 l4pcroak at ./t line 10 2006/10/09 19:09:39 main::foo() called at ./t line 13 l4pcroak at ./t line 10 main::foo() called at ./t line 13 $ cat test.pl #!/usr/bin/perl -w use Log::Log4perl qw(:easy); use Carp; Log::Log4perl->easy_init($DEBUG); my($l4pcroak) =3D @ARGV; sub foo { $l4pcroak ? LOGCROAK("l4pcroak") : croak("croak"); } foo(); -- Mike Mike Schilli m...@pe... > > > > My quick fudge below, also moved a Carp::longmess into an if > statement.as $message doesn't look like it gets used outside. > > > > Sorry if the bugs already filed somewhere I didn't know where to look. > > > > Regards > > Ateeq > > > > > > > > otter# gdiff -u Logger.pm.orig Logger.pm > > --- Logger.pm.orig 2006-07-18 18:52:22.000000000 +0100 > > +++ Logger.pm 2006-10-09 14:33:06.032491000 +0100 > > @@ -911,9 +911,11 @@ > > > > if ($self->is_warn()) { > > my $message =3D Carp::longmess($msg); > > + $Log::Log4perl::caller_depth++; > > foreach (split(/\n/, $message)) { > > $self->warn("$_\n"); > > } > > + $Log::Log4perl::caller_depth--; > > Carp::cluck($msg); > > } > > } > > @@ -928,9 +930,11 @@ > > > > if ($self->is_warn()) { > > my $message =3D Carp::shortmess($msg); > > + $Log::Log4perl::caller_depth++; > > foreach (split(/\n/, $message)) { > > $self->warn("$_\n"); > > } > > + $Log::Log4perl::caller_depth--; > > Carp::carp($msg) if $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR; > > } > > } > > @@ -945,11 +949,13 @@ > > local $Carp::CarpLevel =3D $Carp::CarpLevel + 1; > > my $msg =3D $self->warning_render(@_); > > > > - my $message =3D Carp::shortmess($msg); > > if ($self->is_fatal()) { > > + my $message =3D Carp::shortmess($msg); > > + $Log::Log4perl::caller_depth++; > > foreach (split(/\n/, $message)) { > > $self->fatal("$_\n"); > > } > > + $Log::Log4perl::caller_depth--; > > } > > > > $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR ? > > @@ -965,11 +971,13 @@ > > my $msg =3D $self->warning_render(@_); > > local $Carp::CarpLevel =3D 2; > > > > - my $message =3D Carp::longmess($msg); > > if ($self->is_fatal()) { > > + my $message =3D Carp::longmess($msg); > > + $Log::Log4perl::caller_depth++; > > foreach (split(/\n/, $message)) { > > $self->fatal("$_\n"); > > } > > + $Log::Log4perl::caller_depth--; > > } > > > > $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR ? > > The very latest from Talis > read the latest news at www.talis.com/news > listen to our podcasts www.talis.com/podcasts > see us at these events www.talis.com/events > join the discussion here www.talis.com/forums > join our developer community www.talis.com/tdn > and read our blogs www.talis.com/blogs > Visit Talis at this year's PLA Conference, 11-13th October 2006. We plan to showcase new product enhancements and unveil new initiatives. > > > > Any views or personal opinions expressed within this email may not be those of Talis Information Ltd. The content of this email message and any files that may be attached are confidential, and for the usage of the intended recipient only. If you are not the intended recipient, then please return this message to the sender and delete it. Any use of this e-mail by an unauthorised recipient is prohibited. > =20 The very latest from Talis read the latest news at www.talis.com/news=20 listen to our podcasts www.talis.com/podcasts=20 see us at these events www.talis.com/events=20 join the discussion here www.talis.com/forums=20 join our developer community www.talis.com/tdn=20 and read our blogs www.talis.com/blogs=20 Visit Talis at this year's PLA Conference, 11-13th October 2006. We plan = to showcase new product enhancements and unveil new initiatives.=20 =20 Any views or personal opinions expressed within this email may not be = those of Talis Information Ltd. The content of this email message and = any files that may be attached are confidential, and for the usage of = the intended recipient only. If you are not the intended recipient, then = please return this message to the sender and delete it. Any use of this = e-mail by an unauthorised recipient is prohibited. |
From: Mike S. <m...@pe...> - 2006-10-10 02:19:24
|
On Mon, 9 Oct 2006, Ateeq Altaf wrote: > The Carp related logcarp/croak/confess/cluck messages log at the wrong > caller depth. You sure? Please provide a snippet of test code that shows the error. Here's a quick test: $ test.pl croak at ./t line 9 main::foo() called at ./t line 13 $ test.pl 1 2006/10/09 19:09:39 l4pcroak at ./t line 10 2006/10/09 19:09:39 main::foo() called at ./t line 13 l4pcroak at ./t line 10 main::foo() called at ./t line 13 $ cat test.pl #!/usr/bin/perl -w use Log::Log4perl qw(:easy); use Carp; Log::Log4perl->easy_init($DEBUG); my($l4pcroak) = @ARGV; sub foo { $l4pcroak ? LOGCROAK("l4pcroak") : croak("croak"); } foo(); -- Mike Mike Schilli m...@pe... > > > > My quick fudge below, also moved a Carp::longmess into an if > statement.as $message doesn't look like it gets used outside. > > > > Sorry if the bugs already filed somewhere I didn't know where to look. > > > > Regards > > Ateeq > > > > > > > > otter# gdiff -u Logger.pm.orig Logger.pm > > --- Logger.pm.orig 2006-07-18 18:52:22.000000000 +0100 > > +++ Logger.pm 2006-10-09 14:33:06.032491000 +0100 > > @@ -911,9 +911,11 @@ > > > > if ($self->is_warn()) { > > my $message = Carp::longmess($msg); > > + $Log::Log4perl::caller_depth++; > > foreach (split(/\n/, $message)) { > > $self->warn("$_\n"); > > } > > + $Log::Log4perl::caller_depth--; > > Carp::cluck($msg); > > } > > } > > @@ -928,9 +930,11 @@ > > > > if ($self->is_warn()) { > > my $message = Carp::shortmess($msg); > > + $Log::Log4perl::caller_depth++; > > foreach (split(/\n/, $message)) { > > $self->warn("$_\n"); > > } > > + $Log::Log4perl::caller_depth--; > > Carp::carp($msg) if $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR; > > } > > } > > @@ -945,11 +949,13 @@ > > local $Carp::CarpLevel = $Carp::CarpLevel + 1; > > my $msg = $self->warning_render(@_); > > > > - my $message = Carp::shortmess($msg); > > if ($self->is_fatal()) { > > + my $message = Carp::shortmess($msg); > > + $Log::Log4perl::caller_depth++; > > foreach (split(/\n/, $message)) { > > $self->fatal("$_\n"); > > } > > + $Log::Log4perl::caller_depth--; > > } > > > > $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR ? > > @@ -965,11 +971,13 @@ > > my $msg = $self->warning_render(@_); > > local $Carp::CarpLevel = 2; > > > > - my $message = Carp::longmess($msg); > > if ($self->is_fatal()) { > > + my $message = Carp::longmess($msg); > > + $Log::Log4perl::caller_depth++; > > foreach (split(/\n/, $message)) { > > $self->fatal("$_\n"); > > } > > + $Log::Log4perl::caller_depth--; > > } > > > > $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR ? > > The very latest from Talis > read the latest news at www.talis.com/news > listen to our podcasts www.talis.com/podcasts > see us at these events www.talis.com/events > join the discussion here www.talis.com/forums > join our developer community www.talis.com/tdn > and read our blogs www.talis.com/blogs > Visit Talis at this year's PLA Conference, 11-13th October 2006. We plan to showcase new product enhancements and unveil new initiatives. > > > > Any views or personal opinions expressed within this email may not be those of Talis Information Ltd. The content of this email message and any files that may be attached are confidential, and for the usage of the intended recipient only. If you are not the intended recipient, then please return this message to the sender and delete it. Any use of this e-mail by an unauthorised recipient is prohibited. > |
From: Ateeq A. <Ate...@ta...> - 2006-10-09 13:39:58
|
The Carp related logcarp/croak/confess/cluck messages log at the wrong caller depth. =20 My quick fudge below, also moved a Carp::longmess into an if statement.as $message doesn't look like it gets used outside. =20 Sorry if the bugs already filed somewhere I didn't know where to look. =20 Regards Ateeq =20 =20 =20 otter# gdiff -u Logger.pm.orig Logger.pm --- Logger.pm.orig 2006-07-18 18:52:22.000000000 +0100 +++ Logger.pm 2006-10-09 14:33:06.032491000 +0100 @@ -911,9 +911,11 @@ =20 if ($self->is_warn()) { my $message =3D Carp::longmess($msg); + $Log::Log4perl::caller_depth++; foreach (split(/\n/, $message)) { $self->warn("$_\n"); } + $Log::Log4perl::caller_depth--; Carp::cluck($msg); } } @@ -928,9 +930,11 @@ =20 if ($self->is_warn()) { my $message =3D Carp::shortmess($msg); + $Log::Log4perl::caller_depth++; foreach (split(/\n/, $message)) { $self->warn("$_\n"); } + $Log::Log4perl::caller_depth--; Carp::carp($msg) if $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR; } } @@ -945,11 +949,13 @@ local $Carp::CarpLevel =3D $Carp::CarpLevel + 1; my $msg =3D $self->warning_render(@_); =20 - my $message =3D Carp::shortmess($msg); if ($self->is_fatal()) { + my $message =3D Carp::shortmess($msg); + $Log::Log4perl::caller_depth++; foreach (split(/\n/, $message)) { $self->fatal("$_\n"); } + $Log::Log4perl::caller_depth--; } =20 $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR ?=20 @@ -965,11 +971,13 @@ my $msg =3D $self->warning_render(@_); local $Carp::CarpLevel =3D 2; =20 - my $message =3D Carp::longmess($msg); if ($self->is_fatal()) { + my $message =3D Carp::longmess($msg); + $Log::Log4perl::caller_depth++; foreach (split(/\n/, $message)) { $self->fatal("$_\n"); } + $Log::Log4perl::caller_depth--; } =20 $Log::Log4perl::LOGDIE_MESSAGE_ON_STDERR ? =20 The very latest from Talis read the latest news at www.talis.com/news=20 listen to our podcasts www.talis.com/podcasts=20 see us at these events www.talis.com/events=20 join the discussion here www.talis.com/forums=20 join our developer community www.talis.com/tdn=20 and read our blogs www.talis.com/blogs=20 Visit Talis at this year's PLA Conference, 11-13th October 2006. We plan = to showcase new product enhancements and unveil new initiatives.=20 =20 Any views or personal opinions expressed within this email may not be = those of Talis Information Ltd. The content of this email message and = any files that may be attached are confidential, and for the usage of = the intended recipient only. If you are not the intended recipient, then = please return this message to the sender and delete it. Any use of this = e-mail by an unauthorised recipient is prohibited. |
From: Roger D. <rog...@gl...> - 2006-10-03 13:02:12
|
cheers. I got hung up on the get_appender_by_name() routine ... roger At 02/10/2006 17:06:07, log...@li... wrote: >On Mon, 2 Oct 2006, Roger Day wrote: > >> Apologies if this is a n00b question - I've already trawled the docos. >> >> I've a log.conf file which contains the configuration for a STDOUT >> appender. I initialise log4perl with the init call using that log.conf, >> however the STDOUT appender isn't invoked at this stage. Later on, I want >> to invoke the STDOUT appender in the code - something like >> "$logger.add_appender("<something that goes here which indicates the >> STDOUT appender>") Is this in the right barnyard? What is the correct >> procedure please? > >If you want to reference an appender in the configuration by name, use > >Log::Log4perl->appender_by_name("appender_name") > >as described in > >http://log4perl.sourceforge.net/d/Log/Log4perl.html#356d5 > >-- Mike > >Mike Schilli >m...@pe... > >------------------------------------------------------------------------- >Take Surveys. Earn Cash. Influence the Future of IT >Join SourceForge.net's Techsay panel and you'll get the chance to share your >opinions on IT & business topics through brief surveys -- and earn cash >http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >_______________________________________________ >log4perl-devel mailing list >log...@li... >https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |
From: Mike S. <m...@pe...> - 2006-10-02 16:06:55
|
On Mon, 2 Oct 2006, Roger Day wrote: > Apologies if this is a n00b question - I've already trawled the docos. > > I've a log.conf file which contains the configuration for a STDOUT > appender. I initialise log4perl with the init call using that log.conf, > however the STDOUT appender isn't invoked at this stage. Later on, I want > to invoke the STDOUT appender in the code - something like > "$logger.add_appender("<something that goes here which indicates the > STDOUT appender>") Is this in the right barnyard? What is the correct > procedure please? If you want to reference an appender in the configuration by name, use Log::Log4perl->appender_by_name("appender_name") as described in http://log4perl.sourceforge.net/d/Log/Log4perl.html#356d5 -- Mike Mike Schilli m...@pe... |
From: Roger D. <rog...@gl...> - 2006-10-02 13:34:25
|
Apologies if this is a n00b question - I've already trawled the docos. I've a log.conf file which contains the configuration for a STDOUT appender. I initialise log4perl with the init call using that log.conf, however the STDOUT appender isn't invoked at this stage. Later on, I want to invoke the STDOUT appender in the code - something like "$logger.add_appender("<something that goes here which indicates the STDOUT appender>") Is this in the right barnyard? What is the correct procedure please? TIA Roger |
From: Robert J. <yad...@sn...> - 2006-09-28 13:25:44
|
I wrote: >Another question, mostly just curiousity -- I used Data::Dumper to >look at the appender structure. How/where does the time_function >get defined as sub {"DUMMY"}? I don't see that anywhere in the >Log4perl code... Is it a perl internal thing? Sorry, nevermind -- I found it. Data::Dumper uses that when the value is a coderef. -- Rob |
From: Robert J. <yad...@sn...> - 2006-09-28 13:20:06
|
At 10:20 PM 9/27/2006, you wrote: >Take a look at Log::Log4perl::Appender::Buffer, it does something similar: Thanks much! I'm using the DBI appender, with the NoopLayout and the data in param.1, so I had to use: $self->{appender}->{'bind_value_layouts'}{'1'}{'time_function'}; But it works great :) Another question, mostly just curiousity -- I used Data::Dumper to look at the appender structure. How/where does the time_function get defined as sub {"DUMMY"}? I don't see that anywhere in the Log4perl code... Is it a perl internal thing? Below is an excerpt from the dump for the DBI appender. $VAR1 = bless( { 'bind_value_layouts' => { '6' => bless( { 'stack' => [ [ 'm', undef ] ], 'printformat' => '%s', 'dontCollapseArrayRefs' => undef, 'format' => undef, 'info_needed' => { 'm' => 1 }, 'time_function' => sub { "DUMMY" }, 'CSPECS' => 'cCdFHIlLmMnpPrtTxX%', 'message_chompable' => 0 }, 'Log::Log4perl::Layout::PatternLayout' ), -- Rob |
From: Mike S. <m...@pe...> - 2006-09-28 02:20:38
|
On Wed, 27 Sep 2006, Robert Jacobson wrote: > However, the dumped log messages have the time of the dump, not the > original log message time. Is there a way to get Log4perl to use the > original time of the message? Take a look at Log::Log4perl::Appender::Buffer, it does something similar: # Trick the renderer into using the original event time local $self->{app}->{layout}->{time_function}; $self->{app}->{layout}->{time_function} = sub { $_->{log4p_logtime} }; It saves the event time when the log message comes in, saves it under the 'log4p_logtime' key and feeds it to the renderer later on. -- Mike Mike Schilli m...@pe... dd It doesn't seem to be in the hash that > the log() method gets; but maybe I'm just not looking in the right spot? > > I guess I could workaround the issue by prepending the original time > to the "message" field, but I'd like to avoid modifying the original > as much as possible. Can I do something like: 1) store the original > time internally in my buffer and 2) when dumping the buffer to the > appender, set some internal Log4perl time variable to the buffered time? > > ----------------------------------------------------------- > package Mylog; > > use warnings; > use strict; > > use Carp; > use DBI; > > require Log::Log4perl::Appender::DBI; > > sub new { > my ($class, %options) = @_; > > my $appender = Log::Log4perl::Appender::DBI->new( > map { $_ => $options{$_} } keys %options, > ); > > my $self = { > appender => $appender, > name => $options{name}, > }; > > > bless $self, $class; > $self->_init(%options); > > return $self; > > } > > sub log { > my ($self, %p) = @_; > > # Check for DB connection > if (! $self->{dbh}->ping() ) { > # Buffer the message > push @{$self->{BUFFER}}, \%p; > > # Notify FOT > $self->_notify(%p); > # Try to reconnect > eval { > $self->{dbh} = $self->{connect}->(); > }; > return 1; > } else { > $self->{connected_time} = scalar gmtime(); > } > > $self->check_buffer(); > > $Log::Log4perl::caller_depth++; > > $self->{appender}->log( > %p, > ); > > $Log::Log4perl::caller_depth--; > return 1; > } > > sub _init { > my $self = shift; > my %params = @_; > > if ($params{dbh}) { > $self->{dbh} = $params{dbh}; > } else { > $self->{connect} = sub { > DBI->connect(@params{qw(datasource username password)}, > {PrintError => 0}) > or croak "Log4perl: $DBI::errstr"; > }; > $self->{dbh} = $self->{connect}->(); > $self->{_mine} = 1; > } > } > > sub _notify { > my $self = shift; > my %params = @_; > > # eventually send an email or something > # for now just print a message > print "Database is down\n"; > > } > > sub check_buffer { > my $self = shift; > > return unless ($self->{BUFFER} && ref $self->{BUFFER} eq 'ARRAY'); > > while ( @{$self->{BUFFER}} ) { > my $ref = shift @{$self->{BUFFER}}; > $Log::Log4perl::caller_depth += 2; > $self->{appender}->log( > %$ref, > ); > $Log::Log4perl::caller_depth -= 2; > } > > return 1; > } > > 1; > > ----------------------------------------------------------- > > -- > Rob > > |
From: John O. <jo...@ve...> - 2006-09-27 17:25:33
|
Robert Jacobson wrote: >I've implemented a buffering mechanism in my wrapper's log() >call. Basically I check using {dbh}->ping() if the database is >up. If not, I buffer the message in an array and return success so >that the parent program can proceed. > >When the database comes back up I dump the buffer to the DBI appender. > > I can't help with the timestamp issue but I'd recommend having a maximum buffer size too, after which you stop saving up the messages - it could be used on a system where the DB might be down for days in the event of a disaster. Maybe if you're feeling very clever, revert to a file appender if the DB is down! cheers John |
From: Robert J. <yad...@sn...> - 2006-09-27 14:04:20
|
I've implemented a buffering mechanism in my wrapper's log() call. Basically I check using {dbh}->ping() if the database is up. If not, I buffer the message in an array and return success so that the parent program can proceed. When the database comes back up I dump the buffer to the DBI appender. However, the dumped log messages have the time of the dump, not the original log message time. Is there a way to get Log4perl to use the original time of the message? It doesn't seem to be in the hash that the log() method gets; but maybe I'm just not looking in the right spot? I guess I could workaround the issue by prepending the original time to the "message" field, but I'd like to avoid modifying the original as much as possible. Can I do something like: 1) store the original time internally in my buffer and 2) when dumping the buffer to the appender, set some internal Log4perl time variable to the buffered time? ----------------------------------------------------------- package Mylog; use warnings; use strict; use Carp; use DBI; require Log::Log4perl::Appender::DBI; sub new { my ($class, %options) = @_; my $appender = Log::Log4perl::Appender::DBI->new( map { $_ => $options{$_} } keys %options, ); my $self = { appender => $appender, name => $options{name}, }; bless $self, $class; $self->_init(%options); return $self; } sub log { my ($self, %p) = @_; # Check for DB connection if (! $self->{dbh}->ping() ) { # Buffer the message push @{$self->{BUFFER}}, \%p; # Notify FOT $self->_notify(%p); # Try to reconnect eval { $self->{dbh} = $self->{connect}->(); }; return 1; } else { $self->{connected_time} = scalar gmtime(); } $self->check_buffer(); $Log::Log4perl::caller_depth++; $self->{appender}->log( %p, ); $Log::Log4perl::caller_depth--; return 1; } sub _init { my $self = shift; my %params = @_; if ($params{dbh}) { $self->{dbh} = $params{dbh}; } else { $self->{connect} = sub { DBI->connect(@params{qw(datasource username password)}, {PrintError => 0}) or croak "Log4perl: $DBI::errstr"; }; $self->{dbh} = $self->{connect}->(); $self->{_mine} = 1; } } sub _notify { my $self = shift; my %params = @_; # eventually send an email or something # for now just print a message print "Database is down\n"; } sub check_buffer { my $self = shift; return unless ($self->{BUFFER} && ref $self->{BUFFER} eq 'ARRAY'); while ( @{$self->{BUFFER}} ) { my $ref = shift @{$self->{BUFFER}}; $Log::Log4perl::caller_depth += 2; $self->{appender}->log( %$ref, ); $Log::Log4perl::caller_depth -= 2; } return 1; } 1; ----------------------------------------------------------- -- Rob |
From: Mike S. <m...@pe...> - 2006-09-27 05:49:56
|
On Tue, 26 Sep 2006, Robert Jacobson wrote: > At 02:18 PM 9/22/2006, you wrote: > >I'd recommend writing another appender which wraps around > >Appender::DBI and checks for availability. > > Ok, having looked at some other options, this sounds like the way to > go. But I have a noob question: How do I write that wrapper? Similar to writing your own appender, just call the methods of the 'wrapped' appender from within your wrapper appender: http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#e8a46 -- Mike Mike Schilli m...@pe... > > I can handle writing the database availability code (I think! :) > ) But I don't even know where to start for writing a wrapper to Appender::DBI. > > If it helps, I've written my own, albeit simple, Appender, that just > implemented the new() and log() methods. > > -- > Rob > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |
From: Mike S. <m...@pe...> - 2006-09-27 05:46:58
|
On Tue, 26 Sep 2006, Robert Jacobson wrote: > At 02:18 PM 9/22/2006, John ORourke wrote: > >I'd recommend writing another appender which wraps around > >Appender::DBI and checks for availability. > > Ok, I've managed to write a basic wrapper (without checking for > availability). It seems to work (i.e. messages are logged to the > database), but in the Layout I'm using %F{2}, and I get > "Log4perl/Logger.pm" instead of the path of my script. Do I need to > mess with caller_depth or something? If you're using wrapper classes, you need to adjust the caller level: http://log4perl.sourceforge.net/d/Log/Log4perl.html#6acb7 -- Mike Mike Schilli m...@pe... > > --------------------------------------------- > > package Mylog; > > use warnings; > use strict; > > require Log::Log4perl::Appender::DBI; > > sub new { > my ($class, %options) = @_; > > my $appender = Log::Log4perl::Appender::DBI->new( > map { $_ => $options{$_} } keys %options, > ); > > my $self = { > appender => $appender, > name => $options{name}, > }; > > bless $self, $class; > > return $self; > > } > > sub log { > my ($self, %p) = @_; > > $self->{appender}->log( > %p, > ); > > return 1; > } > > 1; > --------------------------------------------- > > -- > Rob > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |
From: Robert J. <yad...@sn...> - 2006-09-26 20:14:42
|
At 02:18 PM 9/22/2006, John ORourke wrote: >I'd recommend writing another appender which wraps around >Appender::DBI and checks for availability. Ok, I've managed to write a basic wrapper (without checking for availability). It seems to work (i.e. messages are logged to the database), but in the Layout I'm using %F{2}, and I get "Log4perl/Logger.pm" instead of the path of my script. Do I need to mess with caller_depth or something? --------------------------------------------- package Mylog; use warnings; use strict; require Log::Log4perl::Appender::DBI; sub new { my ($class, %options) = @_; my $appender = Log::Log4perl::Appender::DBI->new( map { $_ => $options{$_} } keys %options, ); my $self = { appender => $appender, name => $options{name}, }; bless $self, $class; return $self; } sub log { my ($self, %p) = @_; $self->{appender}->log( %p, ); return 1; } 1; --------------------------------------------- -- Rob |
From: Robert J. <yad...@sn...> - 2006-09-26 17:54:43
|
At 02:18 PM 9/22/2006, you wrote: >I'd recommend writing another appender which wraps around >Appender::DBI and checks for availability. Ok, having looked at some other options, this sounds like the way to go. But I have a noob question: How do I write that wrapper? I can handle writing the database availability code (I think! :) ) But I don't even know where to start for writing a wrapper to Appender::DBI. If it helps, I've written my own, albeit simple, Appender, that just implemented the new() and log() methods. -- Rob |
From: Mike S. <m...@pe...> - 2006-09-26 16:38:20
|
On Tue, 26 Sep 2006, Martin J. Evans wrote: > After loads of searching around and debugging I realised I'd missed > the obvious which is I am using two sorts of appenders - > Log::Dispatch::File and Log::Log4perl::Appender::File. The latter > seems to support the utf8 flag, the former does not. I have no idea > why I've mixed File appenders from different places. Other than the > obvious difference of one supports utf8 and the other does not is > there any reason any one knows why I shouldn't just swap my > Log::Dispatch::File appenders to Log4perl ones? I'd recommend using Log::Log4perl::Appender::File instead of Log::Dispatch::File throughout your project. The former has a lot of options (utf8, re-creating missing files, switching files, permissions, umasks ...) that the latter doesn't. > As an aside, why the duplication of File appenders with different > functionality? This cost me some time to locate. Log::Log4perl::Appender::File is part of the Log4perl project, Log::Dispatch::File is not. It's 3rd party. Log4perl supports appenders in the Log::Dispatch::* hierarchy to avoid duplication of effort, which backfires in this case :). As a rule of thumb, if there's a Log4perl appender and a 3rd party appender that are doing the same thing, use the Log4perl one -- chances are they've been created because the 3rd party appender wouldn't provide the functionality needed. -- Mike Mike Schilli m...@pe... > > Thanks. > > Martin > -- > Martin J. Evans > Easysoft Ltd, UK > http://www.easysoft.com > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |
From: Tony v. d. H. <to...@va...> - 2006-09-26 16:03:35
|
Mike Schilli <m...@pe...> wrote in message <200...@sp...> > On Tue, 26 Sep 2006, Tony van der Hoff wrote: > > > log4perl.rootlogger = ERROR, LOGFILE > > s/rootlogger/rootLogger :) > > Admittedly, this is confusing, I'll file a bug. > > -- Mike > > Mike Schilli m...@pe... > Yay! Thanks, guys. Learning is such a struggle :) -- Tony van der Hoff | mailto:to...@va... Buckinghamshire, England |
From: Martin J. E. <mar...@ea...> - 2006-09-26 15:19:24
|
Hi, I am using Log::Log4perl 1.06 in a rather large project and getting the old "Wide character in print..." problem. Most of my appenders are file appenders and I also have a Log::Dispatch::Screen handler. All my handlers have: log4perl.appender.APPENDER.utf8 = 1 set and I've set binmode ":utf8" on STDOUT and STDERR and yet I'm still getting: Wide character in print at /usr/lib/perl5/site_perl/5.8.8/Log/Dispatch/File.pm line 124. After loads of searching around and debugging I realised I'd missed the obvious which is I am using two sorts of appenders - Log::Dispatch::File and Log::Log4perl::Appender::File. The latter seems to support the utf8 flag, the former does not. I have no idea why I've mixed File appenders from different places. Other than the obvious difference of one supports utf8 and the other does not is there any reason any one knows why I shouldn't just swap my Log::Dispatch::File appenders to Log4perl ones? As an aside, why the duplication of File appenders with different functionality? This cost me some time to locate. Thanks. Martin -- Martin J. Evans Easysoft Ltd, UK http://www.easysoft.com |
From: Robert J. <yad...@sn...> - 2006-09-26 14:38:06
|
At 07:15 AM 9/26/2006, you wrote: > log4perl.rootlogger = ERROR, LOGFILE I hate to tell you this -- that needs to be "rootLogger" (uppercase "L"). That's all! |
From: Mike S. <m...@pe...> - 2006-09-26 14:27:36
|
On Tue, 26 Sep 2006, Tony van der Hoff wrote: > log4perl.rootlogger = ERROR, LOGFILE s/rootlogger/rootLogger :) Admittedly, this is confusing, I'll file a bug. -- Mike Mike Schilli m...@pe... |
From: Tony v. d. H. <to...@va...> - 2006-09-26 11:15:42
|
Hi, I'm trying to get to grips with log4perl, and am falling at the second hurdle. I can get the :easy configuration working OK, but anything beyond that has me stumped. I should add that I'm a relative PERL-newbie. I have a test script like this: -------------------------------------- #!/usr/bin/perl #testing require MainConfig; use Log::Log4perl qw(get_logger :levels); use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use HTML::Template; #use DBIWrapper; Log::Log4perl::init( "log.conf" ); my $logger = get_logger( "rootlogger" ); $logger -> level(INFO); $logger->info("test.pl starting on ", scalar localtime); ------------------------------------------ log.conf is thus: ----------------------------------------- log4perl.rootlogger = ERROR, LOGFILE log4perl.appender.LOGFILE = Log::Log4perl::Appender::File log4perl.appender.LOGFILE.filename = error.log log4perl.appender.LOGFILE.mode = append log4perl.appender.LOGFILE.layout = PatternLayout log4perl.appender.LOGFILE.layout.ConversionPattern = [%r] %F %L %c - %m%n ---------------------------------------------- Running the script produces: [tony@tony-lx rutland_members]$ ./test.pl [Tue Sep 26 11:21:11 2006] test.pl: Log::Log4perl configuration looks suspicious: No appenders defined at /usr/lib/perl5/site_perl/5.8.7/Log/Log4perl/Config.pm line 295. I've scanned the FAQ and the mail archive, both to no avail. Can someone please give me a nudge in the right direction? -- Tony van der Hoff | mailto:to...@va... Buckinghamshire, England |
From: John O. <joh...@o-...> - 2006-09-22 18:19:52
|
I'd recommend writing another appender which wraps around Appender::DBI and checks for availability. Alternatively, write to a text log file for speed, then have a daily script which pushes the log entries into the DB. hope that helps, John Robert Jacobson wrote: >I've configured my program to log to a MySQL database using >Log::Log4perl::Appender::DBI. However, if the database is not >available, my program hangs on trying to write log messages. Is >there a workaround for this? > >Thanks, >Rob > > >------------------------------------------------------------------------- >Take Surveys. Earn Cash. Influence the Future of IT >Join SourceForge.net's Techsay panel and you'll get the chance to share your >opinions on IT & business topics through brief surveys -- and earn cash >http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >_______________________________________________ >log4perl-devel mailing list >log...@li... >https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > |
From: Robert J. <yad...@sn...> - 2006-09-22 17:24:46
|
I've configured my program to log to a MySQL database using Log::Log4perl::Appender::DBI. However, if the database is not available, my program hangs on trying to write log messages. Is there a workaround for this? Thanks, Rob |
From: Mike S. <m...@pe...> - 2006-08-23 19:31:23
|
On Wed, 23 Aug 2006, Lev Lvovsky wrote: > Thanks Mike - this is definitely close to what I'm looking for, > however is there a way to get around explicitly naming the > subroutines? Moreover, will log4perl report that it's entering/ > exiting from the intended subroutine, or the wrapped sub? Here's how to adapt the caller level: http://log4perl.sourceforge.net/d/Log/Log4perl.html#6acb7 -- Mike Mike Schilli m...@pe... |
From: Lev L. <li...@so...> - 2006-08-23 17:43:18
|
On Aug 23, 2006, at 12:31 AM, Mike Schilli wrote: > Looks good to me. If you're logging subroutine entries and exits > extensively, you might wanna look at wrappers like > > http://search.cpan.org/~jdporter/Hook-WrapSub-0.03/lib/Hook/ > WrapSub.pm Thanks Mike - this is definitely close to what I'm looking for, however is there a way to get around explicitly naming the subroutines? Moreover, will log4perl report that it's entering/ exiting from the intended subroutine, or the wrapped sub? thanks, -lev |