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: Ronald of S. <aus...@ye...> - 2009-02-18 13:46:10
|
This is the condensed code of my application just for demonstrating my
problem:
use strict;
use warnings;
use Log::Log4perl qw(:easy);
use Log::Log4perl::Appender::File;
Log::Log4perl->easy_init({file=>'STDOUT',layout => '%d{HH:mm} %m%n',
level=>$DEBUG});
my $logger=Log::Log4perl::Appender::File->new(filename => "dummy.log",
mode => 'clobber');
$logger->log(message=>"test\n");
$logger->layout(Log::Log4perl::Layout::PatternLayout->new('%c %C
%m%n'));
$logger->log(message => "abc");
$logger->logdebug('xyz');
Reason for this probably slightly unusual way of using Log::Log4perl is
the following: My application
uses one common logging facility (hence the easy_init). Certain parts of
the application want to create
occasionally their various other logfiles with their own layout and
shorter lifetime than the common
logging system (demonstrated here by the variable $logger).
Running this program results in a file dummy.log containing
test
abc
and the message
Can't call method "logdebug" on an undefined value
Now my questions:
(1) Why does the second call to log() not obey the pattern layout I have
defined the line before?
After all, a Appender::File inherits from Appender, and hence layout()
should have the desired
effect.
(2) Why does the error message say "on an undefined value", when $logger
(the object where method is
called on) is obviously not undefined?
(3) I guess one of my mistakes is that Appender::File is not a suitable
logger type for my purpose.
Should I use a different logger instead, and if yes, which one?
Ronald
--
Ronald Fischer <aus...@ye...>
There are 10 types of people in the world: those who understand binary and those who don't.
|
|
From: Mike S. <m...@pe...> - 2009-02-18 00:41:55
|
On Tue, 17 Feb 2009, wzh...@gm... wrote:
> I'd like the main.log to rotate at midnight, and persist among
> restarts (log file not wiped out among restarts) so I used "append"
> mode here, but the rotation is not working, did I set this up wrong?
> Thanks in advance!
Can you specify what exactly isn't working?
Note that the rotation will only happen if you're writing a message.
Also, if you're not sure if it's working correctly, use a shorter
rotation interval (e.g. every minute) to create a test case you can
verify quickly.
-- Mike
Mike Schilli
m...@pe...
> Hi there, Here is my log4perl.properties file: #predefined variables
> layout_class = Log::Log4perl::Layout::PatternLayout layout_pattern
> = %d %5p %F{1} %L> %m %n layout_email_pattern = %d{yyyy-MM-dd
> HH:mm:ss} [%F{1}:%c{1}:%L] %5p> %m%n log_file_appender
> = Log::Dispatch::FileRotate
>
> #log4perl category
> log4perl.logger.main = WARN, MainLogfile, Email
>
> log4perl.appender.MainLogfile = Log::Dispatch::FileRotate
> log4perl.appender.MainLogfile.filename = main.log
> log4perl.appender.MainLogfile.mode = append
> log4perl.appender.MainLogfile.max = 5
> log4perl.appender.MainLogfile.DatePattern = yyyy-MM-dd
> log4perl.appender.MainLogfile.TZ = PST
> log4perl.appender.MainLogfile.layout = ${layout_class}
> log4perl.appender.MainLogfile.layout.ConversionPattern = ${layout_pattern}
>
|
|
From: Mike S. <m...@pe...> - 2009-02-18 00:36:38
|
On Tue, 17 Feb 2009, wzh...@gm... wrote:
> What I'm trying to do here is:
> 1. log WARN to mainLogFile
> 2. log DEBUG to runMonitorLogFile
Watch out for this common gotcha, listed in the Log4perl FAQ:
http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl/FAQ.pm#I_keep_getting_duplicate_log_messages!_What's_wrong?
Also, what do you mean exactly when you say "log WARN" -- is it WARN
messages only or WARN+up?
-- Mike
Mike Schilli
m...@pe...
> 3. output to screen at level INFO
> 4. email at level WARN
> and here is the log4per.properties file:
>
> #predefined variables
> layout_class = Log::Log4perl::Layout::PatternLayout
> layout_pattern = %d %5p %F{1} %L> %m %n
> layout_email_pattern = %d{yyyy-MM-dd HH:mm:ss} [%F{1}:%c{1}:%L] %5p> %m%n
> log_file_appender = Log::Dispatch::FileRotate
>
> log4perl.logger.main = WARN, MainLogfile, Email
>
> log4perl.logger.main.runMonitorStage = DEBUG, RunMonitorLogFile, Screen
>
> log4perl.appender.MainLogfile = Log::Dispatch::FileRotate
> log4perl.appender.MainLogfile.filename = main.log
> log4perl.appender.MainLogfile.mode = append
> log4perl.appender.MainLogfile.max = 5
> log4perl.appender.MainLogfile.DatePattern = yyyy-MM-dd
> log4perl.appender.MainLogfile.TZ = PST
> log4perl.appender.MainLogfile.layout = ${layout_class}
> log4perl.appender.MainLogfile.layout.ConversionPattern = ${layout_pattern}
>
>
> #Run Monitor Stage Log
> log4perl.appender.RunMonitorLogFile = ${log_file_appender}
> log4perl.appender.RunMonitorLogFile.filename = logs/runmonitor.log
> log4perl.appender.RunMonitorLogFile.mode = append
> log4perl.appender.RunMonitorLogFile.max = 5
> log4perl.appender.RunMonitorLogFile.DatePattern = yyyy-MM-dd
> log4perl.appender.RunMonitorLogFile.TZ = PST
> log4perl.appender.RunMonitorLogFile.layout = ${layout_class}
> log4perl.appender.RunMonitorLogFile.layout.ConversionPattern =
> ${layout_pattern}
>
> #log4perl general screen output configuration
> log4perl.appender.Screen = Log::Log4perl::Appender::Screen
> log4perl.appender.Screen.stderr = 0
> log4perl.appender.Screen.layout = ${layout_class}
> log4perl.appender.Screen.layout.ConversionPattern = ${layout_pattern}
> log4perl.appender.Screen.Threshold = INFO
>
> #SPP event EMAIL output configuration
> log4perl.appender.Email = Log::Dispatch::Email::MailSender
> log4perl.appender.Email.subject = sub { return getEmailSubject(); }
> #log4perl.appender.Email.subject = %F{1}
> log4perl.appender.Email.name = SPP event
> log4perl.appender.Email.to = da...@ma...
> log4perl.appender.Email.from = davidz@ mail.com
> log4perl.appender.Email.smtp = mail.com
> log4perl.appender.Email.min_level = warning
> log4perl.appender.Email.buffered = 0
> log4perl.appender.Email.layout = ${layout_class}
> log4perl.appender.Email.layout.ConversionPattern = ${layout_email_pattern}
>
> With this setup, I can achieve all of above intended, except for the DEBUG
> logging is directed to mail.log instead of runmonitor.log.
> With
> log4perl.appender.MainLogfile.Threshold = WARN
> specified, no DEBUG level log to either logs.
>
> Where do I set up wrong here? Thanks in advance!
>
> David
>
|
|
From: <wzh...@gm...> - 2009-02-17 18:17:27
|
Hi there,
Here is my log4perl.properties file:
#predefined variables
layout_class = Log::Log4perl::Layout::PatternLayout
layout_pattern = %d %5p %F{1} %L> %m %n
layout_email_pattern = %d{yyyy-MM-dd HH:mm:ss} [%F{1}:%c{1}:%L] %5p> %m%n
log_file_appender = Log::Dispatch::FileRotate
#log4perl category
log4perl.logger.main = WARN, MainLogfile, Email
log4perl.appender.MainLogfile = Log::Dispatch::FileRotate
log4perl.appender.MainLogfile.filename = main.log
log4perl.appender.MainLogfile.mode = append
log4perl.appender.MainLogfile.max = 5
log4perl.appender.MainLogfile.DatePattern = yyyy-MM-dd
log4perl.appender.MainLogfile.TZ = PST
log4perl.appender.MainLogfile.layout = ${layout_class}
log4perl.appender.MainLogfile.layout.ConversionPattern = ${layout_pattern}
I'd like the main.log to rotate at midnight, and persist among restarts (log
file not wiped out among restarts) so I used "append" mode here, but the
rotation is not working, did I set this up wrong?
Thanks in advance!
David
|
|
From: <wzh...@gm...> - 2009-02-17 18:14:03
|
Hi there,
What I'm trying to do here is:
1. log WARN to mainLogFile
2. log DEBUG to runMonitorLogFile
3. output to screen at level INFO
4. email at level WARN
and here is the log4per.properties file:
#predefined variables
layout_class = Log::Log4perl::Layout::PatternLayout
layout_pattern = %d %5p %F{1} %L> %m %n
layout_email_pattern = %d{yyyy-MM-dd HH:mm:ss} [%F{1}:%c{1}:%L] %5p> %m%n
log_file_appender = Log::Dispatch::FileRotate
log4perl.logger.main = WARN, MainLogfile, Email
log4perl.logger.main.runMonitorStage = DEBUG, RunMonitorLogFile, Screen
log4perl.appender.MainLogfile = Log::Dispatch::FileRotate
log4perl.appender.MainLogfile.filename = main.log
log4perl.appender.MainLogfile.mode = append
log4perl.appender.MainLogfile.max = 5
log4perl.appender.MainLogfile.DatePattern = yyyy-MM-dd
log4perl.appender.MainLogfile.TZ = PST
log4perl.appender.MainLogfile.layout = ${layout_class}
log4perl.appender.MainLogfile.layout.ConversionPattern = ${layout_pattern}
#Run Monitor Stage Log
log4perl.appender.RunMonitorLogFile = ${log_file_appender}
log4perl.appender.RunMonitorLogFile.filename = logs/runmonitor.log
log4perl.appender.RunMonitorLogFile.mode = append
log4perl.appender.RunMonitorLogFile.max = 5
log4perl.appender.RunMonitorLogFile.DatePattern = yyyy-MM-dd
log4perl.appender.RunMonitorLogFile.TZ = PST
log4perl.appender.RunMonitorLogFile.layout = ${layout_class}
log4perl.appender.RunMonitorLogFile.layout.ConversionPattern =
${layout_pattern}
#log4perl general screen output configuration
log4perl.appender.Screen = Log::Log4perl::Appender::Screen
log4perl.appender.Screen.stderr = 0
log4perl.appender.Screen.layout = ${layout_class}
log4perl.appender.Screen.layout.ConversionPattern = ${layout_pattern}
log4perl.appender.Screen.Threshold = INFO
#SPP event EMAIL output configuration
log4perl.appender.Email = Log::Dispatch::Email::MailSender
log4perl.appender.Email.subject = sub { return getEmailSubject(); }
#log4perl.appender.Email.subject = %F{1}
log4perl.appender.Email.name = SPP event
log4perl.appender.Email.to = da...@ma...
log4perl.appender.Email.from = davidz@ mail.com
log4perl.appender.Email.smtp = mail.com
log4perl.appender.Email.min_level = warning
log4perl.appender.Email.buffered = 0
log4perl.appender.Email.layout = ${layout_class}
log4perl.appender.Email.layout.ConversionPattern = ${layout_email_pattern}
With this setup, I can achieve all of above intended, except for the DEBUG
logging is directed to mail.log instead of runmonitor.log.
With
log4perl.appender.MainLogfile.Threshold = WARN
specified, no DEBUG level log to either logs.
Where do I set up wrong here? Thanks in advance!
David
|
|
From: Mike S. <m...@pe...> - 2009-02-12 20:45:40
|
On Thu, 12 Feb 2009, David Zhao wrote:
> Is there a way to use parameters from
> Log::Log4perl::Layout::PatternLayout, such as %F, %p, %c, in email
> subject from Log::Dispatch::Email::MailSender? Something like:
Not easily, you would need to write a custom appender.
-- Mike
Mike Schilli
m...@pe...
>
> layout_class = Log::Log4perl::Layout::PatternLayout
> layout_pattern = %d %5p %F{1} %L> %m %n
> layout_email_pattern = %d{yyyy-MM-dd HH:mm:ss} [%F{1}:%c{1}:%L] %5p> %m%n
>
>
> log4perl.appender.Email = Log::Dispatch::Email::MailSender
> ###subject here###
> log4perl.appender.Email.subject = %F
> ##################
> log4perl.appender.Email.name = SPP event
> log4perl.appender.Email.to = da...@ac...
> log4perl.appender.Email.from = da...@ac...
> log4perl.appender.Email.smtp = 192.168.0.4
> log4perl.appender.Email.min_level = warning
> log4perl.appender.Email.buffered = 0
> log4perl.appender.Email.layout = ${layout_class}
> log4perl.appender.Email.layout.ConversionPattern = ${layout_email_pattern}
>
> Thanks,
>
> David
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> log4perl-devel mailing list
> log...@li...
> https://lists.sourceforge.net/lists/listinfo/log4perl-devel
>
|
|
From: Mike S. <m...@pe...> - 2009-02-12 20:38:06
|
On Thu, 12 Feb 2009, David Zhao wrote:
> Got another question: I'd like to enable logging within our home grown
> module packages, such as: Mycompany:Modules:A, Mycompany:Modules:B,
> etc, without setting a logger in the configuration file for every
> module.
If you define a logger like
log4perl.category.Mycompany.Modules = ...
then it'll cover both Mycompany:Modules:A and Mycompany:Modules:B
because of logger inheritance:
http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl.pm#Categories
-- Mike
Mike Schilli
m...@pe...
|
|
From: David Z. <wzh...@gm...> - 2009-02-12 19:36:00
|
Hi there, Got another question: I'd like to enable logging within our home grown module packages, such as: Mycompany:Modules:A, Mycompany:Modules:B, etc, without setting a logger in the configuration file for every module. What's the best way of doing this? Thanks in advance! David |
|
From: David Z. <wzh...@gm...> - 2009-02-12 19:06:06
|
Hi there,
Is there a way to use parameters from Log::Log4perl::Layout::PatternLayout,
such as %F, %p, %c, in email subject from Log::Dispatch::Email::MailSender?
Something like:
layout_class = Log::Log4perl::Layout::PatternLayout
layout_pattern = %d %5p %F{1} %L> %m %n
layout_email_pattern = %d{yyyy-MM-dd HH:mm:ss} [%F{1}:%c{1}:%L] %5p> %m%n
log4perl.appender.Email = Log::Dispatch::Email::MailSender
###subject here###
log4perl.appender.Email.subject = %F
##################
log4perl.appender.Email.name = SPP event
log4perl.appender.Email.to = da...@ac...
log4perl.appender.Email.from = da...@ac...
log4perl.appender.Email.smtp = 192.168.0.4
log4perl.appender.Email.min_level = warning
log4perl.appender.Email.buffered = 0
log4perl.appender.Email.layout = ${layout_class}
log4perl.appender.Email.layout.ConversionPattern = ${layout_email_pattern}
Thanks,
David
|
|
From: Mike S. <m...@pe...> - 2009-02-12 08:55:29
|
On Thu, 12 Feb 2009, wei...@gm... wrote: > When I saw "Log4perl: DBI appender failed to reconnect to database > after 1 attempt at ./tests/testDbCon.pl line 21", I thought it was the > database connection issue. Maybe it'd nice that the actual DBI error > was captured. Yeah, that was a misleading error message, I've fixed it in CVS, it will be released with 1.21. > BTW, in my codes, I have overridden DBI.pm to establish the database > connection and return a DBH, I'd like to use that DBH for log4perl, how do I > go about doing it? There's no easy way to do that right now if you're using a configuration file, but if you attach the DBI appender via add_appender() in your code, you can pass in your $dbh to the constructor via new( dbh => $dbh). -- Mike Mike Schilli m...@pe... > > Thanks, > > David > > On Feb 11, 2009 4:49pm, "Kevin M. Goess" <cp...@go...> wrote: >> What are the rest of the contents of your testDbCon.pl script? >> >> >> >> And does this succeed? >> >> >> >> perl -MDBI -e 'DBI->connect(q/DBI:mysql:dbname=tmp;host=devserv/)' >> >> >> >> >> >> >> >> DavidZ wrote: >> >>> yes, I can connect to the database using mysql client, and tried to >> >>> connect without ";port=", still not working: >> >>> Log4perl: DBI appender failed to reconnect to database after 1 attempt >> >>> at ./test >> >>> s/testDbCon.pl line 38 >> >>> >> >>> Not sure why it's saying "reconnect". >> >>> thanks, >> >>> >> >>> David >> >>> >> >>> >> >>> On Tue, Feb 10, 2009 at 11:59 PM, Mike Schilli m...@pe... >> >>> m...@pe...>> wrote: >> >>> >> >>> On Tue, 10 Feb 2009, David Zhao wrote: >> >>> >> >>> = DBI:mysql:dbname=tmp;host=devserv;port= >> >>> log4perl.appender.DBAppender.username = user >> >>> log4perl.appender.DBAppender.password = 12345 >> >>> >> >>> >> >>> Can you connect to the database using the mysql client? Try >> >>> >> >>> mysql -uuser -p -h devserv tmp >> >>> >> >>> and when prompted for a password, type '12345'. If this works, the only >> >>> other suspicious item I noticed at first glance is the ";port=" part -- >> >>> try it without. >> >>> >> >> > |
|
From: Kevin M. G. <cp...@go...> - 2009-02-12 01:16:02
|
What are the rest of the contents of your testDbCon.pl script? And does this succeed? perl -MDBI -e 'DBI->connect(q/DBI:mysql:dbname=tmp;host=devserv/)' DavidZ wrote: > yes, I can connect to the database using mysql client, and tried to > connect without ";port=", still not working: > Log4perl: DBI appender failed to reconnect to database after 1 attempt > at ./test > s/testDbCon.pl line 38 > > Not sure why it's saying "reconnect". > thanks, > > David > > > On Tue, Feb 10, 2009 at 11:59 PM, Mike Schilli <m...@pe... > <mailto:m...@pe...>> wrote: > > On Tue, 10 Feb 2009, David Zhao wrote: > > = DBI:mysql:dbname=tmp;host=devserv;port= > log4perl.appender.DBAppender.username = user > log4perl.appender.DBAppender.password = 12345 > > > Can you connect to the database using the mysql client? Try > > mysql -uuser -p -h devserv tmp > > and when prompted for a password, type '12345'. If this works, the only > other suspicious item I noticed at first glance is the ";port=" part -- > try it without. > |
|
From: <wei...@gm...> - 2009-02-12 01:15:42
|
Hi there, I found out where the problem was, and btw, yes, perl -MDBI -e 'DBI->connect(q/DBI:mysql:dbname=tmp;host=devserv;user=user;password=pass/)' succeeded. The problem was the table was using "message" as one of the column names, which even though not a reserved word in MySQL, but somehow makes it unhappy (Unknown column 'message' in 'field list'). After I changed the column name to "msg", it's all working now. When I saw "Log4perl: DBI appender failed to reconnect to database after 1 attempt at ./tests/testDbCon.pl line 21", I thought it was the database connection issue. Maybe it'd nice that the actual DBI error was captured. BTW, in my codes, I have overridden DBI.pm to establish the database connection and return a DBH, I'd like to use that DBH for log4perl, how do I go about doing it? Thanks, David On Feb 11, 2009 4:49pm, "Kevin M. Goess" <cp...@go...> wrote: > What are the rest of the contents of your testDbCon.pl script? > > > > And does this succeed? > > > > perl -MDBI -e 'DBI->connect(q/DBI:mysql:dbname=tmp;host=devserv/)' > > > > > > > > DavidZ wrote: > > > yes, I can connect to the database using mysql client, and tried to > > > connect without ";port=", still not working: > > > Log4perl: DBI appender failed to reconnect to database after 1 attempt > > > at ./test > > > s/testDbCon.pl line 38 > > > > > > Not sure why it's saying "reconnect". > > > thanks, > > > > > > David > > > > > > > > > On Tue, Feb 10, 2009 at 11:59 PM, Mike Schilli m...@pe... > > > m...@pe...>> wrote: > > > > > > On Tue, 10 Feb 2009, David Zhao wrote: > > > > > > = DBI:mysql:dbname=tmp;host=devserv;port= > > > log4perl.appender.DBAppender.username = user > > > log4perl.appender.DBAppender.password = 12345 > > > > > > > > > Can you connect to the database using the mysql client? Try > > > > > > mysql -uuser -p -h devserv tmp > > > > > > and when prompted for a password, type '12345'. If this works, the only > > > other suspicious item I noticed at first glance is the ";port=" part -- > > > try it without. > > > > > > |
|
From: DavidZ <wei...@gm...> - 2009-02-11 19:07:13
|
yes, I can connect to the database using mysql client, and tried to connect without ";port=", still not working:Log4perl: DBI appender failed to reconnect to database after 1 attempt at ./test s/testDbCon.pl line 38 Not sure why it's saying "reconnect". thanks, David On Tue, Feb 10, 2009 at 11:59 PM, Mike Schilli <m...@pe...> wrote: > On Tue, 10 Feb 2009, David Zhao wrote: > > = DBI:mysql:dbname=tmp;host=devserv;port= >> log4perl.appender.DBAppender.username = user >> log4perl.appender.DBAppender.password = 12345 >> > > Can you connect to the database using the mysql client? Try > > mysql -uuser -p -h devserv tmp > > and when prompted for a password, type '12345'. If this works, the only > other suspicious item I noticed at first glance is the ";port=" part -- > try it without. > > -- Mike > > Mike Schilli > m...@pe... > > log4perl.appender.DBAppender.sql = \ INSERT INTO spp (loglevel, >> message) \ VALUES (?,?) log4perl.appender.DBAppender.layout >> = Log::Log4perl::Layout::NoopLayout >> log4perl.appender.DBAppender.params.1 = %c >> log4perl.appender.DBAppender.params.1 = %m >> >> and got an error >> Log4perl: DBI appender failed to reconnect to database after 1 attempt at >> ./test.pl line 37 >> >> Please help, thanks in advance! >> >> David >> >> >> >> ------------------------------------------------------------------------------ >> Create and Deploy Rich Internet Apps outside the browser with >> Adobe(R)AIR(TM) >> software. With Adobe AIR, Ajax developers can use existing skills and code >> to >> build responsive, highly engaging applications that combine the power of >> local >> resources and data with the reach of the web. Download the Adobe AIR SDK >> and >> Ajax docs to start building applications today- >> http://p.sf.net/sfu/adobe-com >> _______________________________________________ >> log4perl-devel mailing list >> log...@li... >> https://lists.sourceforge.net/lists/listinfo/log4perl-devel >> >> > |
|
From: Mike S. <m...@pe...> - 2009-02-11 07:59:57
|
On Tue, 10 Feb 2009, David Zhao wrote:
> = DBI:mysql:dbname=tmp;host=devserv;port=
> log4perl.appender.DBAppender.username = user
> log4perl.appender.DBAppender.password = 12345
Can you connect to the database using the mysql client? Try
mysql -uuser -p -h devserv tmp
and when prompted for a password, type '12345'. If this works, the only
other suspicious item I noticed at first glance is the ";port=" part --
try it without.
-- Mike
Mike Schilli
m...@pe...
> log4perl.appender.DBAppender.sql = \ INSERT INTO spp (loglevel,
> message) \ VALUES (?,?) log4perl.appender.DBAppender.layout
> = Log::Log4perl::Layout::NoopLayout
> log4perl.appender.DBAppender.params.1 = %c
> log4perl.appender.DBAppender.params.1 = %m
>
> and got an error
> Log4perl: DBI appender failed to reconnect to database after 1 attempt at
> ./test.pl line 37
>
> Please help, thanks in advance!
>
> David
>
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> _______________________________________________
> log4perl-devel mailing list
> log...@li...
> https://lists.sourceforge.net/lists/listinfo/log4perl-devel
>
|
|
From: David Z. <wzh...@gm...> - 2009-02-10 22:45:09
|
Hi there, Here is my log4perl.properties file setup for Log::Log4perl::Appender::DBI log4perl.appender.DBAppender = Log::Log4perl::Appender::DBI log4perl.appender.DBAppender.datasource = DBI:mysql:dbname=tmp;host=devserv;port= log4perl.appender.DBAppender.username = user log4perl.appender.DBAppender.password = 12345 log4perl.appender.DBAppender.sql = \ INSERT INTO spp (loglevel, message) \ VALUES (?,?) log4perl.appender.DBAppender.layout = Log::Log4perl::Layout::NoopLayout log4perl.appender.DBAppender.params.1 = %c log4perl.appender.DBAppender.params.1 = %m and got an error Log4perl: DBI appender failed to reconnect to database after 1 attempt at ./test.pl line 37 Please help, thanks in advance! David |
|
From: DAY R. <Rog...@at...> - 2009-02-10 10:13:57
|
The latest version made no visible difference. I think throw does
something strange with die as I never see the "helloworld" message
printed.
Roger
use MRFExceptions;
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init();
$SIG{__DIE__} = sub {
if($^S) {
# We're in an eval {} and don't want log
# this message but catch it later
return;
}
print "helloworld\n";
$Log::Log4perl::caller_depth++;
LOGDIE @_;
};
eval {
MRF::Exception::Remote->throw('userid'=>"some crappy file");
} or do {
print "ERROR ".$@."\n";
if ($@) {
print "die, die, die\n";
if ($@->isa('MRF::Exception::Deploy')) {
print "MRF::Exception::Deploy [", $@->userid, "]: $@" ;
} else {
print "Down the list\n";
}
}
};
1;
-----Original Message-----
From: Mike Schilli [mailto:m...@pe...]
Sent: 09 February 2009 21:42
To: DAY Roger
Cc: log...@li...
Subject: Re: [log4perl-devel] Problems with log4perl and __DIE__ pseudo
signal
On Mon, 9 Feb 2009, DAY Roger wrote:
> Good to see the log4perl-devel list up and alive. I've managed to drag
> another company into using log4perl, but to business.
Good job! :)
> I've implemented Matt Sargants recomendations for exception handling
> but on the throw method I keep getting a "bad file descriptor" in $@
> when I add the line Log::Log4perl->easy_init(); Is there a way around
> this? I think it's the easy_init causing the problem; do I need to
> close Log::Log4perl properly, or somesuch?
Could this be related to using eval{} and not checking $^S in the
__DIE__ handler?
http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl/FAQ.pm#How_can
_I_make_sure_my_application_logs_a_message_when_it_dies_unexpectedly?
-- Mike
Mike Schilli
m...@pe...
------------------------------------------------------------------------
------
Create and Deploy Rich Internet Apps outside the browser with
Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and
code to
build responsive, highly engaging applications that combine the power of
local
resources and data with the reach of the web. Download the Adobe AIR SDK
and
Ajax docs to start building applications
today-http://p.sf.net/sfu/adobe-com
_______________________________________________
log4perl-devel mailing list
log...@li...
https://lists.sourceforge.net/lists/listinfo/log4perl-devel
**********************************************************************
The Atradius Group conducts insurance, debt collection and information services business through its registered offices and branch offices in various countries. For information about the main registration details of the Atradius branch offices in your country please visit http://global.atradius.com/general-content/legal/legallist.html
IMPORTANT NOTICE. This message, including any and all attachments, is intended for the addressee or its representative only and is confidential and may be under legal privilege. Any form of unauthorised use, publication, reproduction, copying or disclosure of the content of this e-mail is not permitted. If you are not the intended recipient of this e-mail message and its contents, please notify the sender immediately by reply email and delete this message and all its attachments subsequently. Although this email and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by Atradius N.V. or its subsidiaries or affiliates (Atradius Group) either jointly or severally, for any loss or damage arising in any way from its use. Email messages received by Atradius Group can be stored for business purposes.
**********************************************************************
|
|
From: DAY R. <Rog...@at...> - 2009-02-10 09:46:26
|
It could be. I get different behaviours dependant on the PERL I'm using
- the pre-installed Mac OS X PERL doesn't give the "bad file descriptor"
error, but the Mac OS X and MS Active State PERL does, although the
latter are both 5.10. I'll try the suggested solution.
Cheers
Roger
-----Original Message-----
From: Mike Schilli [mailto:m...@pe...]
Sent: 09 February 2009 21:42
To: DAY Roger
Cc: log...@li...
Subject: Re: [log4perl-devel] Problems with log4perl and __DIE__ pseudo
signal
On Mon, 9 Feb 2009, DAY Roger wrote:
> Good to see the log4perl-devel list up and alive. I've managed to drag
> another company into using log4perl, but to business.
Good job! :)
> I've implemented Matt Sargants recomendations for exception handling
> but on the throw method I keep getting a "bad file descriptor" in $@
> when I add the line Log::Log4perl->easy_init(); Is there a way around
> this? I think it's the easy_init causing the problem; do I need to
> close Log::Log4perl properly, or somesuch?
Could this be related to using eval{} and not checking $^S in the
__DIE__ handler?
http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl/FAQ.pm#How_can
_I_make_sure_my_application_logs_a_message_when_it_dies_unexpectedly?
-- Mike
Mike Schilli
m...@pe...
**********************************************************************
The Atradius Group conducts insurance, debt collection and information services business through its registered offices and branch offices in various countries. For information about the main registration details of the Atradius branch offices in your country please visit http://global.atradius.com/general-content/legal/legallist.html
IMPORTANT NOTICE. This message, including any and all attachments, is intended for the addressee or its representative only and is confidential and may be under legal privilege. Any form of unauthorised use, publication, reproduction, copying or disclosure of the content of this e-mail is not permitted. If you are not the intended recipient of this e-mail message and its contents, please notify the sender immediately by reply email and delete this message and all its attachments subsequently. Although this email and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by Atradius N.V. or its subsidiaries or affiliates (Atradius Group) either jointly or severally, for any loss or damage arising in any way from its use. Email messages received by Atradius Group can be stored for business purposes.
**********************************************************************
|
|
From: Mike S. <m...@pe...> - 2009-02-09 23:07:44
|
On Mon, 9 Feb 2009, DAY Roger wrote:
> Good to see the log4perl-devel list up and alive. I've managed to drag
> another company into using log4perl, but to business.
Good job! :)
> I've implemented Matt Sargants recomendations for exception handling
> but on the throw method I keep getting a "bad file descriptor" in $@
> when I add the line Log::Log4perl->easy_init(); Is there a way around
> this? I think it's the easy_init causing the problem; do I need to
> close Log::Log4perl properly, or somesuch?
Could this be related to using eval{} and not checking $^S in the
__DIE__ handler?
http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl/FAQ.pm#How_can_I_make_sure_my_application_logs_a_message_when_it_dies_unexpectedly?
-- Mike
Mike Schilli
m...@pe...
|
|
From: DAY R. <Rog...@at...> - 2009-02-09 15:43:56
|
Hi
Good to see the log4perl-devel list up and alive. I've managed to drag
another company into using log4perl, but to business.
I've implemented Matt Sargants recomendations for exception handling but
on the throw method I keep getting a "bad file descriptor" in $@ when I
add the line Log::Log4perl->easy_init(); Is there a way around this? I
think it's the easy_init causing the problem; do I need to close
Log::Log4perl properly, or somesuch?
use MRFExceptions;
use Log::Log4perl;
Log::Log4perl->easy_init();
sub a {
my $test = shift;
if ($test) {
throw MRF::Exception::Remote('userid'=>"some crappy file");
}
}
my $test = 1;
local($@);
eval {
&a($test);
} or do {
print "ERROR ".$@."\n";
if ($@) {
print "die, die, die\n";
if ($@->isa('MRF::Exception::Deploy')) {
print "MRF::Exception::Deploy [", $@->userid, "]: $@" ;
} else {
print "Down the list\n";
}
}
};
1;
And so
use Fatal qw(:void open close);
local $SIG{__DIE__} = sub {
my $err = shift;
if ($err->isa('MRF::Exception')) {
die $err; # re-throw
} else {
$! = "this error";
die MRF::Exception->new($err);
}
};
And so
package MRFExceptions;
our (@ISA, @EXPORT);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(throw); # symbols to export on request
}
use Exception::Class (
MRF::Exception => {
'description' => 'Default
Exception for the MRF system.',
},
MRF::Exception::IO => {
'isa' => 'MRF::Exception',
'description' => 'IO
Exception',
'fields' => [ 'filedump'],
},
MRF::Exception::Deploy => {
'isa' =>
'MRF::Exception',
'fields' => [
'operation','filedump' ],
'description' =>
'Deployment problem',
},
MRF::Exception::Remote => {
'isa' =>
'MRF::Exception::Deploy',
'fields' => [
'userid','machine','operation' ],
'description' =>
'Remote Deployment',
},
);
sub throw {
my $mess = join('', @_);
$mess =~ s/\n?$/\n/;
my $i = 1;
local $" = "', '";
package DB;
while (my @parts = caller($i++)) {
my $q; $q = "'" if @DB::args;
$mess .= " -> $parts[3](@DB::args)" .
" at $parts[1] line $parts[2]\n";
}
print "MESS: $mess\n";
die $mess;
}
1;
**********************************************************************
The Atradius Group conducts insurance, debt collection and information services business through its registered offices and branch offices in various countries. For information about the main registration details of the Atradius branch offices in your country please visit http://global.atradius.com/general-content/legal/legallist.html
IMPORTANT NOTICE. This message, including any and all attachments, is intended for the addressee or its representative only and is confidential and may be under legal privilege. Any form of unauthorised use, publication, reproduction, copying or disclosure of the content of this e-mail is not permitted. If you are not the intended recipient of this e-mail message and its contents, please notify the sender immediately by reply email and delete this message and all its attachments subsequently. Although this email and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by Atradius N.V. or its subsidiaries or affiliates (Atradius Group) either jointly or severally, for any loss or damage arising in any way from its use. Email messages received by Atradius Group can be stored for business purposes.
**********************************************************************
|
|
From: Mike S. <m...@pe...> - 2009-01-26 23:07:44
|
On Mon, 26 Jan 2009, Manoj Wanzare wrote:
> 3) DEBUG mode should have an option of either writing to Screen
> or debuglog file or both
I presume that 'debug mode' is a mode your application is in, so it
would be available in a variable of the program? If so, you can attach
a filter to each appender and have it check if the appender is supposed
to fire or not:
log4perl.category = DEBUG, Logfile, Screen
log4perl.appender.Logfile = Log::Log4perl::Appender::File
log4perl.appender.Logfile.filename = test.log
log4perl.appender.Logfile.layout = \
Log::Log4perl::Layout::SimpleLayout
log4perl.appender.Logfile.Filter = LogFileFilter
log4perl.appender.Screen = Log::Log4perl::Appender::Screen
log4perl.appender.Screen.layout = \
Log::Log4perl::Layout::SimpleLayout
log4perl.appender.Screen.Filter = ScreenFilter
log4perl.filter.ScreenFilter = \
sub { my %p = @_; $p{log4p_level} eq "INFO" or $main::debug_mode_to_screen }
log4perl.filter.LogFileFilter = \
sub { my %p = @_; $p{log4p_level} eq "INFO" or $main::debug_mode_to_file }
The Log::Log4perl::Filter docs show more details. You probably want to
write a custom Log::Log4perl::Filter to keep the filter logic separate
from the Log4perl configuration file. In the config above, if you set
our $debug_mode_to_screen = 0;
our $debug_mode_to_file = 0;
in the main program, nothing will happen with debug messages (but still
with info messages).
> 4) Option to replicate debug log messages in system-wide
> logging if debug log is turned of.
Hmm, I need some clarification on this one -- what exactly do you want
to replicate?
-- Mike
Mike Schilli
m...@pe...
> I am a new user of log4perl and to this mailing list. I am working
> on a perl project - want to incorporate Log4perl as main logging
> framework. The requirement is as below:
>
> 1) Wrapper over Log4perl
> 2) System-wide Logging to File & Screen in INFO mode
> 3) DEBUG mode should have an option of either writing to Screen
> or debuglog file or both
> 4) Option to replicate debug log messages in system-wide
> logging if debug log is turned of.
>
> Creating a package and using a log4 conf file with rootLogger in
> INFO mode and Logfile and Screen as appenders take care of
> requirement 1&2 however option third and fourth is tricky to
> incorporate. I have tried Filter match etc but cannot seem to get
> my head around effectively incorporating requirement 3 & 4.
|
|
From: Manoj W. <ma...@ho...> - 2009-01-26 09:15:41
|
Dear All,
I am a new user of log4perl and to this mailing list. I am working on a perl project - want to incorporate Log4perl as main logging framework. The requirement is as below:
1) Wrapper over Log4perl
2) System-wide Logging to File & Screen in INFO mode
3) DEBUG mode should have an option of either writing to Screen or debuglog file or both
4) Option to replicate debug log messages in system-wide logging if debug log is turned of.
Creating a package and using a log4 conf file with rootLogger in INFO mode and Logfile and Screen as appenders take care of requirement 1&2 however option third and fourth is tricky to incorporate. I have tried Filter match etc but cannot seem to get my head around effectively incorporating requirement 3 & 4.
Any suggestions would be greatly appreciate. Thanks in advance.
Cheers
MSW
_________________________________________________________________
Plug in to the MSN Tech channel for a full update on the latest gizmos that made an impact.
http://computing.in.msn.com/ |
|
From: Mike S. <m...@pe...> - 2009-01-20 16:25:28
|
On Tue, 20 Jan 2009, Karsten Heymann wrote: > We did that before but ran into problems with file rights (cgi-scripts > running with www-data, developers testing the scripts as themselves) > so we decided to go to use syslog as main logging target. You can fix the permission problem with the file appender's permission settings, but using a syslog appender is certainly an elegant solution to consolidate all logs on a single host. > This also allows us to use a centralized loghost, which together with > a web syslog front end, should make searching the logs much easier in > the long run. Although this would mean that a separate log file would > be created for *all* scripts called with this setup. Depends on your Log4perl and syslog settings, you can have it either way. You just need to find a way to set 'filename' (or the syslog category) in a way that makes sense for your environment -- you can cluster certain groups of scripts together by classifying them into the same categories and subcategories. -- Mike Mike Schilli m...@pe... |
|
From: Karsten H. <kar...@bl...> - 2009-01-20 14:20:41
|
Hi Mike, thanks for the reply! Mike Schilli <m...@pe...> writes: > On Mon, 19 Jan 2009, Karsten Heymann wrote: >> The scripts run on multiple hosts and belong to several sets of >> projects with different logging requirements. To simplify the >> setup, I'm trying to use only one L4p config file for the whole >> setup. First of all, is this common practise? > It's certainly possible to do that, you just need to weigh easy > deployment against maintainability of the config file. This might > work for two scripts, but if you have 100, it might become unwieldy. Okay, this forces me to rethink our logging architecture. > [...] one way of doing what you want would be using a file name > that depends on the calling script [...] We did that before but ran into problems with file rights (cgi-scripts running with www-data, developers testing the scripts as themselves) so we decided to go to use syslog as main logging target. This also allows us to use a centralized loghost, which together with a web syslog front end, should make searching the logs much easier in the long run. Although this would mean that a separate log file would be created for *all* scripts called with this setup. There also is another reason for a central l4p setup: All errors in production scripts are supposed to be logged in the same way (to allow some kind of automatic alarming). I don't want to repeat that part of the config for any l4p config file. >> What also is missing is the ability to source additional l4p >> files. This would allow to ship a unchanged master file on all >> servers and include a file with local changes at the end. From what >> I read this isn't possible, unless i did oversee something? > > Nobody stops you from reading in all *.conf files located in a conf > directory, lumping them together to a long string and feeding it to > Log4perl via ->init(\$string), but this will most likely be better > supported in the future. Good idea, I didn't think of that. Yours Karsten -- Karsten Heymann |
|
From: Mike S. <m...@pe...> - 2009-01-20 09:07:44
|
On Mon, 19 Jan 2009, Karsten Heymann wrote:
> The scripts run on multiple hosts and belong to several sets of
> projects with different logging requirements. To simplify the setup,
> I'm trying to use only one L4p config file for the whole setup. First
> of all, is this common practise?
It's certainly possible to do that, you just need to weigh easy
deployment against maintainability of the config file. This might work for
two scripts, but if you have 100, it might become unwieldy.
> Now if i want to log script 1's log messages into logfile 1 and script
> 2's into logfile 2, i can easily do so by separating the logs in the
> l4p config file. But I see no way to log the logs of Lib1 to the
> logfile of the script that uses the Lib.
This is probably a case where the config file's maintainability suffers
when you put too much logic into it, just for the sake of having one
file instead of several, but one way of doing what you want would be
using a file name that depends on the calling script:
# l4p.conf
filename = sub { basename($0) . ".log" }
log4perl.category= DEBUG, Logfile
log4perl.appender.Logfile = Log::Log4perl::Appender::File
log4perl.appender.Logfile.filename = ${filename}
log4perl.appender.Logfile.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.Logfile.layout.ConversionPattern = %d %F{1} %L> %m %n
and if you run a script "test.pl" like
use strict;
use File::Basename;
Log::Log4perl->init( "l4p.conf" );
DEBUG "foo";
INFO "bar";
then it will create an logfile "test.pl.log" while if you call the same
code from a script foobar.pl, it'll start logging in "foobar.pl.log".
> What also is missing is the ability to source additional l4p
> files. This would allow to ship a unchanged master file on all servers
> and include a file with local changes at the end. From what I read
> this isn't possible, unless i did oversee something?
Nobody stops you from reading in all *.conf files located in a
conf directory, lumping them together to a long string and feeding it to
Log4perl via ->init(\$string), but this will most likely be better
supported in the future.
-- Mike
Mike Schilli
m...@pe...
|
|
From: Karsten H. <kar...@bl...> - 2009-01-19 16:51:23
|
Hello,
I'm currently in the process of introducing Log4perl into a large
company application which consists of a number of perl scripts and
some common libraries. The scripts run on multiple hosts and belong to
several sets of projects with different logging requirements. To
simplify the setup, I'm trying to use only one L4p config file for the
whole setup. First of all, is this common practise?
One developer request which I cannot seem to handle with this setup is
that they want the log message of a script and all the libraries it
uses to go into one logfile:
#-
package Lib::Lib1;
...
my $log= get_logger();
#-
# script 1
Log::Log4perl->init("general.l4p");
use Lib::Lib1;
my $logger=get_logger($0);
#-
# script 2
Log::Log4perl->init("general.l4p");
use Lib::Lib1;
my $logger=get_logger($0);
#-
# general.l4p
log4perl.script1.logger = ...
log4perl.script2.logger = ...
log4perl.Lib.Lib1.logger = ...
#-
Now if i want to log script 1's log messages into logfile 1 and script
2's into logfile 2, i can easily do so by separating the logs in the
l4p config file. But I see no way to log the logs of Lib1 to the
logfile of the script that uses the Lib.
What also is missing is the ability to source additional l4p
files. This would allow to ship a unchanged master file on all servers
and include a file with local changes at the end. From what I read
this isn't possible, unless i did oversee something?
Any hints would be appreciated!
Yours
Karsten
--
Karsten Heymann
|