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: Alexeeva,
Alexandra \(G. I. Technology\) <Ale...@ml...> - 2008-07-18 12:51:54
|
Hello, We have an issue with log4perl installation on Windows. For some security restrictions on Internet connections prm program can not access log4perl web page and the command Prm> repository add http://log4perl.sourceforge.net/ppm does not work. Is there any way to deploy this package manually transmit to the service and invoke the installation process manually. Thanks a lot, Best regards, Alexandra Alexeeva Merrill Lynch Bank Swiss, GPC International Technology -------------------------------------------------------- This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. -------------------------------------------------------- |
From: Mike S. <m...@pe...> - 2008-07-16 21:59:13
|
On Wed, 16 Jul 2008, Johannes Kilian wrote: > probably a simple question, but I cannot figure it out: > > I have configured a logger for category "Test" to log all DEBUG messages - but for one child-category "Test.child1" I only want the INFO messages. > > What I tried is: > --- > log4j.logger.Test=DEBUG, MyFileAppender > log4j.logger.Test.Child1=INFO, MyFileAppender > > log4j.additivity.Test=true > log4j.additivity.Test.Child1=false Looks good to me: use Log::Log4perl qw(:easy); Log::Log4perl->init(\ q{ log4j.logger.Test=DEBUG, Screen log4j.logger.Test.Child1=INFO, Screen log4j.additivity.Test=true log4j.additivity.Test.Child1=false log4j.appender.Screen = Log::Log4perl::Appender::Screen log4j.appender.Screen.layout = SimpleLayout }); get_logger("Test")->debug("test debug log"); get_logger("Test")->info("test info log"); get_logger("Test::Child1")->debug("child1 debug log"); get_logger("Test::Child1")->info("child1 info log"); yields DEBUG - test debug log INFO - test info log INFO - child1 info log Isn't that what you'd expect? -- Mike Mike Schilli m...@pe... |
From: Johannes K. <Jo....@gm...> - 2008-07-16 08:19:59
|
Hi, probably a simple question, but I cannot figure it out: I have configured a logger for category "Test" to log all DEBUG messages - but for one child-category "Test.child1" I only want the INFO messages. What I tried is: --- log4j.logger.Test=DEBUG, MyFileAppender log4j.logger.Test.Child1=INFO, MyFileAppender log4j.additivity.Test=true log4j.additivity.Test.Child1=false --- but this didn't work .... How to achieve my goal? Johannes -- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger |
From: Mike S. <m...@pe...> - 2008-07-16 05:14:54
|
Hey all, unless you've been living under the rock for the last year, you've probably heard of Moose. You know, the new red-hot object oriented framework for Perl that kind of gives you some object-oriented conveniences that will be available with Perl6, just with Perl5. Now, it's long bothering me that we use macros like DEBUG "Waah!" and pollute the namespace (upon request, not by default, as I'd like to mention in our defense), but wouldn't it be nice to add Log4perl to a class, not by inheritence, but via some "aspect" or "role"? Well, wait no longer. "MooseX::Log::Log4perl" is here, which lets you do stuff like package Ferrari; use Moose; with 'MooseX::Log::Log4perl'; sub start { my ($self) = @_; $self->log->debug("Starting up!"); } hence adding a log() method to any class that needs logging, which gives you a logger, which lets you run all of Log4perl's awesomeness you've been taking for granted. And, that's not all: Anonymous sources (cough!) have suggested that "easy" shortcuts like log_debug() be added, which Roland Lammel, who wrote this masterpiece, promptly did: package Ferrari; use Moose; with 'MooseX::Log::Log4perl::Easy'; sub foo { my ($self) = @_; $self->log_debug("Starting up!"); } Isn't this great? I suggest you try it out (along with Moose, it's really cool stuff) and rate it on http://cpanratings.perl.org/rate/?distribution=MooseX-Log-Log4perl if you like it. Have fun with Moose! -- Mike Mike Schilli m...@pe... |
From: Ronald F. <yn...@mm...> - 2008-06-20 10:45:41
|
On Thu, 19 Jun 2008 10:19:26 -0700 (PDT), "Mike Schilli" <m...@pe...> said: > > Does someone know whether it is possible to have the level > > printed when using PatternLayout? > > Sure, that's easy: > > $ perldoc Log::Log4perl::Layout::PatternLayout > > ... > %p Priority of the logging event > ... Priority! Thanks a lot, I had overlooked this! Ronald -- Ronald Fischer <ro...@em...> + If a packet hits a pocket on a socket on a port, + and the bus is interrupted and the interrupt's not caught, + then the socket packet pocket has an error to report. + (cited after Peter van der Linden) |
From: Mike S. <m...@pe...> - 2008-06-19 17:19:33
|
On Thu, 19 Jun 2008, Ronald Fischer wrote: > > I'm currently initializing my logger like this: > > Log::Log4perl->easy_init( > {level => $log_level, > file => ($ENV{ARTS_LOG}||'STDOUT'), > layout => '%M(%L) %m%n' > } > ); > > I would like to include some indication of the log level in the layout, > for instance that it says "ERROR" or "DEBUG" in the beginning. In the > perldoc I didn't find any layout option which would let me indicate the > log level. Does someone know whether it is possible to have the level > printed when using PatternLayout? Sure, that's easy: $ perldoc Log::Log4perl::Layout::PatternLayout ... %p Priority of the logging event ... -- Mike Mike Schilli m...@pe... > > Regards > > Ronald > -- > Ronald Fischer <ro...@em...> > + If a packet hits a pocket on a socket on a port, > + and the bus is interrupted and the interrupt's not caught, > + then the socket packet pocket has an error to report. > + (cited after Peter van der Linden) > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |
From: Ronald F. <yn...@mm...> - 2008-06-19 12:33:26
|
Hello, I'm currently initializing my logger like this: Log::Log4perl->easy_init( {level => $log_level, file => ($ENV{ARTS_LOG}||'STDOUT'), layout => '%M(%L) %m%n' } ); I would like to include some indication of the log level in the layout, for instance that it says "ERROR" or "DEBUG" in the beginning. In the perldoc I didn't find any layout option which would let me indicate the log level. Does someone know whether it is possible to have the level printed when using PatternLayout? Regards Ronald -- Ronald Fischer <ro...@em...> + If a packet hits a pocket on a socket on a port, + and the bus is interrupted and the interrupt's not caught, + then the socket packet pocket has an error to report. + (cited after Peter van der Linden) |
From: Mike S. <m...@pe...> - 2008-06-08 19:14:38
|
On Tue, 27 May 2008, Craig wrote: > Sorry, I didn't understand the internals of the library. I didn't > think of it as a series of gates. Rather, I thought each logger > category was independent of the others. Reading the docs more > completely, it is obvious that isn't true. (Inheritance wouldn't work > if that were true.) Right, loggers in different parts of the hierarchy are independent of each other, while loggers that share the same lineage inherit from each other, you get this 'message bubbling up' effect. Filters, on the other hand, are separate from loggers and are associated with appenders to give them the opportunity to make a last deciding call on whether to log a message approved by a logger or not. > > Why aren't you simply setting the logger to the lowest level you're > > interested in (INFO if I understood correctly) and handle the > > messages you don't want in the appenders with a threshold setting? > > There are 3 distinct logging parts: > 1. all warnings to stderr > 2. all warnings to the user (stdout) > 3. ongoing logging of what the app has done > > I would like a file that contains data on what the app did, what it > touched, how long it took ,etc. (FYI, this is #3.) But, the user > shouldn't be shown a bunch of data that he a) doesn't care about and b) > doesn't understand. It would probably confuse him. :) No problem at all, that's exactly what you can do with filters. > This is all easy. The twist is that I would like to be able to pass in > a "verbosity level" and with that change the log level for just > stdout. That makes it much easier for me to debug problems if/when > they arise. I usually do that by switching to a more chatty log4perl configuration when I see that the user specified the '--verbose' or '-v' option. You can either have a separate log4perl config file or use a string to initialize log4perl. > While thinking about this over the weekend, I figured this may be > possible by setting a filter function on stdout. That function would > look at the verbosity level. > > Then stderr and the app log would have their own filters set to WARN and > INFO. Then the root logger would be set to TRACE. Seems like a lot of > overhead, but it is ONE way to get a fair amount of configuration pretty > simply. That's the way to go! :) -- Mike Mike Schilli m...@pe... |
From: Kristis M. <kri...@as...> - 2008-06-07 21:13:58
|
On Sat, 2008-06-07 at 13:18 -0700, Mike Schilli wrote: > If you'd rather like a two-argument function that takes a message and an > error code, you can write a wrapper library around Log4perl that does > exactly that, just increase $Log::Log4perl::caller_depth: > > http://log4perl.sourceforge.net/d/Log/Log4perl.html#6acb7 Oh, that's precisely what I want. Many thanks Mike. This is great! |
From: Mike S. <m...@pe...> - 2008-06-07 20:18:08
|
On Thu, 5 Jun 2008, Kristis Makris wrote: > Would it make sense to have another interface that allows one to > specify the exit value ? Doing the following e.g. > $Log::Log4perl::LOGEXIT_CODE = 113; > $logger->logdie( "my message" ); > Is still two lines of code instead of one. I was hoping for the > possibility that a function like: > $logger->logdie ( "my message", 113 ); That won't work, as passing multiple arguments to any logger function has a different meaning already: http://log4perl.sourceforge.net/d/Log/Log4perl/Appender.html#30d43 > In particular, I'm trying to "format" messages before I emit them > through the logger. This requires me to always call something like: > $logger->error ( my_special_function_that_formats_the_message > ( $error_value, "my message") ); > and I'm trying to avoid calling > $logger->error ( my_special_function_that_formats_the_message > ( $error_value, "my message") ) && exit $error_value; > This all looks and feel dirty. I'd rather use MDC and a PatternLayout for that: http://log4perl.sourceforge.net/d/Log/Log4perl.html#4b5b3 If you'd rather like a two-argument function that takes a message and an error code, you can write a wrapper library around Log4perl that does exactly that, just increase $Log::Log4perl::caller_depth: http://log4perl.sourceforge.net/d/Log/Log4perl.html#6acb7 -- Mike Mike Schilli m...@pe... > I'm essentially constructing parts of the ConversionPattern (perhaps > there's a better way to do this). Would it be a good idea for log4perl > to provide a way for both allowing multiple arguments supplied to the > ConversionPattern, and also supplying an (optional) error code ? It is > natural that error log messages also contain an error value. I'd like to > construct the message in the ConversionPattern to include the error > code, and also exit with that error code. > > > On Wed, 2008-06-04 at 23:40 -0700, Mike Schilli wrote: > > On Tue, 3 Jun 2008, Kristis Makris wrote: > > > > > How can I do that ? I've tried logdie, logwarn, error_warn, logcroak, > > > logconfess without success. I either get duplicate error messages > > > printed, not dying, or a combination of the two. > > > > If you want the error message only once, check the section "Suppressing > > 'duplicate' LOGDIE messages": > > > > http://log4perl.sourceforge.net/d/Log/Log4perl.html#a722d > > > > -- Mike > > > > Mike Schilli > > m...@pe... > |
From: Kristis M. <kri...@as...> - 2008-06-05 16:00:59
|
Hey Mike, thanks again for your help. Would it make sense to have another interface that allows one to specify the exit value ? Doing the following e.g. $Log::Log4perl::LOGEXIT_CODE = 113; $logger->logdie( "my message" ); Is still two lines of code instead of one. I was hoping for the possibility that a function like: $logger->logdie ( "my message", 113 ); existed, or could be added in log4perl. I mean, I don't see how what is suggested for suppressing duplicate logdie messages is any different, or more efficient, than: $logger->error( "my message" ) && exit 113; In particular, I'm trying to "format" messages before I emit them through the logger. This requires me to always call something like: $logger->error ( my_special_function_that_formats_the_message ( $error_value, "my message") ); and I'm trying to avoid calling $logger->error ( my_special_function_that_formats_the_message ( $error_value, "my message") ) && exit $error_value; This all looks and feel dirty. I'm essentially constructing parts of the ConversionPattern (perhaps there's a better way to do this). Would it be a good idea for log4perl to provide a way for both allowing multiple arguments supplied to the ConversionPattern, and also supplying an (optional) error code ? It is natural that error log messages also contain an error value. I'd like to construct the message in the ConversionPattern to include the error code, and also exit with that error code. On Wed, 2008-06-04 at 23:40 -0700, Mike Schilli wrote: > On Tue, 3 Jun 2008, Kristis Makris wrote: > > > How can I do that ? I've tried logdie, logwarn, error_warn, logcroak, > > logconfess without success. I either get duplicate error messages > > printed, not dying, or a combination of the two. > > If you want the error message only once, check the section "Suppressing > 'duplicate' LOGDIE messages": > > http://log4perl.sourceforge.net/d/Log/Log4perl.html#a722d > > -- Mike > > Mike Schilli > m...@pe... |
From: Mike S. <m...@pe...> - 2008-06-05 06:40:48
|
On Tue, 3 Jun 2008, Kristis Makris wrote: > How can I do that ? I've tried logdie, logwarn, error_warn, logcroak, > logconfess without success. I either get duplicate error messages > printed, not dying, or a combination of the two. If you want the error message only once, check the section "Suppressing 'duplicate' LOGDIE messages": http://log4perl.sourceforge.net/d/Log/Log4perl.html#a722d -- Mike Mike Schilli m...@pe... |
From: Kristis M. <kri...@as...> - 2008-06-04 05:35:55
|
Hello, I'm trying to use log4perl to log a message and immediately die. I got the impression that something like: $logger->error_die( "my error message" ); should be enough, but instead calling this function reports the error message twice. I essentially need log4perl to do something like: $logger->error ("my error message"); die; or preferably: $logger->error ("my error message"); die $error_number; How can I do that ? I've tried logdie, logwarn, error_warn, logcroak, logconfess without success. I either get duplicate error messages printed, not dying, or a combination of the two. I must be missing something obvious. Can someone help please ? Thanks, Kristis |
From: Craig <cr...@po...> - 2008-05-27 20:32:23
|
Sorry it took so long to get back to you. (Was out for a couple of days.) Mike Schilli wrote: > On Thu, 22 May 2008, Craig wrote: > >> Problem is that I need to *always* send info (and "up") messages to the >> file and error (and "up") to stderr regardless of what the root logger >> level is set to. But, I also need to be able to change the stdout level >> on the fly. I don't want to set the default root level to anything less >> than ERROR, which means that only error and up will then be sent to the >> file. > > Not sure I understand why it's a requirement that the root logger's > level is not set to anything less than ERROR. Let me start by saying that none of this is a "hard requirement". Also, I realize that I am trying to "shoe-horn" one instance of log4perl to do everything I want. The script is small and a "one-off". So, devoting a lot of time to it is kind of a waste of time. While working on the script, I was also trying to play with log4perl. > If you want INFO messages to go through, you can't close the first gate, > keep the messages out and hope that the second gate (the filter) > magically resurrects them -- that doesn't make sense. Sorry, I didn't understand the internals of the library. I didn't think of it as a series of gates. Rather, I thought each logger category was independent of the others. Reading the docs more completely, it is obvious that isn't true. (Inheritance wouldn't work if that were true.) > Why aren't you simply setting the logger to the lowest level you're > interested in (INFO if I understood correctly) and handle the messages > you don't want in the appenders with a threshold setting? There are 3 distinct logging parts: 1. all warnings to stderr 2. all warnings to the user (stdout) 3. ongoing logging of what the app has done I would like a file that contains data on what the app did, what it touched, how long it took ,etc. (FYI, this is #3.) But, the user shouldn't be shown a bunch of data that he a) doesn't care about and b) doesn't understand. It would probably confuse him. :) But, if something goes wrong (warn or "worse"), I want the user to see that. But, just in case he closes the window before I can look at it, I want the same messages saved into another file (via stderr). This is all easy. The twist is that I would like to be able to pass in a "verbosity level" and with that change the log level for just stdout. That makes it much easier for me to debug problems if/when they arise. While thinking about this over the weekend, I figured this may be possible by setting a filter function on stdout. That function would look at the verbosity level. Then stderr and the app log would have their own filters set to WARN and INFO. Then the root logger would be set to TRACE. Seems like a lot of overhead, but it is ONE way to get a fair amount of configuration pretty simply. Craig |
From: Father C. <sp...@cp...> - 2008-05-24 05:29:34
|
Oops! I attached the wrong file. |
From: Father C. <sp...@cp...> - 2008-05-24 05:28:00
|
Hello. Log::Log4perl (v. 1.16 as of this message) ignores multiple ‘use’ statements. Looking in the Changes file, I see that this is intentional: 1.04 2006/02/26 ... * (ms) Multiple calls to import (usually happens if 'use L4p' gets called twice within the same namespace) caused nasty warnings, bug reported by Greg Olszewski. Fixed by ignoring subsequent calls from the same package to import(). But this breaks Business::Shipping’s test suite. So I’ve attached a patch that allows multiple ‘use’ statements to work, and also prevents the subroutine redefinition warnings. I’ve also included tests for both. I hope this is helpful. Father Chrysostomos |
From: Mike S. <m...@pe...> - 2008-05-23 17:39:04
|
On Fri, 23 May 2008, Vinodhini M wrote: > I installed Log4Perl module and tried to init more than one config > file, only one log file is updating rest of two are empty. Please help > me on how to init multiple config files and logging to multiple log > files. Currently, only one configuration file is supported, if you call init() more than once, the first configuration will be overwritten by the second. This might change, but until we have a solution, you can combine your config files by reading them into a string and feeding that to init(\$string). -- Mike Mike Schilli m...@pe... |
From: Vinodhini M <Vin...@At...> - 2008-05-23 14:27:30
|
Hi, I installed Log4Perl module and tried to init more than one config file, only one log file is updating rest of two are empty. Please help me on how to init multiple config files and logging to multiple log files. Thanks in advance. Regards, Praveen G |
From: Mike S. <m...@pe...> - 2008-05-23 06:10:43
|
On Thu, 22 May 2008, Craig wrote: > Problem is that I need to *always* send info (and "up") messages to the > file and error (and "up") to stderr regardless of what the root logger > level is set to. But, I also need to be able to change the stdout level > on the fly. I don't want to set the default root level to anything less > than ERROR, which means that only error and up will then be sent to the > file. Not sure I understand why it's a requirement that the root logger's level is not set to anything less than ERROR. If you want INFO messages to go through, you can't close the first gate, keep the messages out and hope that the second gate (the filter) magically resurrects them -- that doesn't make sense. Why aren't you simply setting the logger to the lowest level you're interested in (INFO if I understood correctly) and handle the messages you don't want in the appenders with a threshold setting? http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#245ae -- Mike Mike Schilli m...@pe... > > I have an app where I want to log the following: > stdout: ERROR > stderr: ERROR > file: INFO > Also, I need to be able to change the level for stdout during run-time. > > I have a simple test script with the following config: > > $conf = { > 'log4perl.logger' => "ERROR, Screen, OutError, File", > > 'log4perl.filter.Info' => 'Log::Log4perl::Filter::LevelRange', > 'log4perl.filter.Info.LevelMin' => 'INFO', > 'log4perl.filter.Info.LevelMax' => 'FATAL', > 'log4perl.filter.Info.AcceptOnMatch' => 'true', > > 'log4perl.filter.Warn' => 'Log::Log4perl::Filter::LevelRange', > 'log4perl.filter.Warn.LevelMin' => 'WARN', > 'log4perl.filter.Warn.LevelMax' => 'FATAL', > 'log4perl.filter.Warn.AcceptOnMatch' => 'true', > > "log4perl.appender.Screen" => "Log::Log4perl::Appender::Screen", > "log4perl.appender.Screen.stderr" => "0", > "log4perl.appender.Screen.layout" => "Log::Log4perl::Layout::PatternLayout", > "log4perl.appender.Screen.layout.ConversionPattern" => 'ok: %p>%M-%L: %m%n', > > "log4perl.appender.OutError" => "Log::Log4perl::Appender::Screen", > "log4perl.appender.OutError.Filter" => 'Warn', > "log4perl.appender.OutError.stderr" => "1", > "log4perl.appender.OutError.layout" => > "Log::Log4perl::Layout::PatternLayout", > "log4perl.appender.OutError.layout.ConversionPattern" => 'ok: %p>%M-%L: > %m%n', > > "log4perl.appender.File" => "Log::Log4perl::Appender::File", > "log4perl.appender.File.Filter" => 'Info', > "log4perl.appender.File.mode" => 'append', > "log4perl.appender.File.filename" => "app-multi.log", > "log4perl.appender.File.layout" => "Log::Log4perl::Layout::PatternLayout", > "log4perl.appender.File.layout.ConversionPattern" => '%p>%M-%L: %m%n' > }; > Log::Log4perl::init($conf); > $logger = get_logger($name); > > ... > ######################### > > (Basically, I have a "verbose" switch on the app where I turn down the > level for stdout. But, the default should be pretty non-chatty.) > > Does this all make sense? (Not sure if I explained it very well.) > > Any ideas would be appreciated! > > Thanx > Craig > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |
From: Craig <cr...@po...> - 2008-05-23 02:23:23
|
Hi. I have an app where I want to log the following: stdout: ERROR stderr: ERROR file: INFO Also, I need to be able to change the level for stdout during run-time. I have a simple test script with the following config: $conf = { 'log4perl.logger' => "ERROR, Screen, OutError, File", 'log4perl.filter.Info' => 'Log::Log4perl::Filter::LevelRange', 'log4perl.filter.Info.LevelMin' => 'INFO', 'log4perl.filter.Info.LevelMax' => 'FATAL', 'log4perl.filter.Info.AcceptOnMatch' => 'true', 'log4perl.filter.Warn' => 'Log::Log4perl::Filter::LevelRange', 'log4perl.filter.Warn.LevelMin' => 'WARN', 'log4perl.filter.Warn.LevelMax' => 'FATAL', 'log4perl.filter.Warn.AcceptOnMatch' => 'true', "log4perl.appender.Screen" => "Log::Log4perl::Appender::Screen", "log4perl.appender.Screen.stderr" => "0", "log4perl.appender.Screen.layout" => "Log::Log4perl::Layout::PatternLayout", "log4perl.appender.Screen.layout.ConversionPattern" => 'ok: %p>%M-%L: %m%n', "log4perl.appender.OutError" => "Log::Log4perl::Appender::Screen", "log4perl.appender.OutError.Filter" => 'Warn', "log4perl.appender.OutError.stderr" => "1", "log4perl.appender.OutError.layout" => "Log::Log4perl::Layout::PatternLayout", "log4perl.appender.OutError.layout.ConversionPattern" => 'ok: %p>%M-%L: %m%n', "log4perl.appender.File" => "Log::Log4perl::Appender::File", "log4perl.appender.File.Filter" => 'Info', "log4perl.appender.File.mode" => 'append', "log4perl.appender.File.filename" => "app-multi.log", "log4perl.appender.File.layout" => "Log::Log4perl::Layout::PatternLayout", "log4perl.appender.File.layout.ConversionPattern" => '%p>%M-%L: %m%n' }; Log::Log4perl::init($conf); $logger = get_logger($name); ... ######################### Problem is that I need to *always* send info (and "up") messages to the file and error (and "up") to stderr regardless of what the root logger level is set to. But, I also need to be able to change the stdout level on the fly. I don't want to set the default root level to anything less than ERROR, which means that only error and up will then be sent to the file. (Basically, I have a "verbose" switch on the app where I turn down the level for stdout. But, the default should be pretty non-chatty.) Does this all make sense? (Not sure if I explained it very well.) Any ideas would be appreciated! Thanx Craig |
From: Kevin M. G. <cp...@go...> - 2008-05-20 05:08:22
|
> > But, the application has to > run in different environments (development, testing, staging, > production) so we need slightly different configurations under each > environment. > > So, I was looking at having a single log4perl config and then using > environment-specific config files to alter the behavior. The log > message pattern might be the same under each mode, but the > destination file might be different or the "owner" of the file might > be different, for example. > > I have a way to handle this right now, but it just means I need > separate log4perl config files for each operating environment. So, I > end up duplicating the config for the majority of the log4perl config. > Interesting. The way they've solved that problem where I work, for *all* config files, not just log4perl, is to start with a base config file in a template, and when the service is started up, munge the config file based on per-host values. Something like this: ---------------------- # the config file looks like this log4perl.appender.file.filename = {$logfile} log4perl.appender.file.owner = {$owner} ----------------------- # the per-host values are set up somewhere like this $hosts = { QA => { logfile => '/var/log/qa.out', owner => 'bob the tester', }, PROD => { logfile => '/var/log/prod.out', owner => 'jerry the sysadmin', }, } # a Text::Template might be filled in like this $this_host = 'QA'; $munged_config = $template->fill_in(HASH => $hosts{$this_host}, ...); # and now you're ready to init Log::Log4perl::config(\$munged_config); |
From: Bill M. <mo...@ha...> - 2008-05-19 20:47:43
|
On Thu, May 15, 2008 at 11:01:35PM -0700, Mike Schilli wrote: > > You need to call the appender's layout() method to set the layout, other > than that, the code above looks ok to me at first glance. It's fairly > unusual to use Perl code to init Log4perl, most of the time people > either use easy_init() or init($conf_file). The log4perl config is not that complex, but we do have a few appenders. The problem is the log4perl.conf file is part of the application (it's in subversion with the rest of the code). But, the application has to run in different environments (development, testing, staging, production) so we need slightly different configurations under each environment. So, I was looking at having a single log4perl config and then using environment-specific config files to alter the behavior. The log message pattern might be the same under each mode, but the destination file might be different or the "owner" of the file might be different, for example. I have a way to handle this right now, but it just means I need separate log4perl config files for each operating environment. So, I end up duplicating the config for the majority of the log4perl config. I can see it would be handy to have a base config file and then be able to "override" just parts of the config that are different. -- Bill Moseley mo...@ha... |
From: Mike S. <m...@pe...> - 2008-05-16 07:34:12
|
Log4perl enthusiasts, Log::Log4perl 1.16 has just been released on the log4perl.com website: http://log4perl.sourceforge.net/releases/Log-Log4perl-1.16.tar.gz The changes were: 1.16 (2008/05/15) * (ms) Changed appender destruction during cleanup to show warning messages thrown by destructors. Previously L4p ignored these messages which caused failed DB flushes to go unnoticed with the DB appender. * (ms) Added explanation for Log4perl messages during global destruction to FAQ. * (ms) Corrected 'Trapper' listing in FAQ, thanks to Christian Reiber. * (ms) Applied patch by Mitchell Perilstein for 5.005it and the two-argument binmode() that 5.005 doesn't support. (http://rt.cpan.org/Ticket/Display.html?id=34051) * (ms) Applied patch by Emmanuel Rodriguez (POTYL) doing away with hard-coded line numbers in 024WarnDieCarp.t to make it work cpan2rpm for building RPM packages (http://rt.cpan.org/Public/Bug/Display.html?id=35370) * (ms) Fixed recreate_check_interval = 0 bug reported by Bill Moseley. * (ms) Added 'header_text' parameter to the file appender to have it write a header every time it opens (or re-opens) a new log file (suggested by Steven Lembark). If all goes well, it'll go to CPAN in a couple of days. Give it a whirl! -- Mike Mike Schilli m...@pe... |
From: Mike S. <m...@pe...> - 2008-05-16 06:04:49
|
On Tue, 13 May 2008, Jonathan Swartz wrote: > In the meantime, I might try to do this myself by creating my own > Appender subclass: > > # My::Log4perl::Appender::File defaults to my preferred layout > and layout.ConversionPattern > log4perl.appender.file1 = My::Log4perl::Appender::File > log4perl.appender.file2 = My::Log4perl::Appender::File > > Do you have a vague idea of how I might approach this? Or is it too > diffiicult, and I should just suck up the repetition until the > inheritance feature? :) Appenders and layouts are different concepts, so I wouldn't put them into the same class. I'd probably just use a template enginge like the template toolkit, define a Log4perl config file in a meta format and have the template engine expand everything before Log4perl reads in the configuration. -- Mike Mike Schilli m...@pe... |
From: Mike S. <m...@pe...> - 2008-05-16 06:01:55
|
On Tue, 13 May 2008, Bill Moseley wrote: > I inherited an existing Log4perl configuration, and I think I'm > missing some key point. Wow, I had no idea we're so old that you could inherit a log4perl configuration, but I guess time goes by :). > The config file starts out: > log4perl.rootLogger = INFO, syslogAppender, screenAppender > >From the examples I've seen and the ::Config docs I thought it should > be "log4perl.logger" not "log4perl.rootLogger". log4perl.logger with no category and log4perl.rootLogger are actually synonymous. log4perl.logger.foo.bar (with category foo.bar) needs to be 'logger', not rootLogger, obviously. > In ::Config it also give these examples: > log4perl.logger.Bar.Twix = DEBUG, A1 > log4perl.category.Bar.Twix = WARN, Screen > Why is it "category" instead of "logger"? That's an issue we inherited from Log4j. They started out naming categories "categories", then all of a sudden they called them loggers. I personally prefer the term 'category'. So, 'category' and 'logger' in a log4perl config file are synonymous. Yeah, confusing, I know :). > Finally, for a config like this in the example, what would > be the perl code equivalent if not using a config file? > > log4perl.logger.Bar.Twix = DEBUG, A1 > log4perl.appender.A1=Log::Log4perl::Appender::File > log4perl.appender.A1.filename=test.log > log4perl.appender.A1.mode=append > log4perl.appender.A1.layout = \ > Log::Log4perl::Layout::PatternLayout > log4perl.appender.A1.layout.ConversionPattern = %d %m %n > > > Like this? > > use Log::Log4perl qw(:levels); > use Log::Log4perl::Appender::File; > > my $appender = Log::Log4perl::Appender::File->new( > filename => 'test.log', > mode => 'append', > layout => Log::Log4perl::Layout::PatternLayout->new( '%d %m %n'), > ); > > my $logger = Log::Log4perl->get_logger( 'Bar::Twix' ); > > $logger->level( $DEBUG ); > $logger->add_appender( $appender ); You need to call the appender's layout() method to set the layout, other than that, the code above looks ok to me at first glance. It's fairly unusual to use Perl code to init Log4perl, most of the time people either use easy_init() or init($conf_file). -- Mike Mike Schilli m...@pe... |