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: Lee G. <LGo...@UK...> - 2007-05-04 14:01:29
|
Looks like you don't have Log4perl installed, and I am unfamiliar with your installation - Active State Perl on Windows usually installs Log::Log4perl only on demand, and then puts it into a directory that ends with the path site/lib, not just lib. Can you do a system-wide search on your machine for the file Log4per.pm? =20 If you do not find it, you need to install it --- at a cmd prompt type the word "cpan", without quotes, and then at the resulting prompt, type "install Log::Log4perl" without quotes. =20 If you do find it, make a note of the directory that in which it was found, which should be something like =20 C:\weridpath\site\lib\Log\ =20 Take all but the last directory (ie. C:\perl\site\lib), and put it at the top of your script, before use Log::Log4perl, in quotes after the words "use lib": =20 use lib "C:\ weridpath\site\lib"; use Log::Log4perl; =20 If that doesn't help, you can reach me on this address on Tuesday. =20 Lee =20 ________________________________ From: log...@li... [mailto:log...@li...] On Behalf Of Hussainsab, Babu Sent: 04 May 2007 11:00 To: log...@li... Cc: bab...@ya... Subject: [log4perl-devel] Error While Executing log4perl programs =20 Hi, All Am getting the following error while executing the log4perl program while executing through perl express editor. =20 "Can't locate Log/Log4perl.pm in @INC (@INC contains: D:/Projects/PerlExecPath/ActivePerl-5.8/perl/site/lib D:/Projects/PerlExecPath/ActivePerl-5.8/perl/lib .) at OTEC_logger.pl line 3. BEGIN failed--compilation aborted at OTEC_logger.pl line 3. " Plz help me to resolve this. =20 Regards & Thanks Babu H.M =20 |
From: Lee G. <LGo...@UK...> - 2007-05-04 11:36:38
|
> From: log...@li... [mailto:log4perl-devel- > bo...@li...] On Behalf Of Kevin M. Goess >=20 > Johannes Kilian wrote: > > Hi Mike, > > > > a simple one-liner using Log::Log4Perl produces a lot of redefinitons. > What does this mean and how can I avoid it? (Longer programs produces this > output too when using Log::Log4perl and starting the script ... that's > annoying) > > (Using ActiveStatePerl 5.8.8.817 and Log::Log4Perl 1.06 or 1.10) > > > > C:\WINDOWS>perl -we "use Log::Log4Perl; print @INC;" >=20 > The package name is Log4perl with a lowercase 'p', not capital. I don't > have a windows box handy, but try that instead. I'd bet windows or > activestate is doing something fancy vis-a-vis windows' case insensitiviy. >=20 > perl -we "use Log::Log4perl; print @INC;" I have Windows XP box with AS Perl 5.8.8, which produces the following, if it helps: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\lgoddard>which perl.exe F:\dev\perl588\bin\perl.exe C:\Documents and Settings\lgoddard>perl -we "use Log::Log4perl; print @INC;" F:\dev\perl588\siteF:\dev\perl588\site\libF:/dev/perl588/site/libF:/dev/ perl588/ lib. C:\Documents and Settings\lgoddard> Lee |
From: Hussainsab, B. <bhu...@ve...> - 2007-05-04 10:00:12
|
Hi, All Am getting the following error while executing the log4perl program while executing through perl express editor. =20 "Can't locate Log/Log4perl.pm in @INC (@INC contains: D:/Projects/PerlExecPath/ActivePerl-5.8/perl/site/lib D:/Projects/PerlExecPath/ActivePerl-5.8/perl/lib .) at OTEC_logger.pl line 3. BEGIN failed--compilation aborted at OTEC_logger.pl line 3. " Plz help me to resolve this. =20 Regards & Thanks Babu H.M =20 |
From: Johannes K. <Joh...@vi...> - 2007-05-04 04:56:12
|
Hi Kevin, Kevin M. Goess schrieb: > Johannes Kilian wrote: > >> Hi Mike, >> >> a simple one-liner using Log::Log4Perl produces a lot of redefinitons. What does this mean and how can I avoid it? (Longer programs produces this output too when using Log::Log4perl and starting the script ... that's annoying) >> (Using ActiveStatePerl 5.8.8.817 and Log::Log4Perl 1.06 or 1.10) >> >> C:\WINDOWS>perl -we "use Log::Log4Perl; print @INC;" >> > > The package name is Log4perl with a lowercase 'p', not capital. I don't > have a windows box handy, but try that instead. I'd bet windows or > activestate is doing something fancy vis-a-vis windows' case insensitiviy. > > perl -we "use Log::Log4perl; print @INC;" > Thank you - that's it. Never thought it could be anything like this ... Johannes |
From: Kevin M. G. <cp...@go...> - 2007-05-03 16:39:16
|
Johannes Kilian wrote: > Hi Mike, > > a simple one-liner using Log::Log4Perl produces a lot of redefinitons. What does this mean and how can I avoid it? (Longer programs produces this output too when using Log::Log4perl and starting the script ... that's annoying) > (Using ActiveStatePerl 5.8.8.817 and Log::Log4Perl 1.06 or 1.10) > > C:\WINDOWS>perl -we "use Log::Log4Perl; print @INC;" The package name is Log4perl with a lowercase 'p', not capital. I don't have a windows box handy, but try that instead. I'd bet windows or activestate is doing something fancy vis-a-vis windows' case insensitiviy. perl -we "use Log::Log4perl; print @INC;" |
From: Johannes K. <Joh...@vi...> - 2007-05-03 14:07:30
|
Hi Mike, a simple one-liner using Log::Log4Perl produces a lot of redefinitons. What does this mean and how can I avoid it? (Longer programs produces this output too when using Log::Log4perl and starting the script ... that's annoying) (Using ActiveStatePerl 5.8.8.817 and Log::Log4Perl 1.06 or 1.10) Thanks Johannes ----------------------- C:\WINDOWS>perl -we "use Log::Log4Perl; print @INC;" Constant subroutine Log::Log4perl::_INTERNAL_DEBUG redefined at C:/Programme/Perl/lib/constant.pm line 103. Subroutine import redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 69. Subroutine initialized redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 207. Subroutine new redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 213. Subroutine reset redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 220. Subroutine init_once redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 227. Subroutine init redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 234. Subroutine init_and_watch redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 248. Subroutine easy_init redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 263. Subroutine get_logger redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 337. Subroutine appenders redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 359. Subroutine appender_thresholds_adjust redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 365. Subroutine appender_by_name redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 403. Subroutine eradicate_appender redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 420. Subroutine infiltrate_lwp redefined at C:/Programme/Perl/site/lib/Log/Log4Perl.pm line 428. C:/Programme/Perl/libC:/Programme/Perl/site/lib. |
From: Lee G. <LGo...@UK...> - 2007-05-03 08:37:38
|
Looks like the just the ticket, thanks very much, and so for not finding it myself... Lee > -----Original Message----- > From: Mike Schilli [mailto:m...@pe...] > Sent: 02 May 2007 23:14 > To: Lee Goddard > Cc: log...@li... > Subject: Re: [log4perl-devel] Adjust config at runtime? >=20 > On Wed, 2 May 2007, Lee Goddard wrote: >=20 > > Some of my apps have an inline Log4perl configuration, which some > > routines and external tests would like to change - nothing big, just a > > change to which modules/components report, and/or which log levels are > > active. >=20 > There's ways to modify an existing Log4perl configuration after it > has been initialized, e.g. see >=20 > http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#92664 >=20 > on how to modify an appender or >=20 > http://log4perl.sourceforge.net/d/Log/Log4perl.html#1d6b5 >=20 > on modifying the configuration. I don't know your specific requirements, > but I bet that you could accomplish what you need with a configuration > file/variable using dynamic values: >=20 > http://log4perl.sourceforge.net/d/Log/Log4perl.html#5b4c0 >=20 > -- Mike >=20 > Mike Schilli > m...@pe... |
From: Mike S. <m...@pe...> - 2007-05-02 22:14:29
|
On Wed, 2 May 2007, Lee Goddard wrote: > Some of my apps have an inline Log4perl configuration, which some > routines and external tests would like to change - nothing big, just a > change to which modules/components report, and/or which log levels are > active. There's ways to modify an existing Log4perl configuration after it has been initialized, e.g. see http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#92664 on how to modify an appender or http://log4perl.sourceforge.net/d/Log/Log4perl.html#1d6b5 on modifying the configuration. I don't know your specific requirements, but I bet that you could accomplish what you need with a configuration file/variable using dynamic values: http://log4perl.sourceforge.net/d/Log/Log4perl.html#5b4c0 -- Mike Mike Schilli m...@pe... |
From: Lee G. <LGo...@UK...> - 2007-05-02 11:52:05
|
Hi, =20 This may be a very silly question but please help: =20 Some of my apps have an inline Log4perl configuration, which some routines and external tests would like to change - nothing big, just a change to which modules/components report, and/or which log levels are active. =20 Thanks in anticipation Lee=20 =20 |
From: Mike S. <m...@pe...> - 2007-04-20 00:31:13
|
Interesting claim by a module called Log::Cabin on CPAN :). -- Mike Mike Schilli m...@pe... ---------- Forwarded message ---------- From: Mike Schilli <m...@pe...> To: Robert Hicks <rob...@ma...> Cc: m...@pe... Subject: Re: A question on disk usage... Date: Thu, 19 Apr 2007 15:19:30 -0700 (PDT) On Thu, 19 Apr 2007, Robert Hicks wrote: > Log::XXX provides a selection of the features of Log::Log4perl but > with a focus on reduced disk IO. Just calling 'use Log::Log4perl' > results in hundreds of stat calls to the file system. If you have a > shared file system with many nodes running perl scripts at once, this > could result in a significant decrease in performance. Interesting, never heard of this claim before. Let's look at the facts: Perl does a lot of stat() calls because of the way it searches for modules in the %INC path: $ strace perl -MFoo::Bar::Baz -e1 2>&1 | grep stat64 | wc -l 54 So for a *non-existent* module, you get 54 stat() calls! Let's try the same thing with Log::Log4perl: $ strace perl -MLog::Log4perl -e1 2>&1 | grep stat64 | wc -l 151 Definitely more, but I've never seen that to be a problem. However, if you run short scripts on NFS in quick succession, I can see that to be a problem. Which we could resolve easily by offering something like use Log::Log4perl qw(:fast); implementing lazy loading. As a matter of fact, I'm gonna put that on the list for one of the next releases. > After implementing this module we were able to cut up to 70,000 stat/ > open calls per second on our NFS. That's an odd claim, because it says nothing about how many stat calls there were before and after. If it got improved by only 10%, then the new module is useless. And, as I've already mentioned, there can be a negative impact if you have many calls to short scripts -- in which case you should be running a persistent perl interpreter like mod_perl or pperl and get rid of module loading I/O entirely. > Of course, this module doesn't > currently support all the features of Log::Log4perl, but many of the > most comment ones are implemented. Would be interesting to know how much functionality is actually implemented and if it's any different than the 20 other log modules on CPAN :). Do you happen to know more about where it's available? Would you be ok if I forwarded this email to the L4p mailing list? Thanks for the note! -- Mike Mike Schilli m...@pe... |
From: Mike S. <m...@pe...> - 2007-04-12 06:20:13
|
On Wed, 11 Apr 2007, Ulf-D. Ehlert wrote: > there's a bug in the Log-Log4perl documentaion: > According to the Log::Log4perl man page, 'Log::Log4perl::MDC->get($key)' > "... will return the string '[undef]'", if "no value has been > stored previously under $key". > The man page (and code) of "Log::Log4perl::MDC" says: > "If no value exists to the given key, 'undef' is returned." > It seems that "MDC->get()" can safely return "undef"; "%X{undefined}" will > still print the *string* "[undef]". Good catch, I've changed the text to read in the next release: Index: Log4perl.pm =================================================================== RCS file: /cvsroot/log4perl/Log-Log4perl/lib/Log/Log4perl.pm,v retrieving revision 1.225 diff -r1.225 Log4perl.pm 2036,2037c2036 < will return the string C<"[undef]"> to allow for easy string interpolation < later on. --- > will return C<undef>. 2040,2041c2039,2042 < in C<Log::Log4perl::Layout::PatternLayout>. < For example, an application taking a web request might store the remote host --- > in C<Log::Log4perl::Layout::PatternLayout>. If the C<get()> method > returns C<undef>, the placeholder will expand to the string C<[undef]>. > > An application taking a web request might store the remote host Thanks for reporting this! -- Mike Mike Schilli m...@pe... > > The same is true for "NDC-get()"... > > Regards, > Ulf > _______________________________________________________________ > SMS schreiben mit WEB.DE FreeMail - einfach, schnell und > kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192 > > > ------------------------------------------------------------------------- > 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: Olaf H. <ola...@ph...> - 2007-04-11 20:35:08
|
... > I see these errors: > > Couldn't remove semaphore set 23789588: Identifier removed at > source.pl line 0 > Couldn't remove shared memory segment 23789588: Invalid argument at > source.pl line 0 > IMHO adding the following line to your config ... log4perl.appender.SyncScreen.options = sub { { create => 1, destroy => 0 } } ... should solve the issue. The 'destroy' attribute controls whether the semaphore will be removed while a process is going to terminate. With the given additional line the semaphore survives. (You can check this also with 'ipcs' tool.) If this is a problem for you then your altruistic good parent process ;-) will have to clean it up at the very end. Regards, Olaf |
From: Ulf-D. E. <nos...@sp...> - 2007-04-11 18:52:13
|
Hello, there's a bug in the Log-Log4perl documentaion: According to the Log::Log4perl man page, 'Log::Log4perl::MDC->get($key)' "... will return the string '[undef]'", if "no value has been stored previously under $key". The man page (and code) of "Log::Log4perl::MDC" says: "If no value exists to the given key, 'undef' is returned." It seems that "MDC->get()" can safely return "undef"; "%X{undefined}" will still print the *string* "[undef]". The same is true for "NDC-get()"... Regards, Ulf _______________________________________________________________ SMS schreiben mit WEB.DE FreeMail - einfach, schnell und kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192 |
From: Mike S. <m...@pe...> - 2007-03-28 04:50:34
|
Hi Log4perl enthusiasts, the 1.10 maintenance release has been pushed to the log4perl.sf.net website. Here's the release notes: 1.10 (2007/03/27) * (kg) Nikita Dedik pointed out that Saturday is missing from @Log::Log4perl::DateFormat::WEEK_DAYS * (ms) Scott Cline noticed a potential problem with the DBI appender reconnection logic in 'buffered' mode. Applied a patch. * (ms) Changed DBI reconnect logic to perform even if the DB is pingable again. * (ms) Applied code by Valerio Valdez Paolini with modifications to PropertyConfigurator.pm to allow pulling values from the property configurator by path. If all goes well, it'll go to CPAN in a couple of days. Enjoy! -- Mike Mike Schilli m...@pe... |
From: Livshits, A. G. <Ale...@rb...> - 2007-03-23 13:27:32
|
Yes, this is exactly what I wished for!!! I can reuse existing subs to=0D= =0Aprint into log4perl logger file=2E Thanks a lot=2E=0D=0A=0D=0A-----Origi= nal Message-----=0D=0AFrom: Mike Schilli [mailto:m@perlmeister=2Ecom] =0D= =0ASent: Friday, March 23, 2007 1:47 AM=0D=0ATo: Livshits, Alex, GCM=0D=0AC= c: log4perl-devel@lists=2Esourceforge=2Enet=0D=0ASubject: Re: [log4perl-dev= el] How to print to log file via file handle=0D=0Aor stderr, stdout?=0D=0A= =0D=0A=0D=0AOn Thu, 22 Mar 2007, Livshits, Alex, GCM wrote:=0D=0A=0D=0A> I = got standard error header message printing environment variables=0D=0Awhich= =0D=0A> takes either file handle or stdout, stderr=2E What's the way to pri= nt it=0D=0A> to the logger?=0D=0A=0D=0ALet me summarize to make sure I unde= rstand correctly: You have a=0D=0Afunction=0D=0Athat prints to a filehandle= =2E You want to tie into that filehandle and=0D=0Aforward all arriving mess= ages to a Log4perl logger=2E=0D=0A=0D=0AFirst, let's write a package that t= ies a file handle and forwards it=0D=0Ato a Log4perl logger:=0D=0A=0D=0A = package FileHandleLogger;=0D=0A use Log::Log4perl qw(:levels get_logger= );=0D=0A=0D=0A sub TIEHANDLE {=0D=0A my($class, %options) =3D @_;= =0D=0A=0D=0A my $self =3D {=0D=0A level =3D> $DEBUG,=0D= =0A category =3D> '',=0D=0A %options=0D=0A };=0D= =0A=0D=0A $self->{logger} =3D get_logger($self->{category}),=0D=0A = bless $self, $class;=0D=0A }=0D=0A=0D=0A sub PRINT {=0D=0A = my($self, @rest) =3D @_;=0D=0A $Log::Log4perl::caller_depth++;=0D= =0A $self->{logger}->log($self->{level}, @rest);=0D=0A $Log::= Log4perl::caller_depth--;=0D=0A }=0D=0A=0D=0A sub PRINTF {=0D=0A = my($self, $fmt, @rest) =3D @_;=0D=0A $Log::Log4perl::caller_depth= ++;=0D=0A $self->PRINT(sprintf($fmt, @rest));=0D=0A $Log::Log= 4perl::caller_depth--;=0D=0A }=0D=0A=0D=0A 1;=0D=0A=0D=0ANow, if you = have a function like=0D=0A=0D=0A sub function_printing_to_fh {=0D=0A = my($fh) =3D @_;=0D=0A printf $fh "Hi there!\n";=0D=0A }=0D=0A= =0D=0Awhich takes a filehandle and prints something to it, it can be used= =0D=0Awith Log4perl:=0D=0A=0D=0A use Log::Log4perl qw(:easy);=0D=0A u= sa FileHandleLogger;=0D=0A=0D=0A Log::Log4perl->easy_init($DEBUG);=0D=0A= =0D=0A tie *SOMEHANDLE, 'FileHandleLogger' or=0D=0A die "tie fail= ed ($!)";=0D=0A=0D=0A function_printing_to_fh(*SOMEHANDLE);=0D=0A = # prints "2007/03/22 21:43:30 Hi there!"=0D=0A=0D=0AIf you want, you can e= ven specify a different log level or category:=0D=0A=0D=0A tie *SOMEHAND= LE, 'FileHandleLogger',=0D=0A level =3D> $INFO, category =3D> "Foo::= Bar" or die "tie failed ($!)";=0D=0A=0D=0AIs this what you're looking for?= =0D=0A=0D=0A-- Mike=0D=0A=0D=0AMike Schilli=0D=0Am@perlmeister=2Ecom=0D=0A= =0D=0A-----------------------------------------=0D=0A**********************= *********************************************=0D=0A*=0D=0A=0D=0AThis e-mail= is intended only for the addressee named above=2E=0D=0AAs this e-mail may = contain confidential or privileged information,=0D=0Aif you are not the nam= ed addressee, you are not authorized=0D=0Ato retain, read, copy or dissemin= ate this message or any part of=0D=0Ait=2E=0D=0A=0D=0A*********************= **********************************************=0D=0A*=0D=0A |
From: Mike S. <m...@pe...> - 2007-03-23 05:46:56
|
On Thu, 22 Mar 2007, Livshits, Alex, GCM wrote: > I got standard error header message printing environment variables which > takes either file handle or stdout, stderr. What's the way to print it > to the logger? Let me summarize to make sure I understand correctly: You have a function that prints to a filehandle. You want to tie into that filehandle and forward all arriving messages to a Log4perl logger. First, let's write a package that ties a file handle and forwards it to a Log4perl logger: package FileHandleLogger; use Log::Log4perl qw(:levels get_logger); sub TIEHANDLE { my($class, %options) = @_; my $self = { level => $DEBUG, category => '', %options }; $self->{logger} = get_logger($self->{category}), bless $self, $class; } sub PRINT { my($self, @rest) = @_; $Log::Log4perl::caller_depth++; $self->{logger}->log($self->{level}, @rest); $Log::Log4perl::caller_depth--; } sub PRINTF { my($self, $fmt, @rest) = @_; $Log::Log4perl::caller_depth++; $self->PRINT(sprintf($fmt, @rest)); $Log::Log4perl::caller_depth--; } 1; Now, if you have a function like sub function_printing_to_fh { my($fh) = @_; printf $fh "Hi there!\n"; } which takes a filehandle and prints something to it, it can be used with Log4perl: use Log::Log4perl qw(:easy); usa FileHandleLogger; Log::Log4perl->easy_init($DEBUG); tie *SOMEHANDLE, 'FileHandleLogger' or die "tie failed ($!)"; function_printing_to_fh(*SOMEHANDLE); # prints "2007/03/22 21:43:30 Hi there!" If you want, you can even specify a different log level or category: tie *SOMEHANDLE, 'FileHandleLogger', level => $INFO, category => "Foo::Bar" or die "tie failed ($!)"; Is this what you're looking for? -- Mike Mike Schilli m...@pe... |
From: Livshits, A. G. <Ale...@rb...> - 2007-03-22 22:05:31
|
I got standard error header message printing environment variables which=0D= =0Atakes either file handle or stdout, stderr=2E What's the way to print it= =0D=0Ato the logger? =0D=0A=0D=0A=0D=0A=0D=0AThanks,=0D=0AAlex Livshits=0D= =0A=0D=0A=0D=0A=0D=0A=0D=0A=0D=0A-----------------------------------------= =0D=0A*******************************************************************= =0D=0A*=0D=0A=0D=0AThis e-mail is intended only for the addressee named abo= ve=2E=0D=0AAs this e-mail may contain confidential or privileged informatio= n,=0D=0Aif you are not the named addressee, you are not authorized=0D=0Ato = retain, read, copy or disseminate this message or any part of=0D=0Ait=2E=0D= =0A=0D=0A******************************************************************= *=0D=0A*=0D=0A |
From: Mike S. <m...@pe...> - 2007-03-22 20:11:12
|
On Thu, 22 Mar 2007, Livshits, Alex, GCM wrote: > Please let me know your opinion of the principal advantages of > Log4perl comparing to Log::ErrLogger ( http://backpan.perl.org/authors/id/W/WO/WORENKD/Log-ErrLogger- > > 1.5.readme ) ... from our FAQ: Why use Log::Log4perl instead of any other logging module on CPAN? That's a good question. There's dozens of logging modules on CPAN. When it comes to logging, people typically think: ``Aha. Writing out debug and error messages. Debug is lower than error. Easy. I'm gonna write my own.'' Writing a logging module is like a rite of passage for every Perl programmer, just like writing your own templating system. Of course, after getting the basics right, features need to be added. You'd like to write a timestamp with every message. Then timestamps with microseconds. Then messages need to be written to both the screen and a log file. And, as your application grows in size you might wonder: Why doesn't my logging system scale along with it? You would like to switch on logging in selected parts of the application, and not all across the board, because this kills performance. This is when people turn to Log::Log4perl, because it handles all of that. Avoid this costly switch. Use Log::Log4perl right from the start. Log::Log4perl's :easy mode supports easy logging in simple scripts: use Log::Log4perl qw(:easy); Log::Log4perl->easy_init($DEBUG); DEBUG "A low-level message"; ERROR "Won't make it until level gets increased to ERROR"; And when your application inevitably grows, your logging system grows with it without you having to change any code. Please, don't re-invent logging. Log::Log4perl is here, it's easy to use, it scales, and covers many areas you haven't thought of yet, but will enter soon. http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#eaf02 -- Mike Mike Schilli m...@pe... |
From: Mike S. <m...@pe...> - 2007-03-22 20:02:15
|
On Thu, 22 Mar 2007, Kevin M. Goess wrote: > Or maybe look for Log::Dispatch's first, to maintain current behavior, > and use Log4perl's own appenders if Log::Dispatch's aren't there? Yeah, that sounds like the right thing to do in order to maintain backward compatibility. -- Mike Mike Schilli m...@pe... > Mike Schilli wrote: > > On Mon, 19 Mar 2007, Withers John Z wrote: > > > >> Thanks for the clarification. I was able to use > >> Log4perl::Appender::Screen directly. However, my original thinking was > >> that the logging properties would be shared between Java programs and > >> PERL scripts. ... This give me two (2) sets of nearly identical properties to > >> maintain. > > > > If you have both Java and Perl programs and you want them to share > > a common log4perl/j configuration, that's definitely the way to go. > > > > In this case, however, you need to add Log::Dispatch from CPAN. > > Is there any reason we shouldn't upgrade the JavaMap stuff to use > Log4perl's own appenders where appropriate? The behavior should be > exactly the same, right? > |
From: Kevin M. G. <cp...@go...> - 2007-03-22 15:34:51
|
Mike Schilli wrote: > On Mon, 19 Mar 2007, Withers John Z wrote: > >> Thanks for the clarification. I was able to use >> Log4perl::Appender::Screen directly. However, my original thinking was >> that the logging properties would be shared between Java programs and >> PERL scripts. ... This give me two (2) sets of nearly identical properties to >> maintain. > > If you have both Java and Perl programs and you want them to share > a common log4perl/j configuration, that's definitely the way to go. > > In this case, however, you need to add Log::Dispatch from CPAN. Is there any reason we shouldn't upgrade the JavaMap stuff to use Log4perl's own appenders where appropriate? The behavior should be exactly the same, right? Or maybe look for Log::Dispatch's first, to maintain current behavior, and use Log4perl's own appenders if Log::Dispatch's aren't there? Any opinions? |
From: Kevin M. G. <cp...@go...> - 2007-03-22 15:31:30
|
ondrej par wrote: > I'd like to use the same XML configuration for both log4j and > log4perl. However, Log4perl (version 1.09) seems to use the mapping > "org.apache.log4j.SyslogAppender" for SyslogAppender, while the > correct name in log4j (version 1.2.14) is > "org.apache.log4j.net.SyslogAppender". > > Would it be possible, please, to add an extra mapping for this class? I'll check that out. Meanwhile you should be able to do something like this after you load Log4Perl: $Log::Log4perl::JavaMap::user_defined {'org.apache.log4j.net.SyslogAppender'} = 'Log::Log4perl::JavaMap::SyslogAppender'; |
From: Livshits, A. G. <Ale...@rb...> - 2007-03-22 14:59:03
|
Hi,=0D=0APlease let me know your opinion of the principal advantages of Log= 4perl=0D=0Acomparing to Log::ErrLogger (=0D=0Ahttp://backpan=2Eperl=2Eorg/= authors/id/W/WO/WORENKD/Log-ErrLogger-1=2E5=2Ereadme=0D=0A)=0D=0A=0D=0A=0D= =0AThanks,=0D=0AAlex Livshits=0D=0A=0D=0A=0D=0A=0D=0A=0D=0A=0D=0A----------= -------------------------------=0D=0A**************************************= *****************************=0D=0A*=0D=0A=0D=0AThis e-mail is intended onl= y for the addressee named above=2E=0D=0AAs this e-mail may contain confiden= tial or privileged information,=0D=0Aif you are not the named addressee, yo= u are not authorized=0D=0Ato retain, read, copy or disseminate this message= or any part of=0D=0Ait=2E=0D=0A=0D=0A*************************************= ******************************=0D=0A*=0D=0A |
From: ondrej p. <ond...@gm...> - 2007-03-21 22:28:49
|
Hi all, I'd like to use the same XML configuration for both log4j and log4perl. However, Log4perl (version 1.09) seems to use the mapping "org.apache.log4j.SyslogAppender" for SyslogAppender, while the correct name in log4j (version 1.2.14) is "org.apache.log4j.net.SyslogAppender". Would it be possible, please, to add an extra mapping for this class? Thanks, Ondrej |
From: Mike S. <m...@pe...> - 2007-03-21 06:06:09
|
On Mon, 19 Mar 2007, Withers John Z wrote: > Thanks for the clarification. I was able to use > Log4perl::Appender::Screen directly. However, my original thinking was > that the logging properties would be shared between Java programs and > PERL scripts. It appeared that the Log4J configuration was necessary to > make this work. I could always defined the PERL logger using > log4per.appender.APPLOG and the Java logger using log4j.appender.APPLOG, > but this give me two (2) sets of nearly identical properties to > maintain. If you have both Java and Perl programs and you want them to share a common log4perl/j configuration, that's definitely the way to go. In this case, however, you need to add Log::Dispatch from CPAN. -- Mike Mike Schilli m...@pe... > > John > > John Withers > > -----Original Message----- > From: Mike Schilli [mailto:m...@pe...] > Sent: Sunday, March 18, 2007 1:46 AM > To: Withers John Z > Cc: log...@li... > Subject: Re: [log4perl-devel] Bugs in Log::Log4perl::JavaMap > > On Fri, 16 Mar 2007, Withers John Z wrote: > > > I've encountered what appear to be bugs in Log::Log4perl::JavaMap/* > > (version 1.09). > > > > When the property file includes: > > > > log4j.appender.APPLOG = or.apache.log4j.ConsoleAppender > > > > My PERL script fails because Log/Dispatch/Screen.pm can't be located. > > It isn't included with the distribution. It appears that > > Log::Log4perl::JavaMap::ConsoleAppender.pm (and others) maps the > > property value to the wrong class. > > Log::Log4perl::JavaMap::ConsoleAppender->new tries to map to > > Log::Dispatch::Screen when it probably should map to > > Log::Log4perl::Appender::Screen. > > Hi John, > > the JavaMap ConsoleAppender dates back to the days when Log4perl didn't > have its own screen appender, so it uses Log::Dispatch::Screen. It > doesn't come with the Log4perl distribution, but it can be downloaded > from CPAN: > > > http://search.cpan.org/~drolsky/Log-Dispatch-2.16/lib/Log/Dispatch.pm > > Of course, you could just use Log::Log4perl::Appender::Screen directly, > any particular reason why you're using the JavaMap? Not that there's > anything wrong with it, I'm just curious. > > -- Mike > > Mike Schilli > m...@pe... > |
From: Withers J. Z <Joh...@ir...> - 2007-03-19 13:16:30
|
Mike, Thanks for the clarification. I was able to use Log4perl::Appender::Screen directly. However, my original thinking was that the logging properties would be shared between Java programs and PERL scripts. It appeared that the Log4J configuration was necessary to make this work. I could always defined the PERL logger using log4per.appender.APPLOG and the Java logger using log4j.appender.APPLOG, but this give me two (2) sets of nearly identical properties to maintain. John John Withers=20 -----Original Message----- From: Mike Schilli [mailto:m...@pe...]=20 Sent: Sunday, March 18, 2007 1:46 AM To: Withers John Z Cc: log...@li... Subject: Re: [log4perl-devel] Bugs in Log::Log4perl::JavaMap On Fri, 16 Mar 2007, Withers John Z wrote: > I've encountered what appear to be bugs in Log::Log4perl::JavaMap/* > (version 1.09). > > When the property file includes: > > log4j.appender.APPLOG =3D or.apache.log4j.ConsoleAppender > > My PERL script fails because Log/Dispatch/Screen.pm can't be located. > It isn't included with the distribution. It appears that > Log::Log4perl::JavaMap::ConsoleAppender.pm (and others) maps the > property value to the wrong class. > Log::Log4perl::JavaMap::ConsoleAppender->new tries to map to > Log::Dispatch::Screen when it probably should map to > Log::Log4perl::Appender::Screen. Hi John, the JavaMap ConsoleAppender dates back to the days when Log4perl didn't have its own screen appender, so it uses Log::Dispatch::Screen. It doesn't come with the Log4perl distribution, but it can be downloaded from CPAN: =20 http://search.cpan.org/~drolsky/Log-Dispatch-2.16/lib/Log/Dispatch.pm Of course, you could just use Log::Log4perl::Appender::Screen directly, any particular reason why you're using the JavaMap? Not that there's anything wrong with it, I'm just curious. -- Mike Mike Schilli m...@pe... |