Re: [log4perl-devel] Questions on Log4perl
On Thu, 9 Aug 2007 [EMAIL PROTECTED] wrote: I'm working on a script I'd like to use Log4perl on for gathering information: STDERR, STDOUT, etc... I read your 4 page article on www.perl.com and it looks like my script is a good candidate for using config files. I don't have a lot of experience using config files in my Perl programming and was wondering if you could have non- static info in a log4perl config file? There's two kinds of dynamic values: Dynamic at init() time and dynamic at log time. Using dynamic values at init() time is explained here: http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#02bbc And here's how to use dynamic values at log time: http://log4perl.sourceforge.net/d/Log/Log4perl/Layout/PatternLayout.html#9af52 Hope that helps! -- Mike Mike Schilli [EMAIL PROTECTED] log4perl.PatternLayout.cspec.D = Log4perl::get_pid( sub {use File::Basename; return basename($0) ); Please have patience, I'm trying... Much thanks for any help, Joe McTigue [EMAIL PROTECTED] - This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission 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 JPMorgan Chase Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log4perl Categories
On Thu, 16 Aug 2007, Lee Goddard wrote: Sometimes I need to just see the logging from a specific method/subroutine/function. I realize I can change the log levels within that block of code, but it would be convenient to be able to say log4perl.category.bar.twix.eat to just see the logging from Bar::Twix's 'eat' method. Would it be a bad idea to incorporate this? Does this third-party CPAN module solve the problem? http://search.cpan.org/dist/Log-Log4perl-AutoCategorize/ -- Mike Mike Schilli [EMAIL PROTECTED] - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Logger Properties
On Wed, 26 Sep 2007, Berg, Eric wrote: The answer was that that information isn't kept. For one thing, it could be that the configuration was derived or modified programatically. That's not accurate. Of course it's kept, otherwise the file appender wouldn't know what the name of the file is, right? :) To find the name of the file the file appender is using, first obtain a reference to the file appender. If you have a configuration like log4perl.category.Bar.Twix = WARN, Logfile log4perl.appender.Logfile = Log::Log4perl::Appender::File log4perl.appender.Logfile.filename = test.log ... then find the Logfile appender via my $app = Log::Log4perl-appender_by_name(Logfile); and to obtain the name of the logfile it's using, call its 'filename' method: print $app-filename(), \n; -- Mike Mike Schilli [EMAIL PROTECTED] Nonethless, I think that there are times when it would be very helpful to have a path/filename for the config file. One of these days, if I get some time Eric. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, September 26, 2007 5:21 AM To: log4perl-devel@lists.sourceforge.net Subject: [log4perl-devel] Logger Properties Hi, know somebody how can I get the properties of a logger i.e. name of used logfile? In log4perl manual I don't fint any hint. Example: $logger = Log::Log4perl-get_logger('loggername'); I miss something like: %properties = $logger-get_logger_properties(); $current_logfile = $properties{filename}; Thanks Gerd - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax matters contained within this communication (including any attachments) is not intended or written to be used and cannot be used for the purpose of (i) avoiding U.S. tax related penalties or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Logger Properties
On Thu, 27 Sep 2007, Berg, Eric wrote: Well, that's good news, Mike, but what about the following did I not understand? The mail below referred to the configuration file name, while the previous mail referred to the output file name the file appender uses. Two entirely different animals! :) -- Mike Mike Schilli [EMAIL PROTECTED] This would be nice to have in the docs. Thanks. -Eric. -Original Message- From: Mike Schilli =5Bmailto:m=40perlmeister.com=5D Sent: Thursday, June 28, 2007 7:54 PM To: Berg, Eric Cc: log4perl-devel=40lists.sourceforge.net Subject: Re: =5Blog4perl-devel=5D When a missing config file On Thu, 28 Jun 2007, Berg, Eric wrote: I've been looking for a way to get l4p to tell me where the config=20 under which it's running comes from. Essentially, I'd like to have=20 a method that would return the full path to the config file that=20 it's currently using. Obviously, there are complications, such as those relating to=20 programatic configuration subsequent to loading configs from a file, in-line, and config (ini) files, but I could find nowhere that the=20 file name passed in to init() is retrievable. The name of the file isn't stored usually, since you can not only use=20 a file but a string, a hashref, an URL, etc. to initialize L4p. Since you're calling init() in the first place, wouldn't it be easier=20 to store the filename in your application instead? -- Mike -Original Message- From: Mike Schilli [mailto:[EMAIL PROTECTED] Sent: Thursday, September 27, 2007 3:29 AM To: Berg, Eric Cc: [EMAIL PROTECTED]; log4perl-devel@lists.sourceforge.net Subject: Re: [log4perl-devel] Logger Properties On Wed, 26 Sep 2007, Berg, Eric wrote: The answer was that that information isn't kept. For one thing, it could be that the configuration was derived or modified programatically. That's not accurate. Of course it's kept, otherwise the file appender wouldn't know what the name of the file is, right? :) To find the name of the file the file appender is using, first obtain a reference to the file appender. If you have a configuration like log4perl.category.Bar.Twix = WARN, Logfile log4perl.appender.Logfile = Log::Log4perl::Appender::File log4perl.appender.Logfile.filename = test.log ... then find the Logfile appender via my $app = Log::Log4perl-appender_by_name(Logfile); and to obtain the name of the logfile it's using, call its 'filename' method: print $app-filename(), \n; -- Mike Mike Schilli [EMAIL PROTECTED] Nonethless, I think that there are times when it would be very helpful to have a path/filename for the config file. One of these days, if I get some time Eric. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, September 26, 2007 5:21 AM To: log4perl-devel@lists.sourceforge.net Subject: [log4perl-devel] Logger Properties Hi, know somebody how can I get the properties of a logger i.e. name of used logfile? In log4perl manual I don't fint any hint. Example: $logger = Log::Log4perl-get_logger('loggername'); I miss something like: %properties = $logger-get_logger_properties(); $current_logfile = $properties{filename}; Thanks Gerd - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax matters contained within this communication (including any attachments) is not intended or written to be used and cannot be used for the purpose of (i) avoiding U.S. tax related penalties or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein. -- --- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01
Re: [log4perl-devel] expressing common appender properties in config
On Tue, 9 Oct 2007, Jonathan Swartz wrote: Let's say I've got several file appenders and a screen appender, and I want them to use the same layout. There's no inheritance available (yet), but variable substitution should ease your pain at least a little bit: http://log4perl.sourceforge.net/d/Log/Log4perl.html#bd632 -- Mike Mike Schilli [EMAIL PROTECTED] log4perl.appender.foofile = Log::Log4perl::Appender::File log4perl.appender.foofile.filename = logs/foo.log log4perl.appender.foofile.mode = append log4perl.appender.foofile.layout = PatternLayout log4perl.appender.foofile.layout.ConversionPattern = %d{dd/MMM/ :HH:mm:ss.SS} [%p] %c - %m - %F:%L %P-%X{request_id}%n log4perl.appender.barfile = Log::Log4perl::Appender::File log4perl.appender.barfile.filename = logs/bar.log log4perl.appender.barfile.mode = append log4perl.appender.barfile.layout = PatternLayout log4perl.appender.barfile.layout.ConversionPattern = %d{dd/MMM/ :HH:mm:ss.SS} [%p] %c - %m - %F:%L %P-%X{request_id}%n log4perl.appender.screen = Log::Log4perl::Appender::Screen log4perl.appender.screen.layout = PatternLayout log4perl.appender.screen.layout.ConversionPattern = %d{dd/MMM/ :HH:mm:ss.SS} [%p] %c - %m - %F:%L %P-%X{request_id}%n This is rather tedious, to say the least. Is there any way to abbreviate this in the config file, e.g. to specify common properties of my standard appender and have the other appenders inherit from it? Or do I have to resort to configuring from a hash if I want this kind of expressiveness? Thanks Jon - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] set file permissions for Log::Dispatch::FileRotate appender?
On Fri, 2 Nov 2007, Jeff McCarrell wrote: I'm using log4perl in the obvious way. We have reqs to set the mode of the log file to 0666. log4perl.appender.PUSHD.filename=/tmp/pushd.log log4perl.appender.PUSHD.mode=append log4perl.appender.PUSHD.permissions = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH # rotate among 5 log files of 10Mbytes each log4perl.appender.PUSHD.size=100kb log4perl.appender.PUSHD.max=5 results in 5 files of mode 0; permissions=0666 gets passed as a string through the layers, not as an octal number, and results in: --w--wx-wT 1 nobody nobody 1063 Nov 2 12:41 pushd.log* Unless you say explicitly that the right-hand side of a log4perl config line is Perl code, it's interpreted as a string. So, if you say log4perl.appender.PUSHD.permission = sub { use POSIX; S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH } instead, it'll work as intended. -- Mike Mike Schilli [EMAIL PROTECTED] - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Problems with uninitialized root-logger in log::log4perl
On Tue, 4 Dec 2007, Johannes Kilian wrote: No - no __DIE__ handler within my own perl-modules/perl files. Perhaps there might be some troublesome __DIE__ handler within the officiall perl modules (installed in Perl\lib or Perl\site\lib) - But how can I find out which one is it? Trace it: PERLDB_OPTS=NonStop=1 AutoTrace=1 frame=2 perl -dS program 4.) Finishing my program an error from log4perl occurs: (in cleanup) Internal error: Root Logger not initialized. at C:/Programme/Perl/site/lib/Log/Log4perl/Logger.pm line 557 during global destruction. How can I avoid the internal error above? Perhaps the uninitialized root logger causes the erroneous exception handling as described in point 3.)? I'm not sure how you get there - is there an easy way for me to reproduce this problem? -- Mike Mike Schilli [EMAIL PROTECTED] - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] File rotation every day
On Wed, 16 Jan 2008 [EMAIL PROTECTED] wrote: I am testing it and it looks like it is working OK. I am wondering if it is possible to do what I want to with it. I want, when the file rotate every day to change the file name to include the date in the But like I read in the documentation, the sub are executed only once at the time the config file is read. So the date in the file name is always the date when I start the program. That's correct, only the appender or an external program can take care of renaming the log file. Log::Dispatch::FileRotate (which is not part of Log4perl but a 3rd party module) renames log files as file.log.1, file.log.2, etc., but that's not what you want. Instead, I'd suggest you use an external rotator and let it take care of the renaming issue. Make sure you read the gotchas regarding external rotators, first: http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#2d0d0 Then I'd probably use a configuration like this: log4perl.category = WARN, Logfile log4perl.appender.Logfile = Log::Log4perl::Appender::File log4perl.appender.Logfile.filename = test.log log4perl.appender.Logfile.recreate = 1 log4perl.appender.Logfile.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.Logfile.layout.ConversionPattern = %d %F{1} %L %m%n and an external rotator that kicks in right after midnight every day as a cronjob: 01 00 * * * cd /my/logs; mv test.log test.log.`date +%F` Because of the 'recreate' flag set in the Log4perl configuration, Log4perl will notice when the file is missing (until it does notice, it will keep writing to the moved file, which is fine if you hold off on compressing it until the switch is made). The Log::Log4perl::Appender::File documentation lists more details on the 'recreate' flag. Hope that helps! -- Mike Mike Schilli [EMAIL PROTECTED] - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Can't call method log on an undefined value...Appender.pm line 189 during global destruction.
On Thu, 14 Feb 2008, Darren Ball wrote: I am getting this message consistently. (in cleanup) Can't call method log on an undefined value at /usr/lib/perl5/site_perl/5.8/Log/Log4perl/Appender.pm line 189 during global destruction. Hmm, to help me track this down, can you provide a condensed code example that I can reproduce the error with? -- Mike Mike Schilli [EMAIL PROTECTED] I have a series of modules that are descendants of other packages. Scripts using the objects are using log4perl, and the packages also use log4perl. Everything seems to work - I initiate the logger in the 'script' that uses the libraries, and when the script ends, it calls a library function (i.e. pass, fail, error). These methods call the exit function, which in turn invoke the DESTROY routine for each object. It seems as though Log4perl is being destroyed prior to other objects being cleaned up (which use the logger in their DESTROY routines) or so I think. Can anyone help me try to figure out how to stop this, and ensure all logging occurs right to the end of the script. Any help would be appreciated. I instantiated the logger with a simple screen appender. my $conf = qq | log4perl.logger = $acceptedLevel, ScreenApp log4perl.appender.ScreenApp = Log::Log4perl::Appender::Screen log4perl.appender.ScreenApp.stderr = 0 log4perl.appender.ScreenApp.layout = PatternLayout log4perl.appender.ScreenApp.layout.ConversionPattern = %d %-5p %-4L %m%n |; But I always get : (in cleanup) Can't call method log on an undefined value at /usr/lib/perl5/site_perl/5.8/Log/Log4perl/Appender.pm line 189 during global destruction. at the end of the script. Somethings I am missing log statements as well. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Is it safe to use log4perl under Apache (multi worker mode)
On Mon, 10 Mar 2008, howard chen wrote: Since I would like to log message to text file, so I want to ask: Is it safe to use log4perl under Apache (multi worker mode), without file locking problem? If not, any recommendations for file logging under Apache. Logging from different processes to the same file requires some precautions, all listed in this FAQ: http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#23804 -- Mike Mike Schilli [EMAIL PROTECTED] - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Watchdog reporting
On Wed, 7 May 2008, Bill Moseley wrote: What I'm after is to have an email sent *as soon* as an error is detected. But, then to collect any more errors for a few minutes before sending another email again to keep from flooding with email. (I also want to report to Nagios, but that's later.) Log::Dispatch::Email has a buffered option but I'm not sure that fits with the above. Any existing solutions for the above? The way this works in the buffered email appender is actually quite different: It collects messages *until* a threshold is reached, then it sends an email: http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#a0f6e What I'm attempting to do instead is have a separate File appender that only logs ERROR and above to a file, then watch that file. If you're running a single process (and won't need to keep state on restarts) there's no need to do this in a file appender. You could define your own appender which maintains a (memory) buffer. So I have these settings for my appender: .recreate = 1 .recreate_check_interval = 0 But, that is not working -- the move is not detected. Aha, that's a bug -- I've fixed it in 1.16 in CVS, to be released soon -- thanks! Finally, another question. I've got three appenders. One for syslog, one for stderr, and one to a file. Is it possible to set a pattern that will apply to all? Or do I have to specify a pattern for each appender? Variable substitution should help with this: http://log4perl.sourceforge.net/d/Log/Log4perl.html#bd632 -- Mike Mike Schilli [EMAIL PROTECTED] - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] log4perl appenders with warp_message=0
On Tue, 13 May 2008, Erskine, Thomas (IT) wrote: I do indeed want $logger-log($level, $msg, $key) to be dealt with differently depending on the appender it ends up on. That's part of the point of having different appenders; they ought to be independant. The problem is that it doesn't seem possible to use appenders simultaneously which set (and require) warp_message=0 and ones which don't. I don't think that this is true, warp_message is a per-appender setting and can be set individually (and differently) per appender. The restriction is that the you need to use the NoopLayout with the appender that has warp_message set. I've just thought of another way to do this. If I set warp_message=sub{return $_[0]} on the file appender, then things should just work. I don't like putting code in the log configuration file, but it's worth a shot. Just a sec... Yup. It works. That's exactly right -- and since it's per-appender, it won't affect the other 'fancy' appender. But, the ugly part is that with warp_message turned on, the appender's log() method gets an a reference to an array of message chunks, which the file appender can't deal with. The problem with using the MDC is that this isn't something which is intended to persist for a while. The whole point is to be able to set the Netcool AlertKey on a per-message basis. Of course I _could_ use the MDC, but my usage would look like: Log::Log4perl::MDC-put(netcool-key, $key); $logger-log($level, $msg); Log::Log4perl::MDC-put(netcool-key, undef); which isn't exactly handy. ... or you define a wrapper around that: http://log4perl.sourceforge.net/d/Log/Log4perl.html#6acb7 -- Mike Mike Schilli [EMAIL PROTECTED] -Original Message- From: Mike Schilli [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 13, 2008 2:26 AM To: Erskine, Thomas (IT) Cc: [EMAIL PROTECTED] Subject: Re: log4perl appenders with warp_message=0 On Fri, 9 May 2008, Erskine, Thomas (IT) wrote: The other logs an event to Netcool (specifying warp_message=0) and it works fine. It allows you to call log like: $logger-log($level, $msg, $key) so that you can specify a Netcool alert key. Then comes the problem: I made a configuration file including both appenders. Now I lose. The Netcool appender continues to work nicely. However, the file appender mashes all the args together if I specify the key. Which is the expected behaviour for it, but then I can't use the key feature with netcool. I could make it work by setting warp_message=0 on the file appender, but to do that I have to set the layout to NoopLayout, so I can't get nicely formatted log entries there. It seems as if there is no way to use both types of appender (with warp_message=0 and without) in the same config file. Or am I missing something? Hi Thomas, It seems like you want a statement like $logger-log($level, $msg, $key) to have two different meanings, depending on which appender the message ends up at. On the Netcool appender, you want it to use the $key for a special purpose, on the file appender, you want it to sweep $key under the carpet -- seems inconsistent to me, as it's not clear what another random new appender would do with this. For cases like this, I would stuff the Netcool key in the MDC: http://log4perl.sourceforge.net/d/Log/Log4perl/MDC.html So instead of saying $logger-log($level, $msg, $key); you would say Log::Log4perl::MDC-put(netcool-key, $key); $logger-log($level, $msg); and the Netcool appender would either fetch the the key from the MDC in its log() method and do something with it or you could access it as %X{netcool-key} in the layout: http://log4perl.sourceforge.net/d/Log/Log4perl/Layout/PatternL ayout.html Would that work for you? Can I post this message to the mailing list? Looks like this could be useful for other folks as well. -- Mike Mike Schilli [EMAIL PROTECTED] NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] log4perl appenders with warp_message=0
On Tue, 13 May 2008, Erskine, Thomas (IT) wrote: While warp_message is indeed an appender setting, if you have two appenders, one with warp_message=0 and one without, then you'll get the mess I got: the one with will work fine and will have access to extra args separately, but the one without will mash the args into a single message. Perhaps I ought to have said that, while it's possible to have appenders with warp_message=0 and those without in the same setup, it's not _useful_ as the result will be a mess. It's a dilemma: We're hiding probes in the code that should work for all appenders, and yet some appenders interpret them differently. Note that the Log4perl configuration is supposed to be independent of the code. Any person, even those unfamiliar with your code, should be able to define a Log4perl config file from scratch to run it with. I'm admitting that this is a stretch (and what L4p does deviates from the strict Log4j standard) but we've found it useful for database appenders, for example. I'll be the first to admit, though, that this isn't a 100% clean solution. I guess you could find arguments either way, but I feel that mashing arguments as a default is reasonable and provides predictable results. On a completely different topic, while making a Null appender (which discards everything), I noticed that it doesn't seem possible to make the initializer shut up about it not having a layout. Even though I added in code to the new to cause it to inflict the NoopLayout to itself. It just seemed that I shouldn't have to provide configuration for a Null appender, since it isn't doing anything. Instead, I have to say: log4perl.xxx.appender=Null log4perl.xxx.layout=NoopLayout log4perl.xxx.warp_message=0 I understand that you're just (properly) checking that people haven't made a stupid mistake in forgetting the layout. Exactly, catching stupid errors has precedence over making slick code short. :) -- Mike Mike Schilli [EMAIL PROTECTED] - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Understanding the config
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 [EMAIL PROTECTED] - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Sending email of logs only on failure
On Thu, 6 Nov 2008, Mathieu Longtin wrote: I have a program that processes a bunch of separate items, logging stuff as it goes. I would like to be able to capture what gets logged during the processing on one item, and email the whole thing if the processing failed. The log messages should go to a file regardless. Is there a way to do that in log4perl currently? You could use one of the Log::Dispatch::Email::* modules on CPAN and set it to 'buffered': http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl/FAQ.pm#How_can_I_configure_Log::Log4perl_to_send_me_email_if_something_happens? When it is time to flush it, retrieve the appender by name and call its flush() method. But I'd probably just use Log4perl to write everything to a log file (use overwrite mode to start a new log file every time) and at the end of the program run a check and send off the logfile via a CPAN module like Mail::DWIM. -- Mike Mike Schilli [EMAIL PROTECTED] - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log::Log4perl MDC at object level
On Wed, 12 Nov 2008, Anatoliy wrote: I'm going to use POE library for performing multitasks and I'd like to use POEs session specific values in the MDC. POE doesn't use threads/processes, so I can't make it with global variables. Is there any thing equal to MDC but for using with $logger object? not Log::Log4perl class. Thank you for Log::Log4perl anyway :) You're welcome, and that's a very good question, I've added an anwer to the FAQ and made some changes to Log4perl: =head2 How can I access POE heap values from Log4perl's layout? POE is a framework for creating multitasked applications running in a single process and a single thread. POE's threads equivalents are 'sessions' and since they run quasi-simultaneously, you can't use Log4perl's global NDC/MDC to hold session-specific data. However, POE already maintains a data store for every session. It is called 'heap' and is just a hash storing session-specific data in key-value pairs. To access this per-session heap data from a Log4perl layout, define a custom cspec and reference it with the newly defined pattern in the layout: use strict; use POE; use Log::Log4perl qw(:easy); Log::Log4perl-init( \ q{ log4perl.logger = DEBUG, Screen log4perl.appender.Screen = Log::Log4perl::Appender::Screen log4perl.appender.Screen.layout = PatternLayout log4perl.appender.Screen.layout.ConversionPattern = %U %m%n log4perl.PatternLayout.cspec.U = \ sub { POE::Kernel-get_active_session-get_heap()-{ user } } } ); for (qw( Huey Lewey Dewey )) { POE::Session-create( inline_states = { _start= sub { $_[HEAP]-{user} = $_; POE::Kernel-yield('hello'); }, hello = sub { DEBUG I'm here now; } } ); } POE::Kernel-run(); exit; The code snippet above defines a new layout placeholder (called 'cspec' in Log4perl) %U which calls a subroutine, retrieves the active session, gets its heap and looks up the entry specified ('user'). Starting with Log::Log4perl 1.20, cspecs also support parameters in curly braces, so you can say log4perl.appender.Screen.layout.ConversionPattern = %U{user} %U{id} %m%n log4perl.PatternLayout.cspec.U = \ sub { POE::Kernel-get_active_session- \ get_heap()-{ $_[0]-{curlies} } } and print the POE session heap entries 'user' and 'id' with every logged message. For more details on cpecs, read the PatternLayout manual. Hope that helps! -- Mike Mike Schilli [EMAIL PROTECTED] - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Sending SMTP Mail via Log4Perl
On Thu, 20 Nov 2008, Matthias Weiser wrote: I am following the FAQs and try to send SMTP mail via Log4Perl. I first tried this configuration: log4perl.category = FATAL, Mailer log4perl.appender.Mailer = Log::Dispatch::Email::MailSend log4perl.appender.Mailer.to = [EMAIL PROTECTED] log4perl.appender.Mailer.from = [EMAIL PROTECTED] log4perl.appender.Mailer.subject = Something's broken! log4perl.appender.Mailer.layout = SimpleLayout log4perl.appender.Mailer.Server = x.x.x.x log4perl.appender.Mailer.smtp = 1 log4perl.appender.Mailer.buffer=0 Hi Matthias, it looks good to me, I just verified that it works with my SMTP server. This did not work as smtp is a scalar reference in the constructor of Mail::Mailer and log4perl seems to call it only with hashes. Not sure what you're using, but my Mail::Mailer's constructor looks like $mailer = Mail::Mailer-new($type, @args); so there's no references, and that's how I think the code in Log::Dispatch::Email::MailSend uses it as well. Then I tried the suggestion of the module desciption for Log::Dispatch::Email::MailSend and tried use Mail::Mailer 'smtp', Server = 'foo.example.com'; which did not work either. (Cannot locate 'Server' at log4Perl.pl line 1 Warning: something's wrong at /opt/ActivePerl-5.8/site/lib/Mail/Mailer.pm line 278). Hmm, your version of Mail::Mailer seems to be different from the one on CPAN -- which one are you using? -- Mike Mike Schilli [EMAIL PROTECTED] - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Test-Failure on Solaris 10 with perl 5.10.0
On Tue, 9 Dec 2008, Mike Schilli wrote: Interesting, which version of LWP::UserAgent do you have installed? Never mind, I found it, it's caused by the latest LWP release (5.822), which got rid of all of its internal debugging functions. I'll fix the Log4perl test suite to omit this test in case LWP=5.822 is installed. Thanks for your report! -- Mike Mike Schilli [EMAIL PROTECTED] -- Mike Mike Schilli [EMAIL PROTECTED] On Tue, 9 Dec 2008, Martin Armbrecht wrote: I just tried to install Log::Log4perl on Solaris 10 (SPARC) with Perl 5.10.0 and ran into the test failure below. t/048lwp.1/3 # Failed test at t/048lwp.t line 45. # '' # doesn't match '(?-xism:GET\ file\:\/tmp\/l4p\-tmpfile\-5804\-3150241)' -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log4perl - Multiple files and different log levels
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...@perlmeister.com 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 12 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. -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
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...@perlmeister.com -- 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 log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log::Log4perl::Appender::DBI appender not working
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...@perlmeister.com 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 log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- 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 log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log::Log4perl::Appender::DBI appender not working
On Thu, 12 Feb 2009, weizhao6...@gmail.com 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...@perlmeister.com Thanks, David On Feb 11, 2009 4:49pm, Kevin M. Goess c...@goess.org 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...@perlmeister.com m...@perlmeister.com 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. -- 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 log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] logging in home grown module packages
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...@perlmeister.com -- ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] logging to different files and file rotation
On Tue, 17 Feb 2009, wzhao6...@gmail.com 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...@perlmeister.com 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{-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 = -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 = -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 = dav...@mail.com 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 -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Appender::File and Layout question
On Wed, 18 Feb 2009, Ronald of Steiermark wrote: Reason for this probably slightly unusual way of using Log::Log4perl is the following: Hi Ronald, indeed, you're using Log4perl in a very unusual, not to say confusing way. What you think is a 'logger' is really an appender in Log4perl lingo. An appender has no concept of a level like 'debug', only loggers do. An appender only has a log() method, and it will normally log the message you're passing to it unconditionally. The reason why you get the error message 'on an undefined value' is an internal autoload mechanism within the appender that's not defined in your case. The error message is confusing and needs to be fixed, what it should say instead is that logdebug() doesn't exist. Ideally, you would integrate your logging needs into the main log4perl configuration -- can you explain in more detail why this isn't possible? -- Mike Mike Schilli m...@perlmeister.com 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). 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'); 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 austria_ru...@yepmail.net There are 10 types of people in the world: those who understand binary and those who don't. -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Intermittent problems when using signal to reread log configuration
On Wed, 18 Feb 2009, Robert Jacobson wrote: Most of the time (I'd guess ~80%), this works fine. When it doesn't work, I get the following error on STDERR (even though I've wrapped STDERR with a Trapper as described in the FAQ): Can't call method log on an undefined value at /opt/ActivePerl- 5.8/lib/site_perl/5.8.7/Log/Log4perl/Appender.pm line 189. Hmm, that's peculiar. I wonder what kind of config change would cause this. Are you removing an appender by any chance? -- Mike Mike Schilli m...@perlmeister.com -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Appender::File and Layout question
On Thu, 19 Feb 2009, Ronald Fischer wrote: What you think is a 'logger' is really an appender in Log4perl lingo. An appender has no concept of a level like 'debug', only loggers do. I see, and that's why it also can't understand about layouts. Actually, just for the record, you can set an appender's layout: $appender-layout($layout); # perldoc Log::Log4perl::Appender Now I would like to incorporate the possibility that in addition to that normal, continually going logfile, the logs occuring to each request should be written into a separate, request-specific logfile, so that, if we hav 100 requests on a day, we would end up having 100 extra logfiles in addition to the main logfile. Add another appender to your category and have it name its log files according to a function get_request_name() that your application provides: log4perl.logger = DEBUG, FooApp, BarApp, AnotherAppender # ... log4perl.appender.AnotherAppender.filename = \ sub { mylog. . get_request_name() . .log } Each of these extra logfiles is named after the request. This means that whenever a new request arrives, we have to create a new logfile. Since the requests are handled in parallel (but non-preemtive, i.e. no threads involved), we have a central logging handler which knows which request is the currently active one, and sends each logging event to the standard log, plus to the request-specific one. I'm assuming that each 'request' starts the app anew. The continually going logfile appender is in 'append' mode and the request-based logfile appender is in 'clobber' mode. -- Mike Mike Schilli m...@perlmeister.com -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Intermittent problems when using signal to reread log configuration
On Sat, 21 Feb 2009, Robert Jacobson wrote: I am using ActiveState perl on CentOS 4.2 and RHEL4; they both exhibit the problem. I haven't tried Windows; does SIGHUP even exist there? (nvm, doesn't matter :) ) Never mind, I was assuming you were using Windows because I've never used ActiveState Perl on Unix! :) -- Mike Mike Schilli m...@perlmeister.com -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Appender::File and Layout question
On Fri, 6 Mar 2009, Ronald Fischer wrote: I understand how to do it in a config file, but I don't see how to do it in my code. Probably it is not possible at all with easy_init (which I would like to continue to use) easy_init() and init() are using the same underlying internal Log4perl API functions, so it doesn't matter which one you're using. # This is my current initialization Log::Log4perl-easy_init( # ... Details left out ); # Now define the request-specific logger use Log::Log4perl::Layout; use Log::Log4perl::Level; my $req_logger= Log::Log4perl-get_logger(???); Since you don't want categories, use the root logger here: my $req_logger= Log::Log4perl-get_logger(); my $req_appender = Log::Log4perl::Appender-new( Log::Log4perl::Appender::File, name = ???, You can omit the name. mode = 'clobber', utf8 = 1, create_at_logtime = 1 filename = \get_current_logfile); # ??? You don't want to pass a reference here, you want to call the function right here: filename = get_current_logfile() ); and define it like sub get_current_logfile { return logfile.dat; } or whatever fance logic you want it to use, but it needs to return the name of the file. So, a working version of what you want would look something like this: use strict; use Log::Log4perl qw(:easy); # This is my current initialization Log::Log4perl-easy_init($DEBUG); use Log::Log4perl::Layout; use Log::Log4perl::Level; my $req_logger= Log::Log4perl-get_logger(); my $req_appender = Log::Log4perl::Appender-new( Log::Log4perl::Appender::File, mode = 'clobber', utf8 = 1, create_at_logtime = 1, filename = get_current_logfile()); $req_appender-layout(Log::Log4perl::Layout::SimpleLayout-new()); $req_logger-add_appender($req_appender); DEBUG waah; ### sub get_current_logfile { ### return logfile.dat; } One more thing: A logger (the root logger in your case) can only have one level. So if you initialize with easy_init($DEBUG), that's the level it's gonna have. If you want different levels for the file appender you're setting up manually, use appender thresholds or a filter. Hope that helps! -- Mike Mike Schilli m...@perlmeister.com -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] rotation on new run of script
On Tue, 10 Mar 2009, DAY Roger wrote: Every time I run a script, I'd like my log-file to roll over. I invoke Log::Dispatch::FileRotate thusly ... DatePattern = 'HH-dd-',); Hmm, this is neither a valid date pattern (-MM-dd-HH would be correct), according to the Log::Dispatch::FileRotate man page, nor does it claim to roll it on every invocation. You probably need something like a custom file appender for this. -- Mike Mike Schilli m...@perlmeister.com -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] rotation on new run of script
On Wed, 11 Mar 2009, DAY Roger wrote: Which I take to mean it does do invocation-like rollovers. If this doesn't work, I'll resort to a custom file appender. Actually, you could use something like this: log4perl.appender.Logfile = Log::Log4perl::Appender::File log4perl.appender.Logfile.filename = sub { log- . time() . .log } to name your logfiles after the current timestamp? -- Mike Mike Schilli m...@perlmeister.com I see what you mean about the valid date patterns. Implement in haste, repent at leisure. Also, apologies for the stupid .sig. I have no control over it. Roger -Original Message- From: Mike Schilli [mailto:m...@perlmeister.com] Sent: 11 March 2009 07:37 To: DAY Roger Cc: log4perl MailingList Subject: Re: [log4perl-devel] rotation on new run of script On Tue, 10 Mar 2009, DAY Roger wrote: Every time I run a script, I'd like my log-file to roll over. I invoke Log::Dispatch::FileRotate thusly ... DatePattern = 'HH-dd-',); Hmm, this is neither a valid date pattern (-MM-dd-HH would be correct), according to the Log::Dispatch::FileRotate man page, nor does it claim to roll it on every invocation. You probably need something like a custom file appender for this. -- Mike Mike Schilli m...@perlmeister.com The operating companies affiliated with Atradius N.V. (Atradius Group) conduct insurance, debt collection and information services business through their registered (branch) offices in many countries. For information about the main registration details of Atradius Group offices in your country please visit http://global.atradius.com/general-content/legal/legallist.html IMPORTANT NOTICE. This e-mail, including any and all attachments, is intended for the addressee or its representative only. It 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 and its contents, please notify the sender immediately by reply e-mail and delete this e-mail and all its attachments subsequently. Although this e-mail 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/or opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by Atradius Group companies, either jointly or severally, for any loss or damage arising in any way from its use. E-mail received by Atradius Group can be stored for business purposes. -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] rotation on new run of script
On Wed, 11 Mar 2009, DAY Roger wrote: That would work, cheers. I was thinking it'll be fun to write a custom appender. No doubt, go for it :). -- Mike Mike Schilli m...@perlmeister.com I'll think on it. Roger -Original Message- From: Mike Schilli [mailto:m...@perlmeister.com] Sent: 11 March 2009 15:41 To: DAY Roger Cc: Mike Schilli; log4perl MailingList Subject: RE: [log4perl-devel] rotation on new run of script On Wed, 11 Mar 2009, DAY Roger wrote: Which I take to mean it does do invocation-like rollovers. If this doesn't work, I'll resort to a custom file appender. Actually, you could use something like this: log4perl.appender.Logfile = Log::Log4perl::Appender::File log4perl.appender.Logfile.filename = sub { log- . time() . .log } to name your logfiles after the current timestamp? -- Mike Mike Schilli m...@perlmeister.com I see what you mean about the valid date patterns. Implement in haste, repent at leisure. Also, apologies for the stupid .sig. I have no control over it. Roger -Original Message- From: Mike Schilli [mailto:m...@perlmeister.com] Sent: 11 March 2009 07:37 To: DAY Roger Cc: log4perl MailingList Subject: Re: [log4perl-devel] rotation on new run of script On Tue, 10 Mar 2009, DAY Roger wrote: Every time I run a script, I'd like my log-file to roll over. I invoke Log::Dispatch::FileRotate thusly ... DatePattern = 'HH-dd-',); Hmm, this is neither a valid date pattern (-MM-dd-HH would be correct), according to the Log::Dispatch::FileRotate man page, nor does it claim to roll it on every invocation. You probably need something like a custom file appender for this. -- Mike Mike Schilli m...@perlmeister.com The operating companies affiliated with Atradius N.V. (Atradius Group) conduct insurance, debt collection and information services business through their registered (branch) offices in many countries. For information about the main registration details of Atradius Group offices in your country please visit http://global.atradius.com/general-content/legal/legallist.html IMPORTANT NOTICE. This e-mail, including any and all attachments, is intended for the addressee or its representative only. It 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 and its contents, please notify the sender immediately by reply e-mail and delete this e-mail and all its attachments subsequently. Although this e-mail 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/or opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by Atradius Group companies, either jointly or severally, for any loss or damage arising in any way from its use. E-mail received by Atradius Group can be stored for business purposes. -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] Log::Log4perl 1.21 released
Hi Log4perl enthusiasts, the Log4perl 1.21 maintenance release was just pushed to the log4perl.com website, here's what's new: 1.21 (2009/03/16) * (ms) Documentation typos fixed, reported by Breno G. de Oliveira [rt.cpan.org #42428]. * (ms) Fixed DBI appender error message, bug reported by DavidZ. * (ms) Fixed [rt.cpan.org #43740] reported by Martin Koehler. Now using proper POSIX return code EEXISTS instead of error message depending on English locale. If all goes well, it'll hit CPAN in a couple of days. Enjoy! -- Mike Mike Schilli m...@perlmeister.com -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] apache worker, mod_perl2, appender/semaphore problem under medium load
On Fri, 20 Mar 2009, fol...@netnea.com wrote: - log4perl 1.10-1 (Ubuntu) There's been a lot of changes to the Synchronized appender between Log4perl 1.10 (released two years ago) and the current Log4perl 1.21 -- can you try the latest? -- Mike Mike Schilli m...@perlmeister.com Configuration: Apache: PerlRequire /apache/startup.pl PerlWarnOn PerlTaintCheck On Alias /action/ /apache/action/ Location /action/ SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI Order allow,deny Allow from all /Location Log4Perl: ... my $conf = qq( log4perl.category = $threshold, Syncer # File appender (unsynchronized) log4perl.appender.Logfile = Log::Log4perl::Appender::File log4perl.appender.Logfile.autoflush = 1 log4perl.appender.Logfile.filename = $filename log4perl.appender.Logfile.mode = append log4perl.appender.Logfile.layout= Log::Log4perl::Layout::PatternLayout log4perl.appender.Logfile.layout.ConversionPattern = %d{dd/MMM/:HH:mm:ss} %p %m%n # Synchronizing appender, using the file appender above log4perl.appender.Syncer= Log::Log4perl::Appender::Synchronized log4perl.appender.Syncer.appender = Logfile log4perl.appender.Syncer.destroy= 1 ); Log::Log4perl::init( \$conf ); my $logger = Log::Log4perl::get_logger(); ... The threshold is set to INFO meaning that every call results in a single log entry being made. The script runs for about one second. When I tried out running the script as a handler (instead of the registry method), this did not change the behaviour. I understand that there are performance limits and eventually failures, but is not that a bit early, with only ten concurrent usersr? So I guess I have a misconfigured setup. Could anybody give me a good hint? I googled for my error, but without luck. Regs, Christian Folini -- I myself am human and free only to the extent that I acknowledge the humanity and liberty of all my fellows... --- Mikhail Bakunin -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Problems with API config using appender Synchronized
On Thu, 9 Apr 2009, Jens Berthold wrote: 1) The sub Log::Log4perl::Appender::Synchronized-post_init() is not called when the appender is created via API. Is this correct? My way to handle this was to write an own class derived from Synchronized an copy the code from post_init() to new(). Hi Jens, as you've noticed, the internal function create_appender_instance() performs some magic that makes composite appenders work, but this method isn't suited in its current form to be used from the outside. I'll dig into the internals to find a way to fix this. As it is now, you'd have to do something like use Log::Log4perl qw(get_logger :levels); my $fileApp = Log::Log4perl::Appender-new( 'Log::Log4perl::Appender::File', name = 'MyFileApp', filename = 'mylog', mode = 'append', ); $fileApp-layout( Log::Log4perl::Layout::PatternLayout::Multiline-new( '%d{-MM-dd HH:mm:ss} %p [%c] #%P %m%n') ); $Log::Log4perl::Logger::APPENDER_BY_NAME{MyFileApp} = $fileApp; my $syncApp = Log::Log4perl::Appender-new( 'Log::Log4perl::Appender::Synchronized', name = 'MySyncApp', appender = 'MyFileApp', key= 'nem', ); $syncApp-post_init(); $syncApp-composite(1); get_logger()-add_appender($syncApp); get_logger()-level($DEBUG); get_logger(wonk)-debug(waah!); which is most certainly terrible and, as mentioned above, needs to be fixed in one of the upcoming Log4perl releases. One more thing: Is there a reason why you're using 'syswrite' and the Synchronized appender in combination? By using 'syswrite', you won't need the Synchronized appender at all, because the OS will make sure that messages will be written out entirely without overlap. 3) When initialising Log::Log4perl::Appender::Synchronized before forking child processes, eventually all existing processes try to remove the semaphore. I could only solve this with a derived class that stores the process id of the parent and only allowed the parent to remove the semaphore. Hmm, this sounds like a bug, but I'm not sure what your 'existing' processes are doing in this case -- can you provide some test code? -- Mike Mike Schilli m...@perlmeister.com -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] Log::Log4perl 1.22 released
Hi Log4perl enthusiasts, Log::Log4perl 1.22 has just been released to CPAN, with the following changes: 1.22 (2009/05/02) * (ms) is_xxx() returned true prior to L4p initialization. Fixed it and adapted test suite. * (ms) Added test cases on syswrite in recreate mode * (ms) Applied patch by Jens Berthold log4p...@jebecs.de to avoid semaphore cleanup in spawned children. * (ms) Added %m{chomp} feature, 'message_chomp_before_newline' option, and documentation on newlines and logging messages, all suggested by Tim Bunce (see PatternLayout). By the way, we're on github now, so if you want to contribute to the project, it's now easier than ever: http://github.com/mschilli/log4perl Enjoy! -- Mike Mike Schilli m...@perlmeister.com -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] signal handling and log4perl
On Fri, 8 May 2009, Seth Daniel wrote: The reason for this is that I have a number of existing programs that use Log4perl for most logging, but some very specific logging does not use Log4perl. I need to be able to use a single signal to tell both Log4perl and the other log code to check its configuration and/or rewrite the log file for log rotation. You could use something like $SIG{USR2} = sub { kill 'USR1', $$; # ... now trigger your other logging system ... }; Log::Log4perl-init_and_watch(l4p.conf, 'USR1'); which uses a user-defined signal handler listening to USR2. You can add whatever other logic you need to it. When triggered, it also forwards the signal to Log4perl's signal handler, which listens to USR1. Good enough? -- Mike Mike Schilli m...@perlmeister.com -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] signal handling and log4perl
On Sat, 9 May 2009, Seth Daniel wrote: I was hoping for a solution that didn't burn two signals. I'm already using the most obvious signals: HUP, USR1, USR2, KILL, QUIT, etc... so I'm not exactly overflowing with extra signals. :o) I see ... in the next version of Log4perl (1.23), you'll be able to call Log::Log4perl::Config-watcher-force_next_check(); instead of using a signal: http://github.com/mschilli/log4perl/commit/6c8609f1ba064d3f781769cb9e1b45638f3daa75 (will probably go out soon). -- Mike Mike Schilli m...@perlmeister.com -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log4perl and catching unhandle exceptions but not using 'easy' mode
On Wed, 20 May 2009, Richard Burton wrote: I can catch this using stealth as loggers outlined in http://search.cpan.org/~mschilli/Log-Log4perl/lib/Log/Log4perl/FAQ.pm#So me_module_prints_messages_to_STDERR._How_can_I_funnel_them_to_Log::Log4p erl? but the example assumes you are using the easy configuration method. Actually, this will work unmodified if you're using a configuration file instead. You're probably talking about the DEBUG(...) macro used in the code example, which comes with :easy, but this is really unrelated to easy_init() and can be used with init($conf_file) as well. If you don't want the stealth loggers, get a logger and send your debug message via use Log::Log4perl qw(get_logger); get_logger()-debug(my debug message); instead. The question I have is can I do a similar thing but use an external configuration file for log4perl? I have tried but failed so would appreciate any guidance? This should work, what was the problem/error message you encountered? -- Mike Mike Schilli m...@perlmeister.com -- Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, Big Spaceship. http://www.creativitycat.com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log4perl and catching unhandle exceptions but not using 'easy' mode
On Wed, 20 May 2009, Robert Jacobson wrote: Here's what I did: 1. Make a file trapper.pl. It's basically the same as the example, except the Log4perl init, which uses a config file (in this case, with a SIGHUP to re-read it): Looks ok at first glance, doesn't it produce the expected output? Please post the complete (runnable) code to make it easier to diagnose the problem. -- Mike Mike Schilli m...@perlmeister.com package Trapper; use Log::Log4perl qw(get_logger :levels); Log::Log4perl-init_and_watch(../log4perl.conf,'HUP'); my $logger = get_logger(program.category); sub TIEHANDLE { ... [etc] 2. In my perl program: require trapper.pl; tie (*STDERR, 'Trapper'); HTH, Rob -- Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, Big Spaceship. http://www.creativitycat.com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, Big Spaceship. http://www.creativitycat.com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log4perl and catching unhandle exceptions but not using 'easy' mode
On Thu, 21 May 2009, Richard Burton wrote: It is more of a general question so that I can build it in to my code; I don't have a specific example? Maybe I misunderstood, but you said I have tried but failed, and from what I saw, you're doing everything correctly. -- Mike Mike Schilli m...@perlmeister.com Does that help? Richard -Original Message- From: Mike Schilli [mailto:m...@perlmeister.com] Sent: 20 May 2009 22:25 To: Richard Burton Cc: log4perl-devel@lists.sourceforge.net Subject: Re: [log4perl-devel] Log4perl and catching unhandle exceptions but not using 'easy' mode On Wed, 20 May 2009, Richard Burton wrote: I can catch this using stealth as loggers outlined in http://search.cpan.org/~mschilli/Log-Log4perl/lib/Log/Log4perl /FAQ.pm#So me_module_prints_messages_to_STDERR._How_can_I_funnel_them_to_ Log::Log4p erl? but the example assumes you are using the easy configuration method. Actually, this will work unmodified if you're using a configuration file instead. You're probably talking about the DEBUG(...) macro used in the code example, which comes with :easy, but this is really unrelated to easy_init() and can be used with init($conf_file) as well. If you don't want the stealth loggers, get a logger and send your debug message via use Log::Log4perl qw(get_logger); get_logger()-debug(my debug message); instead. The question I have is can I do a similar thing but use an external configuration file for log4perl? I have tried but failed so would appreciate any guidance? This should work, what was the problem/error message you encountered? -- Mike Mike Schilli m...@perlmeister.com -- Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, Big Spaceship. http://www.creativitycat.com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, Big Spaceship. http://www.creativitycat.com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log4perl
On Mon, 6 Jul 2009, Oladipo, Segun wrote: Need to install Log4perl but stuck behind a firewall. Obtained information that it is possible to download the zipped file to a local repository and install using ppm. The PPM is for Activestate Perl only, and it wasn't updated with the last release by accident. I've just run the script that pushed the current (1.23) release to http://log4perl.sourceforge.net/ppm/Log-Log4perl.ppd, please try again! Regarding your Firewall, if you have http access to the outside world (as you seem to have if you can download a zipped file) you should as well be able to use the normal CPAN installer (which can be configured to use http). -- Mike Mike Schilli m...@perlmeister.com -- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] package 'Log::Dispatch::Email::MailSender' not registered for warnings
On Tue, 7 Jul 2009, Linke Markus (KSTB 11) wrote: After successfully running the whole script it throws a warning: package 'Log::Dispatch::Email::MailSender' not registered for warnings at /app/CMpkg2/perl_588/lib/site_perl/5.8.8/Log/Dispatch/Email/MailSender.p m line 58 END failed--call queue aborted. Which version of Log::Dispatch are you using, the latest from CPAN, 2.22? -- Mike Mike Schilli m...@perlmeister.com -- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] package 'Log::Dispatch::Email::MailSender' not registered for warnings
On Wed, 8 Jul 2009, Linke Markus (KSTB 11) wrote: I only have 2.21, you think that might be the reason? Possibly. I'm not affiliated with Log::Dispatch, but its 2.22 change log has the line - Fixed a misuse of warnings::enabled(). Reported by Darian Patrick. RT #39784. which indicates a fix in this area. Give it a try! -- Mike Mike Schilli m...@perlmeister.com -- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Limiting file size in log4perl
On Mon, 24 Aug 2009, Ronald Fischer wrote: Is there an easy way to limit the size of a log file? I'm not looking for a rollover solution, but for one, where a new file is created if the old one exceeds a certain size. That's pretty much the case with Log::Dispatch::FileRotate, a given file size, and a max value of 1. If somefile.log grows larger than 'size' bytes, it'll move it over to somefile.log.1 and moves it over to somefile.log. Alternatively, you can use an external rotator with similar settings. If you don't want to roll over, but truncate the logfile in this case (although this seems weird, as you might end up with an almost-empty logfile at times), you need to write your own appender as outlined in http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl/FAQ.pm#How_can_I_write_my_own_appender? My idea is to intercept each call to Log4perl, test the size of the log file, and switch to a new log file if the old one got too big. That's exactly what Log::Dispatch::FileRotate does if you call it with a max value of 1. -- Mike Mike Schilli m...@perlmeister.com -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Limiting file size in log4perl
On Wed, 26 Aug 2009, Ronald Fischer wrote: Thanks a lot! The perldoc says that FileRotate provides a simple object for logging to files under the Log::Dispatch::* system, so I'm surprised that it will also work with Log::Log4perl, but I'll give it a try. Yep, Log4perl fully supports the Log::Dispatch appenders: http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl.pm#Additional_Appenders_via_Log::Dispatch If there's an equivalent in Log4perl (like for a file appender), using the native appenders is recommended because they provide additional functionality. -- Mike Mike Schilli m...@perlmeister.com -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] log4perl License?
On Fri, 11 Sep 2009, Terry Kummell wrote: Do we need to license log4perl in order to use it in our product? Hi Terry, Log4perl is provided under the same license as perl itself: http://dev.perl.org/licenses/ Hope that helps! -- Mike Mike Schilli m...@perlmeister.com -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] Log4perl 1.25 released
Hi Log4perl enthusiasts, release 1.25 just went out to log4perl.com, here's the changes: 1.25 (2009/09/27) * (ms) Appender::File is now closing (or sysclosing) the file on file_close() instead of just undef'ing the handle. * (ms) Added l4p-tmpl helper script to help whipping up a new log4perl configuration file. * (ms) Fixed uninitialized warning on XML configuration files, reported by jbkilian on the sourceforge mailing list. * (ms) Applied patch [RT 43426] by AFF a...@cpan.org to have appender_thresholds_adjust return number of appenders changed. * (ms) [RT 34400] New :nostrict target which allows redefining a category within a Log4perl configuration file without error or even a warning. * (ms) [RT 34401] Applied patch by Jae Gangemi, who fixed code references in @INC on Win32 systems. * (ms) [RT 32259] Patternlayout now supports %R, which returns the number of milliseconds elapsed from last logging event to the current logging event (thanks to Emmanuel Rodriguez for the patch). * (ms) [RT 30899] Color configuration and attribute support added to ScreenColoredLevels appender by Jason Kohles. * (ms) [RT 28987] If UNIVERSAL is available, appender existence is now verified by checking can() on the appender's new() method (applied modified patch by Gabriel Berriz). If all goes well, it'll hit CPAN in a couple of days. Enjoy! -- Mike Mike Schilli m...@perlmeister.com -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] Log4perl 1.26 released
Hi Log4perl enthusiasts, Log4perl 1.26 has just been released on github: http://github.com/mschilli/log4perl/tarball/rel_126 Changes in this release: 1.26 (2009/11/22) * (ms) [RT 50495] Perl code in the config file is now evaluated/ compiled after the configuration parser has done its work, opening up Perl subroutines to all configuration parsers, not just PropertyConfigurator. Configuration subs for cspecs, filter, warp_message and appender triggers are sheltered. The previous, flawed implementation surfaced while using a 'trigger' category, reported by Olivier Bilodeau. * (ms) [RT 50090] Added non-portable linebreaks to PatternLayout (requested by Zdeněk Juran). * (ms) [RT 50094] Docfix for PatternLayout in main manpage (spotted by Peter Rabbitson). * (ms) [RT 28679] Added exists() to Threshold keyword uppercase check. * (ms) Took out Class::Prototyped testcase after it got all weird and introduced backward-incompatible changes. If all goes well, it'll hit CPAN in a couple of days. -- Mike Mike Schilli m...@perlmeister.com-- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] package 'Log::Dispatch::Email::MailSender' notregistered for warnings
On Wed, 25 Nov 2009, Linke Markus (KSTB 11) wrote: In regards to the version check: I did compare all modules and they are identical. That's why I wanted to see if there might be anything else beside the modules which comes into your mind. The perl version is also the same. Something tells me that identical installation should behave identically :). You might also want to check if perl is actually pulling the correct version of the module, sometimes people install identical modules in multiple locations. -- Mike Mike Schilli m...@perlmeister.com -Original Message- From: Mike Schilli [mailto:m...@perlmeister.com] Sent: Mittwoch, 25. November 2009 04:39 To: Linke Markus (KSTB 11) Cc: Mike Schilli; log4perl-devel@lists.sourceforge.net Subject: RE: [log4perl-devel] package 'Log::Dispatch::Email::MailSender' notregistered for warnings On Tue, 24 Nov 2009, Linke Markus (KSTB 11) wrote: Strange enough I now have the same problem again on our production server. I have just checked the modules and they are the same as on the dev box where upgrading Log::Dispatch had solved the issue before. As I might have mentioned before, Log::Dispatch is a separate module maintained by a different crew. But since you said the upgrade fixed your development box, I suspect that the upgrade on the production box didn't go over well and maybe you're still pulling the old version? Try $ /usr/local/bin/perl -d -e 1 DB1 use Log::Dispatch DB2 print $Log::Dispatch::VERSION and check the version number printed. -- Mike Mike Schilli m...@perlmeister.com Any ideas? Thanks, Markus -Original Message- From: Linke Markus (KSTB 11) Sent: Freitag, 10. Juli 2009 07:56 To: Mike Schilli Cc: log4perl-devel@lists.sourceforge.net Subject: Re: [log4perl-devel] package 'Log::Dispatch::Email::MailSender' notregistered for warnings Problem solved; thanks a lot! -Original Message- From: Mike Schilli [mailto:m...@perlmeister.com] Sent: Mittwoch, 8. Juli 2009 18:53 To: Linke Markus (KSTB 11) Cc: Mike Schilli; log4perl-devel@lists.sourceforge.net Subject: RE: [log4perl-devel] package 'Log::Dispatch::Email::MailSender' not registered for warnings On Wed, 8 Jul 2009, Linke Markus (KSTB 11) wrote: I only have 2.21, you think that might be the reason? Possibly. I'm not affiliated with Log::Dispatch, but its 2.22 change log has the line - Fixed a misuse of warnings::enabled(). Reported by Darian Patrick. RT #39784. which indicates a fix in this area. Give it a try! -- Mike Mike Schilli m...@perlmeister.com -- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Change in behavior when upgrading to 1.26 and perl 5.10.0
On Wed, 9 Dec 2009, Martin Evans wrote: Since the upgrade we are getting no logging in one of the files we expected to get it. After a bit of searching around I discovered the module we were using was doing this: local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1; $h{logger} = Log::Log4perl-get_logger(); and the fix was to change the order of those lines. Thanks for reporting this, although I have a hard time imaginining how increasing the caller_depth and then getting a logger would be different from what you'd get if you did it in the reverse order. Not to mention that it's puzzling why this would change the logging behavior, as caller_depth is used mainly for cosmetic reasons in certain features of the pattern layout. Can you provide a snippet of code that reproduces the problem in full? That would really help track down the root of the problem. Thanks! -- Mike Mike Schilli m...@perlmeister.com -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Please add comments to FAQ
On Tue, 12 Jan 2010, Malcolm Nooning wrote: Please add the above note to the faq. Done, thanks for the note! http://github.com/mschilli/log4perl/commit/aa140e15be803988ccee7ea3f1da83d5d5165a11 -- Mike Mike Schilli m...@perlmeister.com There is already a section in the FAQ.html entitled Log4perl complains that no initialization happened during shutdown! The tell tale message is 'Seems like no initialization happened. Forgot to call init()? The faq goes on to explain the circular reference problem. This can also happen when a new user neglects to add_appender, as in the form below. $logger-add_appender($appender); -- Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] performance enhancement for timestamps
On Fri, 22 Jan 2010, Rob Retter wrote: I sent this message a little while ago Sorry for the delay, thanks for your patience. In DateFormat.pm, the routine fmt() should not bother to recreate the This is a neat idea, we just need to change that the mere presence of the Time::HiRes module introduces milliseconds and hence kills the optimization. More to come soon ... -- Mike Mike Schilli m...@perlmeister.com time string over and over and overYou tend to see the same timestamp on numerous consecutive log entries (unless you're using milliseconds, which seems like overkill in many situations). Anyway, the code should be something like: { my $lastSecs = 0; my $lastMsecs = 0; my $lastFmt = ''; ### sub format { ### my($self, $secs, $msecs) = @_; $msecs = 0 unless defined $msecs; return $lastFmt if ($lastSecs == $secs and $lastMsecs == $msecs); my @time; if($GMTIME) { @time = gmtime($secs); } else { @time = localtime($secs); } # add milliseconds push @time, $msecs; my @values = (); for(@{$self-{stack}}) { my($val, $code) = @$_; if($code) { push @values, $code-($time[$val]); } else { push @values, $time[$val]; } } $lastSecs = $secs; $lastMsecs = $msecs; $lastFmt = sprintf($self-{fmt}, @values); return $lastFmt; } } -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] [FR] CODE refs in config file.
On Wed, 27 Jan 2010, Silkenbäumer, Karsten wrote: I found out I can use CODE refs in my config file. log4perl.appender.testnameAppender.filename=sub { return 'example.log' } This function doesn't get any arguments right now (warn @_) Would be great to access the name of the logger (and maybe appender) there. Interesting idea ... I presume we could add the left side of the line as an argument to the function call, but that's probably about it. Logger info might not be available at this point. The other option is to write a subclass of Log::Log4perl::Appender::File and have it deal with the dynamically created file names. Or, you could set up your Log4perl configuration programmatically, using logger and appender methods. However, every dynamic modification comes at a price: A new person might have trouble understanding what's going on by looking at the configuration file. Leaving redundancies in place sometimes makes the configuration easier to understand. Next thing is: using filenames, either with Dispatch::File or all the others has one fatal behaviour: If the directory does not exists, it throws an error message and quits. I'd be careful with that. This opens up a whole new set of problems: Are you going to create directory hierarchies of arbitrary depth? What are the permissions on each level? Rather than making the appender smarter in this regard, I'd rather modify those cronjobs to keep the directories in place. Your mileage might vary, and you might want to create a subclass of Log::Log4perl::Appender::File (rather than Log::Dispatch which misses a number of features) to accomplish what you want. Hope that helps! -- Mike Mike Schilli m...@perlmeister.com-- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log4perl best practices for high traffic sites
On Wed, 20 Jan 2010, Trevor Little wrote: I'm adding logging to a high-traffic mod_perl website and am worried about the performance penalties of writing stuff to disc on every request. It depends on your traffic numbers. I've found that a file appender works quite well up to 1000 reqs/sec because the OS typically caches disc access quite efficiently. Your mileage might vary, so prudent load testing is of the essence. -- Mike Mike Schilli m...@perlmeister.com -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] question re: running system commands from a wrapper
On Wed, 27 Jan 2010, Keith Clay wrote: Is there a way to pass info to a called command? can it ingest the config file for the calling program, add it's own appender/s and write to files the calling program has open? Not sure I'm following ... what are you trying to do? -- Mike Mike Schilli m...@perlmeister.com -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Masking secrets in log4perl output
On Mon, 1 Feb 2010, Maciej Grela wrote: Is it possible to use the log4perl appenders, layouts etc. to mask secret values (passwords) from the log files generated by log4perl ? The best way to avoid passwords in the logs is to avoid logging them in the first place. If you're writing the application, simply strip out the password fields from the web forms before you dump them to the logging mechanism. Stripping out logged passwords, by using a simple search/replace on the logged passwords is not a safe practice, because a) the application would actually have to know and store the cleartext passwords and b) you'd get funny (and revealing!) results if the password matches regular text. -- Mike Mike Schilli m...@perlmeister.com For example, I routinely use log4perl to dump the data in web forms before POSTing them. These forms often contain sensitive user information and I wouldn't want any of my users to post a log with his password on some public bugzilla. To this day I have manually filtered out these secrets using a wrapper function used in sensitive places. I feel however, that I need a better approach. As a quick proof-of-concept I simply hacked my own version of the Multiline appender adding the following code: --- /usr/lib/perl5/vendor_perl/5.8.8/Log/Log4perl/Layout/PatternLayout/Multiline.pm 2009-12-30 14:27:32.0 +0100 +++ lib/Log/Log4perl/Layout/PatternLayout/Masked.pm 2010-02-01 07:24:01.0 +0100 @@ -1,8 +1,11 @@ #!/usr/bin/perl -package Log::Log4perl::Layout::PatternLayout::Multiline; +package Log::Log4perl::Layout::PatternLayout::Masked; use base qw(Log::Log4perl::Layout::PatternLayout); +use Log::Log4perl::MDC; + + ### sub render { ### @@ -13,8 +16,15 @@ $caller_level = 0 unless defined $caller_level; my $result; +my $secret_list = Log::Log4perl::MDC-get(secrets); for my $msg ( @messages ) { + # Mask the secret values if needed + if ( $secret_list ) { + foreach (keys %{$secret_list}) { + $msg =~ s/$_/$secret_list-{$_}/g; + } + } $result .= $self-SUPER::render( $msg, $category, $priority, $caller_level + 1 ); The proper solution however would be to make this feature independent of the layout and appender used. I have tried to use filters but unfortunately the filter function cannot change the contents of the message. I think the best approach would be to allow the filter function to change the contents of the message by passing a reference to the message hash instead of a copy. This of course will break compatibility with existing filters and they would have to be rewritten. Fortunately, there is not a lot of them in the Log4perl distribution, I don't know about any external ones. What do you think about all of this ? I'm willing to write the code tests needed to implement this feature properly if there is interest in it. Best regards, Maciej Grela -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] 1.26 installation fails date test with perl 5.10.0
Interesting, I don't get that with perl 5.10.0 on Linux. What does perl -le 'print scalar gmtime (1030429942 - 7*3600)' show on your platform? It should be Mon Aug 26 23:32:22 2002 (that's what I get on Linux) but on your platform, I suspect, it's Mon Aug 26 23:32:00 2002 instead. Maybe a bug on a specific platform? Which one are you on? Can you try with a later perl version? -- Mike Mike Schilli m...@perlmeister.com On Thu, 4 Feb 2010, you wrote: This is perl, v5.10.0 built for x86_64-linux-gnu-thread-multi t/023Date.t .. 1/36 # Failed test at t/023Date.t line 67. # got: '0 00 000 ' # expected: '22 22 022 0022' # Failed test at t/023Date.t line 103. # got: '26 Aug 2002 23:32:00,123' # expected: '26 Aug 2002 23:32:22,123' # Failed test at t/023Date.t line 106. # got: '2002-08-26 23:32:00,123' # expected: '2002-08-26 23:32:22,123' # Failed test at t/023Date.t line 109. # got: '23:32:00,123' # expected: '23:32:22,123' # Failed test at t/023Date.t line 112. # got: '[Mon Aug 26 23:32:00 2002]' # expected: '[Mon Aug 26 23:32:22 2002]' # Looks like you failed 5 tests of 36. t/023Date.t .. Dubious, test returned 5 (wstat 1280, 0x500) Failed 5/36 subtests TIA-- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] Log4perl 1.27 Released
Hi Log4perl enthusiasts, Log::Log4perl 1.27 has just been released to CPAN. The following changes went into this release: 1.27 (2010/02/07) *(ms) ***WARNING: This might break backward compatibility with some wrapper classes. [RT 52913] Fixed category fetching in wrapper classes (reported by Martin Evans). Wrapper classes now need to call Log::Log4perl-wrapper_register to adapt get_logger() category fetching. Detailed docs under Using Log::Log4perl with wrapper functions and classes *(ms) Made meta tag compatible with MakeMaker versions 6.50 (ms) [RT 52083] Fixed manifest glitch from 1.26 (reported by Lars Thegler). *(ms) Added note to FAQ on 'no init happened' warnings for API initializations, as suggested by Malcolm Nooning. *(ms) Applied patch by Christopher Mckay which sets Log4perl::Logger::INITIALIZED only if it's fully initialized. *(ms) Emmanuel Rodriguez suggested changing TestBuffer's reset() method to leave the logger population alone. Added clear() to accomodate the need for a single buffer reset. *(ms) Xavier Caron added %p{1} to allow abbreviated priority strings in the pattern layout. *(ms) Redid composite appenders to address problems with incorrect caller() data. L4p now supports a $cache parameter to be passed to the log() function, which stores the completely rendered message and can be passed to log_cached() later on. Enjoy! -- Mike Mike Schilli m...@perlmeister.com -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] invoking threshold() leaves appender data inconsistent
On Fri, 29 Jan 2010, Rob Retter wrote: But when your application does: my $wrapper = $Log::Log4perl::Logger::APPENDER_BY_NAME{'somename'}; $wrapper-threshold ('INFO'); what you get is the wrapper object's level field set to the... um, priority of the 'INFO' level you passed in. The terminology can be daunting at first, so it helps if you remember that messages have 'priorities' and loggers have 'levels'. If a message has a priority higher than the logger's level, the message gets logged (I'm not going into numerical values of levels/priorities as these are transparent to the application and hence irrelevant for the purpose of this discussion.). Now, appenders have a feature called 'thresholds', which is virtually identical to a logger's level. If the message priority is higher than the appender's threshold, the message gets logged. But it does leave the actual appender object's Threshold field unchanged. So if that field were already 'DEBUG', what you get is a wrapper saying one thing about level, while it contains an appender saying another thing about Threshold. I'm not sure where this Threshold field you are referring to is located. Do you mean the configuration file? Can you point me to the code? -- Mike Mike Schilli m...@perlmeister.com -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Rolling File Appender
On Fri, 12 Feb 2010, Jay wrote: log4perl.logger.pnoc=DEBUG, FileAppndr1 log4perl.appender.FileAppndr1=Log::Log4perl::JavaMap::RollingFileAppender With the JavaMap appenders, you have to say log4perl.appender.FileAppndr1=org.apache.log4j.RollingFileAppender instead of # wrong log4perl.appender.FileAppndr1=Log::Log4perl::JavaMap::RollingFileAppender and it should work fine. By the way, is there any reason you're not using Log::Dispatch::FileRotate directly? Here's an example: http://search.cpan.org/dist/Log-Log4perl/lib/Log/Log4perl/FAQ.pm#How_can_I_roll_over_my_logfiles_automatically_at_midnight? Hope this helps. -- Mike Mike Schilli m...@perlmeister.com -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Problem with Log::Dispatch::FileRotate-Appender and -d:Profile
On Fri, 19 Feb 2010, mara raram wrote: I just ran into a problem trying to profile one of my perl scripts using 'perl -d:Profile'. I cooked it down to this: ---8--- #!/usr/bin/env perl # --- crashes when used with -d:Profile Hi Mara, it's fairly unlikely that this has anything to do with Log4perl or any other modules used, most likely it's a bug in the Profiler. I personally prefer http://search.cpan.org/~timb/Devel-NYTProf-3.01/ Want to give it a try? -- Mike Mike Schilli m...@perlmeister.com use warnings; use strict; use Log::Dispatch::FileRotate; use Log::Log4perl; # logging behaviour configuration my $logconf = q( log4perl.logger= DEBUG, FileApp log4perl.appender.FileApp = Log::Dispatch::FileRotate log4perl.appender.FileApp.filename = test.log log4perl.appender.FileApp.layout = PatternLayout log4perl.appender.FileApp.mode = append log4perl.appender.FileApp.max = 3 log4perl.appender.FileApp.utf8 = 1 log4perl.appender.FileApp.layout.ConversionPattern = %d [%p] %c - %m%n ); # Initialize logger Log::Log4perl-init( \$logconf ); # Obtain a logger instance my $logger = Log::Log4perl-get_logger(); $logger-info('alive'); ---8--- Am I doing something wrong here? It runs without problem without the '-d:Profile' option. But when I do $ perl -d:Profile log4perl_test.pl I get ---8--- The following parameter was passed in the call to Log::Dispatch::Output::_basic_init but was not listed in the validation options: mode at /usr/lib/perl5/site_perl/5.10.0/Devel/Profile.pm line 131 Log::Dispatch::Output::_basic_init(undef, 'mode', 'append', 'name', 'FileApp', 'l4p_post_config_subs', 'ARRAY(0x11d64e0)', 'max', 3, ...) called at /usr/lib/perl5/site_perl/5.10.0/Log/Dispatch/FileRotate.pm line 32 Log::Dispatch::FileRotate::new('Log::Dispatch::FileRotate', 'min_level', 'debug', 'filename', 'test.log', 'mode', 'append', 'max', 3, ...) called at /usr/lib/perl5/site_perl/5.10.0/Log/Log4perl/Appender.pm line 77 Log::Log4perl::Appender::new('Log::Log4perl::Appender', 'Log::Dispatch::FileRotate', 'name', 'FileApp', 'l4p_post_config_subs', 'ARRAY(0x11d64e0)', 'l4p_depends_on', 'ARRAY(0x1325e30)', 'filename', ...) called at /usr/lib/perl5/site_perl/5.10.0/Log/Log4perl/Config.pm line 394 Log::Log4perl::Config::create_appender_instance('HASH(0x133afe8)', 'FileApp', 'HASH(0x11d6438)', 'ARRAY(0x11d64e0)', undef) called at /usr/lib/perl5/site_perl/5.10.0/Log/Log4perl/Config.pm line 288 Log::Log4perl::Config::_init('Log::Log4perl::Config', 'SCALAR(0x8db190)') called at /usr/lib/perl5/site_perl/5.10.0/Log/Log4perl/Config.pm line 36 Log::Log4perl::Config::init('Log::Log4perl::Config', 'SCALAR(0x8db190)') called at /usr/lib/perl5/site_perl/5.10.0/Log/Log4perl.pm line 245 Log::Log4perl::init('Log::Log4perl', 'SCALAR(0x8db190)') called at log4perl_test.pl line 23 ---8--- Any hints? Regards Mara -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel-- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] Log::Log4perl 1.28 released
Hi Log4perl enthusiasts, Log::Log4perl 1.28 has just been released to CPAN. Changes in this release: 1.28 (2010/02/24) *(ms) Fixed caller stack with Buffer composite appender *(ms) Fixed 'local caller_depth' error in various places. First localizing a variable and then increasing it is incorrect, as this ignores previous settings. The correct way of increasing the caller level is: 'local depth = depth + 1'. *(ms) Added Log::Log4perl::Catalyst for use in Catalyst applications. Enjoy! -- Mike Mike Schilli m...@perlmeister.com -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Problem with Log::Dispatch::FileRotate-Appender and -d:Profile
On Thu, 11 Mar 2010, mara raram wrote: I was so busy profiling that I completely forgot to thank you for that tip. So, thanks a lot, works brilliant. Glad to hear it worked out! -- Mike Mike Schilli m...@perlmeister.com -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Use of convenience functions in Catalyst apps
On Thu, 11 Mar 2010, Mesdaq, Ali wrote: I am trying to avoid doing things like: $c-log-debug(hello); now that I have been spoiled with using DEBUG(hello); in other places that I use Log4perl. You know, that's an interesting idea. I'll look into making the macros work with Catalyst. -- Mike Mike Schilli m...@perlmeister.com -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Use of convenience functions in Catalyst apps
On Thu, 11 Mar 2010, Mesdaq, Ali wrote: I have looked around the documentation but have not seen anything that discusses the ability to use Log4perl's convenience functions inside of catalyst apps. Namely the shortcuts of TRACE, DEBUG(), INFO(), Funny, after thinking about this for quite some time now, suddenly, after talking to the Catalyst folks yesterday, I realized that you can already do that! :) See, there's nothing special about $c-log-debug() except that it obtains a reference to a Log4perl logger (given you're using Log4perl with Catalyst of course). DEBUG() in :easy mode does exactly the same. So, just use Log::Log4perl::Catalyst to initialize Log4perl with Catalyst (check the manpage for that) and then use Log::Log4perl qw(:easy) for the macros. I've added it to the documentation: http://github.com/mschilli/log4perl/commit/aeaf10cca8e8c5ba64bc2783109dc5b345436d91 Enjoy! :) -- Mike Mike Schilli m...@perlmeister.com WARN(), ERROR(), FATAL(), and ALWAYS. Call me lazy but I am trying to avoid doing things like: $c-log-debug(hello); now that I have been spoiled with using DEBUG(hello); in other places that I use Log4perl. Thanks, -- Ali Mesdaq (CISSP, GIAC-GREM) Sr. Security Researcher Websense Security Labs http://www.WebsenseSecurityLabs.com -- Protected by Websense Hosted Email Security -- www.websense.com -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] logdie() reports its own source file and line number, not caller's
On Thu, 1 Apr 2010, Rob Retter wrote: my die message without newline at /ccrun/perl/3rdparty/lib/Log/Log4perl/Logger.pm line 884 Fixed, will be released with 1.29: http://github.com/mschilli/log4perl/commit/f74c3490268a78a8cc81f96cbcf78c8bf76e374d Thanks again for your report. -- Mike Mike Schilli m...@perlmeister.com -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] log4perl Data::Dumper and renaming $VAR1
On Fri, 9 Apr 2010, Josh803316 wrote: $logger-trace( {filter = \Data::Dumper::Dumper, value = $name}, undef, $TRACE, undef, undef); So my question is, how can I log the value so it looks like $name instead of $VAR1 in the saved log? You can pass a reference to a subroutine to Log4perl's logging methods: $logger-trace( sub { Data::Dumper-Dump([$name], ['name']) } ); would do the trick while retaining the time-saving late evaluation. -- Mike Mike Schilli m...@perlmeister.com -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] log4perl Data::Dumper and renaming $VAR1
On Fri, 9 Apr 2010, Josh803316 wrote: wn edificationwhat is the real difference between the filter method and the sub method or are they basically the same? They're the same, just different notations. -- Mike Mike Schilli m...@perlmeister.com -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] DBIC Object not interpreted
On Mon, 10 May 2010, Steve wrote: Where $newsub is an object, the following fails to work as I expected it to: $logger-info(Created sub-, $newsub-ptn); Since my log is a text file, this yields the following line in the file: 2010/05/10 16:38:59 INFO cmsIMsubs-S.pl:176 main::getSubs - Created sub-CMS::Schema::Result::Subscription=HASH(0x96b9164)-ptn In case it's not obvious, I'd like to log the phone number, not what type of object I'm looking at. I doubt this is related to Log4perl, I bet you'll get the same result with print(). Make sure that your ptn() method does the right thing when called in list (!) context. Here's some code to show that it works as expected: use strict; package Wobble; sub new { bless {}, shift; } sub ptn { return wobble! } package main; use Log::Log4perl qw(:levels get_logger); Log::Log4perl-easy_init($DEBUG); my $logger = get_logger(); my $wobble = Wobble-new(); $logger-info(return of ptn: , $wobble-ptn()); -- Mike Mike Schilli m...@perlmeister.com -- ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] Log::Log4perl 1.29 Released
Hi Log4perl enthusiasts, Log::Log4perl 1.29 has just been released to CPAN. New in this release: 1.29 (2010/06/16) *(ms) Added documentation on how to use Log4perl's :easy macros with Catalyst in Log::Log4perl::Catalyst. *(ms) wrapper_register() now deals with caller_depth automatically. Backwards compatibility with old wrapper classes using caller_depth directly is provided. Documentation has been updated. *(ms) Felix Antonius Wilhelm Ostmann reported Resurrector.pm crashes, fixed as suggested by setting the %INC value to the module path. *(ms) Another caller_depth fix in Log::Log4perl::Catalyst. *(ms) Fixed logdie() caller_depth bug reported by Rob Retter. *(ms) [RT 56145] Saving errstr in DBI appender to survive ping() *(ms) Added INTERNAL_DEBUG env variable to test suite triggering all _INTERNAL_DEBUG statements to be printed for better error diagnosis on misbehaving systems. Enjoy! -- Mike Mike Schilli m...@perlmeister.com -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] eradicate / NFS
On Wed, 28 Jul 2010, foudil.ne...@bigfoot.com wrote: then the temporary log file seems to get created in the beginning... leading to an error because of the missing temporary directory... The file appender lets you delay creation of the file until you write to it, check the create_at_logtime option in http://search.cpan.org/~mschilli/Log-Log4perl-1.29/lib/Log/Log4perl/Appender/File.pm That's the expected behaviour, but the code snippets comes from a single script, so there should not be any other reference to the temporary appender. Can you post a standalone script that reproduces the error? -- Mike Mike Schilli m...@perlmeister.com -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] Log4perl 1.31 released
Hi Log4perl enthusiasts, Log4perl 1.31 just has been released to CPAN. It fixes only one annoying test problem on Windows: 1.31 (2010/10/27) * (ms) Fixed the number of skipped tests for Windows for previous fix of [RT 60665]. Just didn't want to sit on it any longer, enjoy! -- Mike Mike Schilli m...@perlmeister.com -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Best way to prevent dying when disk is full.
On Mon, 8 Nov 2010, Kidwell,jr, Jack wrote: under any circumstances. Trivial tests show that a disk full condition causes logging to die. We want to use Log4perl because of it's features, so what is the best way to prevent Log4perl from dying. There's a couple of ways Log4perl can die(), so you need to wrap eval { }; statements around these sections. One way is if -init() fails, that one you can easily enclose in an eval {}. When it comes to logging to a file, this is trickier, because the Log::Log4perl::Appender::File appender checks if writing to the file succeeds and dies if this fails. What you can do in this case is define a class that inherits from it and wraps an eval {} around the log method: #!/usr/bin/perl -w use strict; package NeverDieFileAppender; use base qw( Log::Log4perl::Appender::File ); sub log { my($self, @args) = @_; local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1; eval { $self-SUPER::log(@args) }; } package main; use Log::Log4perl qw(:easy); Log::Log4perl-init( \q{ log4perl.logger = DEBUG, App log4perl.appender.App = NeverDieFileAppender log4perl.appender.App.filename = out.dat log4perl.appender.App.layout = PatternLayout log4perl.appender.App.layout.ConversionPattern = %F-%L: %m%n }); DEBUG waah; -- Mike Mike Schilli m...@perlmeister.com -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] logger state is global
On Tue, 16 Nov 2010, Tom Metro wrote: 1. Ability to create a library module that can use Log4perl, such that if the calling code makes no use of Log4perl, it logs independently with locally specified defaults, but if the caller does use Log4perl, it picks up the callers settings. Hi Tom, the current Log4perl implementation assumes that the calling script initializes Log4perl and libraries don't. Libraries make use of Log4perl by issuing log statements, but they don't try to modify the inititalization. If Log4perl isn't initialized in the main program, all is quiet. The trigger for the problem turned out to be a 'use' call in the eval'ed code that loaded a library which internally called easy_init() (yet specifying the INFO logging level). That's very confusing and should be avoided at all cost. This seems broken that a library using normal Log4perl methods can trash the logger in use by the calling code. That library wasn't using 'normal Log4perl methods', but was clobbering the settings. We discourage people from doing that, although we don't stop anyone shooting themselves in the foot (or putting up a module on CPAN that shoots everyone in the foot for that matter). But you're bringing up an interesting topic: What would be a good approach to allow a library to meddle with Log4perl's settings, in the absence or even presence of a previous initialization? Everything I've seen so far is just plain confusing to the end user. I'm open to ideas, however. -- Mike Mike Schilli m...@perlmeister.com -- Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] logger state is global
On Thu, 18 Nov 2010, Tom Metro wrote: It came about because the $logger object doesn't actually convey the full state, so when serialized and passed to a remote method, the remote logging reverts to default logging settings. Yeah, the way it's currently implemented, a logger is only meaningful within an initialized Log4perl-system, there's some system-global magic involved, and you cannot serialize a logger and plant it into another Log4perl-enabled system at runtime easily (yet). Can you explain more about what the use case is for serializing loggers and passing them to remote systems? What properties of the logger might be of interest to the remote system? Is the remote system running Log4perl with exactly the same appenders or different ones? (On a side note, I had to rewrite easy_init() in order to make it subclass friendly. We can discuss that further in a separate thread, if interested.) Sure. I assume that this practice of maintaining global state in Log4perl came about because it is convenient to be able to call get_logger() as a class method, rather than having the application pass an object around. But it seems that it would be way better if Log4perl was internally designed to store all state in instance variables, and leave it to the application developer to decide whether they want to pass around objects, or dedicate a global variable to it. Agreed. When I fixed the library code to use Log::Log4perl-get_logger($class), my first attempt was actually to pass a logger object to the library, and call $logger-get_logger($class), assuming get_logger($class) would clone $logger, set the category, and return a new logger. Instead it fails in Log::Log4perl-_new() when it tries to bless the already blessed object. Yes, get_logger() is a class method, calling it by an object is not defined. We should have a better error message, though. Ultimately I want a method I can call from my libraries where I can pass in a $logger parameter. The method then looks to see if $logger is set to anything, and if it is, clones it, sets the category, and returns the object. Hmm, that's similar to how the class method is defined. If the logger for the category exists, you get a copy, if it isn't, you get a new instance. We could implement an object method that does what you've suggested, can you post some code to display how your class hierarchy looks like and how you call the metods of the derived class from your application? -- Mike Mike Schilli m...@perlmeister.com -- Increase Visibility of Your 3D Game App Earn a Chance To Win $500! Tap into the largest installed PC base get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] $Log::Log4perl::caller_depth, layout %c and %T, and category
On Sun, 23 Jan 2011, David Christensen wrote: I've found that: $Log::Log4perl::caller_depth ... does not seem to affect the following layout placeholders: %c Category of the logging event %T A stack trace of functions called Hi David, sorry for the delay. There's a subtle difference between the package class hierarchy in your application and Log4perl's categories: While they're almost always the same, they are in fact independent concepts. That's is why %c does not change automatically when you set caller_depth, because caller_depth refers to the package hierarchy, while %c refers to the Log4perl category. There's a section in the Log4perl manual that talks about this (not easy to find, though): http://search.cpan.org/~mschilli/Log-Log4perl-1.31/lib/Log/Log4perl.pm#Using_Log::Log4perl_with_wrapper_functions_and_classes If you scroll down to Also, note that if you're writing a subclass of Log4perl, it talks about using Log::Log4perl-wrapper_register(__PACKAGE__); to register a wrapper class, so that get_logger() skips it and uses the application's class as a category instead. Note that if you're using qw(:easy), you need to use package Helper; BEGIN { Log::Log4perl-wrapper_register(__PACKAGE__); }; use Log::Log4perl qw(:easy); to make sure Log4perl's easy mode stealth loggers are set up correctly. With regards to %T, I think that's a bug, I'll investigate. Hope that helps. -- Mike Mike Schilli m...@perlmeister.com How do I write a helper function that does affect %c, %T, and category -- e.g. so that calls to my helper logger functions are handled by Log::Log4perl the same way that calls to Log::Log4perl logger functions are handled? TIA, David 2011-01-23 14:30:18 dpchrist@p43400e ~/sandbox $ cat log4perl-easy #!/usr/bin/perl $! = 1; # package Foo; # use strict; use warnings; use Log::Log4perl qw(:easy); sub foo { DEBUG( @_, 'foo', __LINE__); Helper::help(@_, 'foo', __LINE__); } ### package Helper; ### use strict; use warnings; use Log::Log4perl qw(:easy); sub help { local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1; DEBUG(@_, 'help', __LINE__); } # package main; # use strict; use warnings; use Log::Log4perl qw(:easy); Log::Log4perl-easy_init( { layout= '%%c %c %n' . '%%C %C %n' . '%%d %d %n' . '%%F %F %n' . '%%H %H %n' . '%%l %l %n' . '%%L %L %n' . '%%m %m %n' . '%%M %M %n' . '%%p %p %n' . '%%P %P %n' . '%%r %r %n' ### %R is broken in Log::Log4perl version 1.16 ### Invalid conversion in sprintf: %R at /usr/share/perl5/Log/Log4perl/Layout/PatternLayout.pm line 286. # . '%%R %R %n' . '%%T %T %n' . '%%x %x %n', }); print ### call DEBUG()\n; DEBUG( 'main', __LINE__); print ### call Foo::foo()\n; Foo::foo('main', __LINE__); print ### call Helper::help()\n; Helper::help('main', __LINE__); 2011-01-23 14:30:20 dpchrist@p43400e ~/sandbox $ perl log4perl-easy ### call DEBUG() %c main %C main %d 2011/01/23 14:30:24 %F log4perl-easy %H p43400e %l main:: log4perl-easy (57) %L 57 %m main57 %M main:: %p DEBUG %P 5030 %r 41 %T Log::Log4perl::__ANON__('main', 57) called at log4perl-easy line 57 %x [undef] ### call Foo::foo() %c Foo %C Foo %d 2011/01/23 14:30:24 %F log4perl-easy %H p43400e %l Foo::foo log4perl-easy (12) %L 12 %m main59foo12 %M Foo::foo %p DEBUG %P 5030 %r 45 %T Foo::foo('main', 59) called at log4perl-easy line 59 %x [undef] %c Helper %C Foo %d 2011/01/23 14:30:24 %F log4perl-easy %H p43400e %l Foo::foo log4perl-easy (13) %L 13 %m main59foo13help26 %M Foo::foo %p DEBUG %P 5030 %r 45 %T Helper::help('main', 59, 'foo', 13) called at log4perl-easy line 13, Foo::foo('main', 59) called at log4perl-easy line 59 %x [undef] ### call Helper::help() %c Helper %C main %d 2011/01/23 14:30:24 %F log4perl-easy %H p43400e %l main:: log4perl-easy (61) %L 61 %m main61help26 %M main:: %p DEBUG %P 5030 %r 46 %T Helper::help('main', 61) called at log4perl-easy line 61 %x [undef] 2011-01-23 14:22:11 dpchrist@p43400e ~/sandbox $ cat log4perl-easy-category #!/usr/bin/perl $! = 1; # package Foo; # use strict; use warnings; use Log::Log4perl qw(:easy); sub foo { DEBUG( @_, 'foo', __LINE__); Helper::help(@_, 'foo', __LINE__); } ### package Helper; ### use strict; use warnings; use Log::Log4perl qw(:easy); sub help { local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1; DEBUG(@_, 'help', __LINE__); } # package main; # use strict; use warnings
Re: [log4perl-devel] $Log::Log4perl::caller_depth, layout %c and %T, and category
On Sun, 30 Jan 2011, David Christensen wrote: Putting the 'use' statement before the 'BEGIN' statement makes Perl happy, but %c still shows the Helper package, not 'main': Ugh, that doesn't work in :easy mode, sorry about that. What you want to do instead is use the long form with get_logger(): package Helper; use Log::Log4perl qw(get_logger); Log::Log4perl-wrapper_register(__PACKAGE__); sub help { get_logger()-debug(__FILE__, -, __LINE__, ' ', @_) } package Foo; sub foo { Helper::help(blah); } package main; use Log::Log4perl qw(:easy); Log::Log4perl-easy_init({layout='%c %m %n'}); DEBUG(__FILE__, -, __LINE__); Helper::help(__FILE__, -, __LINE__); Foo::foo(); -- Mike Mike Schilli m...@perlmeister.com -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] Log::Log4perl 1.32 released
Log4perl enthusiasts, the Log::Log4perl 1.32 maintenance release has just been pushed to CPAN. The following changes are included: 1.32 (2011/02/26) *(ms) Fixed %T caller_depth with wrapper_register(), reported by David Christensen. *(ms) [RT 63053] Fixed for qw() {} deprecated (Todd Rinaldo) *(ms) [RT 62674] Fixed call to deprecated form of UNIVERSAL::can (Karen Etheridge). *(ms) [RT 62896] Log::Log4perl::Appender::ScreenColoredLevels now inherits from Log::Log4perl::Appender::Screen and therefore supports the utf8 flag. *(ms) [RT 64318] Andrew Sayers provided a better error message for threshold needs to be uppercase. *(ms) CharleyDixon fixed LOGWARN when :no_extra_logdie_message is in use to no longer exit(). Enjoy! -- Mike Mike Schilli m...@perlmeister.com -- Free Software Download: Index, Search Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] $Log::Log4perl::caller_depth, layout %c and %T, and category
On Sun, 30 Jan 2011, David Christensen wrote: I'm not certain if %T is doing the right thing (?). You said there might be a bug. Do you mean that the: Should be fixed in Log4perl 1.32 on CPAN, give it a try. -- Mike Mike Schilli m...@perlmeister.com -- Free Software Download: Index, Search Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Can the DBIAppender Work in Multithread?
On Thu, 14 Apr 2011, Nan Cui wrote: I tried to share the logger, but it came out with another error saying (in cleanup) Can't call method FIRSTKEY on an undefined value at . /Log/Log4perl/Logger.pm line 90 during global destruction.. Can you post a snippet of code to reproduce this problem? -- Mike Mike Schilli m...@perlmeister.com -- Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Can the DBIAppender Work in Multithread?
On Thu, 14 Apr 2011, Nan Cui wrote: When my code tried to create new threads, the logger in the sub-thread body threw out exception like this: thread failed to start: DBD::Oracle::db prepare failed: handle 2 is owned by thread 83e0008 not current thread 8973c18 (handles can't be shared between threads and your driver may need a CLONE method added) at Hi Nan, That might be a limitation in the Oracle driver. I'm not using Oracle personally, but I've gotten feedback on the DBI driver being piece of work, mainly due to the proprietary nature of the Oracle client interface. Anyway, if the driver doesn't allow sharing DB handles between Perl threads, you should be able to work around the problem by explicitly obtaining a new DB handle every time you create a new thread. For this, you need to call the _init() method of Log4perl's DBI appender, which you can do after retrieving the appender by name. Something like Log::Log4perl-appender_by_name( DBAppndr )-_init(); in your consume() function should do the trick. -- Mike Mike Schilli m...@perlmeister.com -- Fulfilling the Lean Software Promise Lean software platforms are now widely adopted and the benefits have been demonstrated beyond question. Learn why your peers are replacing JEE containers with lightweight application servers - and what you can gain from the move. http://p.sf.net/sfu/vmware-sfemails ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Having a module inherit log level from caller
Hi Steve, you're using two different loggers, SCRIPT and MODULE. Your script sets the SCRIPT logger defined via log4perl.category.SCRIPT = ERROR, script in the configuration to level INFO in the main script: $logger-level(INFO); This causes the main script to log at this level. But since your module logger stays on ERROR, as defined in the configuration: log4perl.category.MODULE = ERROR, moduleDebug, moduleRest you're not seeing its log messages in your output. To set the MODULE logger to level INFO as well, you'd have to do something like use Log::Log4perl qw(get_logger); my $module_logger = get_logger(MODULE); $module_logger-level( INFO ); in your main script (or something similar as you did with the SCRIPT logger in Logging.pm). After doing this, you'll see [2011-07-23 19:50:03] script.pl INFO: Calling logTest() [2011-07-23 19:50:03] Package INFO: info message [2011-07-23 19:50:03] Package WARN: warn message [2011-07-23 19:50:03] Package ERROR: error message as (hopefully) expected. Hope that helps. -- Mike Mike Schilli m...@perlmeister.com On Fri, 22 Jul 2011, Steve Chadsey wrote: I have a script that uses various other modules. The script will take a command-line argument that dictates the log level, i.e., WARN, ERROR, etc. The script initializes a Log4perl instance using this level. The script calls functions from the external modules, for which I would like to have Log4perl log using the same log level that the calling script has initialized. Here is a simple example of what I have: ---[start Logging.pm]- #!/usr/bin/perl -w package Logging; use strict; use Log::Log4perl qw(get_logger :levels); use base 'Exporter'; our @EXPORT_OK = qw($dbg_method_msg $logger statusMessage logMessage); my $log_conf = q{ log4perl.category.MODULE = ERROR, moduleDebug, moduleRest # Filter to match level DEBUG log4perl.filter.MatchDebug = Log::Log4perl::Filter::LevelMatch log4perl.filter.MatchDebug.LevelToMatch = DEBUG log4perl.filter.MatchDebug.AcceptOnMatch = true # Filter to match everything but DEBUG log4perl.filter.MatchRest = Log::Log4perl::Filter::LevelMatch log4perl.filter.MatchRest.LevelToMatch = DEBUG log4perl.filter.MatchRest.AcceptOnMatch = false # layout for DEBUG messages log4perl.appender.moduleDebug = Log::Log4perl::Appender::Screen log4perl.appender.moduleDebug.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.moduleDebug.layout.ConversionPattern = [%d{-MM-dd HH:mm:ss}] %M:%L %p: %m%n log4perl.appender.moduleDebug.Filter = MatchDebug log4perl.appender.moduleDebug.stderr = 0 # Normal layout for the rest log4perl.appender.moduleRest = Log::Log4perl::Appender::Screen log4perl.appender.moduleRest.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.moduleRest.layout.ConversionPattern = [%d{-MM-dd HH:mm:ss}] %C %p: %m%n log4perl.appender.moduleRest.Filter = MatchRest log4perl.appender.moduleRest.stderr = 0 log4perl.category.SCRIPT = ERROR, script log4perl.appender.script = Log::Log4perl::Appender::Screen log4perl.appender.script.stderr = 0 log4perl.appender.script.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.script.layout.ConversionPattern = [%d{-MM-dd HH:mm:ss}] %F{1} %p: %m%n }; Log::Log4perl-init( \$log_conf ); sub scriptInit { our $logger = get_logger(SCRIPT); } 1; ---[end Logging.pm]- ---[start Package.pm]- #!/usr/bin/perl -w package Package; use strict; use Carp qw( carp croak ); use Logging; use Log::Log4perl qw(get_logger ); my $logger = Log::Log4perl-get_logger(MODULE); use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS ); use Exporter; @ISA= qw(Exporter); @EXPORT = qw(); @EXPORT_OK = qw( logTest ); sub logTest { $logger-info(info message); $logger-warn(warn message); $logger-error(error message); } 1; ---[end Package.pm]- ---[start script.pl]- #!/usr/bin/perl -w use strict; #use FindBin; #use lib $FindBin::RealBin/../../../lib; use Logging qw( $logger ); use Package qw(logTest ); Logging-scriptInit(); $logger-level(INFO); $logger-info(Calling logTest()); logTest(); ---[end]- As it stands, the output of this script is: [2011-07-22 10:58:41] script.pl INFO: Calling logTest() [2011-07-22 10:58:41] Package ERROR: error message What I want is: [2011-07-22 10:58:41] script.pl INFO: Calling logTest() [2011-07-22 10:58:41] Package INFO: info message [2011-07-22 10:58:41] Package WARN: warn message [2011-07-22 10:58:41] Package ERROR: error message How can I do that? Thanks, -- Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis
Re: [log4perl-devel] Writing to logs with different thresholds
On Fri, 29 Jul 2011, Robert Rothenberg wrote: When I set the threshold of the second appender, it seems to override the threshold of the root appender. Not sure what you're referring to here, but if you post your configuration and explain what you're expecting and what you're getting instead, I'll take a look. -- -- Mike Mike Schilli m...@perlmeister.com -- Got Input? Slashdot Needs You. Take our quick survey online. Come on, we don't ask for help often. Plus, you'll get a chance to win $100 to spend on ThinkGeek. http://p.sf.net/sfu/slashdot-survey ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] re-init question
On Mon, 8 Aug 2011, Bret Jordan wrote: Or how do we make init_and_wait work for a ref to a hash that contains the config?. What I would like is something like the following: ... ### Now this is where you would change the running config per say, basically adding a second output $ref-{log4perl.rootLogger} = SCREEN, SCREEN1; $logger-info(this is more info log message); But this does not obviously work. All that's missing is a call to Log::Log4perl-init() with the changed hash afterwards. You could even encapsulate that call and offer a function that does both, change the data structure and call init(). If you want to get really fancy, you could offer a tied hash, intercept the STORE function and call init() whenever something changes. Would that work for you? -- -- Mike Mike Schilli m...@perlmeister.com-- uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log::Log4perl best practices
On Sun, 25 Sep 2011, David Christensen wrote: I'd like to upgrade everything to whatever is consider best (or better) practices. Actually, :easy mode macros and get_logger() are identical in function, the difference is just typing convenience. I personally use :easy macros like DEBUG and INFO in conjunction with log4perl configuration files, unless for really simple scripts for which easy_init() is more appropriate. -- -- Mike Mike Schilli m...@perlmeister.com I started with Log4perl a few months ago and wrote some modules that use Log4perl in easy mode with no get_logger() categories. I'm now working on more modules and an application that uses Log4perl configuration files and get_logger() categories. -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] change log level in embedded system
On Wed, 18 Apr 2012, Gangemi, Jae wrote: actually, no - the call into the system could be considered the equivalent of running a cgi script inside of mod_perl, there is no signal handler involved, but i now realize my original approach just isn't going to work. I see, and the reset to the old configuration is related to something within the system calling Log4perl's init()? -- -- Mike Mike Schilli m...@perlmeister.com the reason i'm not using 'init_and_watch()' is b/c we embed the configuration file inside the code base (which is contained in a custom, encrypted archive) and 'init_and_watch' only works w/ an external file, but in order to make this work, i think i'm going to have to use some kind of external configuration file or change how 'init_and_watch' works locally. thanks! -- -jae On 4/17/12 9:46 PM, Mike Schilli m...@perlmeister.com wrote: On Tue, 17 Apr 2012, Gangemi, Jae wrote: am i missing something w/ this idea or will i need to re-initialize log4perl w/ a new configuration in order to make this work? You're not saying how your call into the system works, I presume that you're using a signal handler or some such to run a function that manipulates the logger on a received signal. Then, somehow Log4perl gets reinitialized by calling init() and it's back to normal. With mod_perl, this happens e.g. when Apache starts a new child process, I suspect something similar is happening in your embedded system. I wonder why you're not simply using init_and_watch() and modify the external config file to regularly check and reload it? -- -- Mike Mike Schilli m...@perlmeister.com hello - i'm currently running log4perl inside an embedded instance, for all intents and purposes, you could say it's an environment similar to mod_perl. while the system is running, i would like to send a command that changes the log level of either the root logger or against one of the logger categories (and potentially dynamically adding an appender so i can log to a separate file. the problem i am having the log level does not persist between calls into the system. i can make a call in and change the log level (and log a message at the new level to make sure it worked) but on a subsequent call, the log level has been reset to what log4perl was originally initialized with, i.e.: $logger = Log::Log4perl-get_logger(); $logger-fatal(fatal message); $logger-trace(trace message, should not see); $logger-level($TRACE); $logger-level(trace message, should see); -- Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] Log::Log4perl 1.37 released
Hi Log4perl enthusiasts, the Log::Log4perl 1.37 maintenance release just went to CPAN. The following changes were applied: 1.37 (2012/05/30) * (ms) [rt.cpan.org #75655] Meir Guttman found the module to make Log::Log4perl::Appender::ScreenColoredLevels work on Win32, updated docs. * (ms) [rt.cpan.org #76827] UTF-8 encoded configuration files are now supported (see Log::Log4perl::Config). * (ms) [rt.cpan.org #77501] Unescaped left brace in regex is deprecated with perl 5.17. Times we live in. Enjoy! -- -- Mike Mike Schilli m...@perlmeister.com -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Bug: Wrapped logdie reports wrong file/line
On Mon, 17 Sep 2012, Bob Kleemann wrote: It prints the write file/line on the logged message (-e:1), but not on the die message (perllib/WSL/... line 174). Hi Bob, thanks for reporting this issue, I've provided a fix here: https://github.com/mschilli/log4perl/commit/e258163ef2c219e082419e6158ad6fa96eeebc5d You can download the updated tarball from: https://github.com/mschilli/log4perl/tarball/1.38logdie Would be great if you could give it a whirl, let me know if it's working for you. -- -- Mike Mike Schilli m...@perlmeister.com around in my wrapping code by incrementing $Log::Log4perl::caller_depth, but this feels like a hack, as I've already registered the package as a wrapper with Log::Log4perl-wrapper_register( __PACKAGE__ );. I believe the correct fix is to change the Log::Log4perl::Logger::callerline method to use the %WRAPPERS_REGISTERED hash, similar to Log::Log4perl::get_logger: my $level = $Log::Log4perl::caller_depth; my ($pack, $file, $line); do { ($pack, $file, $line) = caller(++$level) } while ( exists $Log::Log4perl::WRAPPERS_REGISTERED{ $pack } ); Although if you're replicating code, you should be wrapping the duplication in a function somewhere and just calling that. I would appreciate it if you could let me know if/when the issue will be addressed. -- Bob -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] Log::Log4perl 1.38 released
Log4perl enthusiasts, a new maintenance release (1.38) has been pushed to CPAN, including the following changes: 1.38 (2012/09/23) *(ms) Bob Kleemann reported that logdie() in wrapper classes printed incorrect caller lines. Fixed by adding caller_depth_offset() utility to Log4perl.pm. *(ms) Meir Guttman reported a use case for logging messages with dynamic levels on log4perl-devel@lists.sourceforge.net. Added to manual page. *(ms) Implemented suggestion by Neil Hooey to check for and report undefined message elements before they're assembled in Appender.pm and a warning is issued without a proper code location: https://github.com/mschilli/log4perl/issues/15 *(ms) [rt.cpan.org #78734] Added spell check on filter parameter names Enjoy! -- -- Mike Mike Schilli m...@perlmeister.com -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://ad.doubleclick.net/clk;258768047;13503038;j? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Bug: Wrapped logdie reports wrong file/line
On Tue, 18 Sep 2012, Bob Kleemann wrote: When might I expect 1.38 to be released to CPAN? I've just pushed 1.38 to CPAN, should be on your mirror soon. Also, I note that you didn't change Log::Log4perl::get_logger to use caller_depth_offset. I'm not sure if that was intentional or not. Yeah, saw that, but the code is sufficiently different and the data structure used for the wrappers is local to the package, so I think it's good enough for now. If you have a patch to integrate it more tightly, by all means, send it, I'll be happy to apply it :). -- -- Mike Mike Schilli m...@perlmeister.com On Tue, Sep 18, 2012 at 12:28 AM, Mike Schilli m...@perlmeister.com wrote: On Mon, 17 Sep 2012, Bob Kleemann wrote: It prints the write file/line on the logged message (-e:1), but not on the die message (perllib/WSL/... line 174). Hi Bob, thanks for reporting this issue, I've provided a fix here: https://github.com/mschilli/log4perl/commit/e258163ef2c219e082419e6158ad6fa96eeebc5d You can download the updated tarball from: https://github.com/mschilli/log4perl/tarball/1.38logdie Would be great if you could give it a whirl, let me know if it's working for you. -- -- Mike Mike Schilli m...@perlmeister.com around in my wrapping code by incrementing $Log::Log4perl::caller_depth, but this feels like a hack, as I've already registered the package as a wrapper with Log::Log4perl-wrapper_register( __PACKAGE__ );. I believe the correct fix is to change the Log::Log4perl::Logger::callerline method to use the %WRAPPERS_REGISTERED hash, similar to Log::Log4perl::get_logger: my $level = $Log::Log4perl::caller_depth; my ($pack, $file, $line); do { ($pack, $file, $line) = caller(++$level) } while ( exists $Log::Log4perl::WRAPPERS_REGISTERED{ $pack } ); Although if you're replicating code, you should be wrapping the duplication in a function somewhere and just calling that. I would appreciate it if you could let me know if/when the issue will be addressed. -- Bob -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://ad.doubleclick.net/clk;258768047;13503038;j? http://info.appdynamics.com/FreeJavaPerformanceDownload.html ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] logcroak always stringifies when croak()ing
On Mon, 15 Oct 2012, BENNING, Markus (ext) wrote: Shouldn't logcroak log a stringified version and call croak on the value you passed to it instead of calling croak on the log message? I guess that makes sense if you're using it for throwing exceptions, but I've never used it that way and that's the reason why logcroak() (and its companions) is using Log::Log4perl::Logger::warning_render() to format the message before it passes it to croak() et al. Of course, that's not easy to change now, because some people rely on the feature, but as a horrible hack, you could use something like { no warnings qw( redefine ); *Log::Log4perl::Logger::warning_render = sub { return $_[1]; } } We should probably provide a flag you can set. What do you think? The docs say: Finally, there's the Carp functions that do just what the Carp functions do, but with logging: Fixed! https://github.com/mschilli/log4perl/commit/56c95a2d131678c4908785695fac0e56175c7b44 -- -- Mike Mike Schilli m...@perlmeister.com I noticed that logcroak (die,confess...) always die()s with a stringified version of what you pass to it. Here's an example: --- #!/usr/bin/env perl package Status; use Moose; use Log::Log4perl qw(:easy); Log::Log4perl-easy_init($ERROR); use Carp; use overload q{}= sub { $_[0]-as_string }, fallback = 1; has 'logger' = ( is = 'ro', isa = 'Log::Log4perl::Logger', lazy = 1, default = sub { return( Log::Log4perl-get_logger('Status') ); }, ); has code = ( is = 'ro', isa = 'Int', required = 1 ); has message = ( is = 'ro', isa = 'Str', required = 1 ); sub as_string { my ($self) = @_; return ( sprintf( 'Status: %s (%s)', $self-message, $self-code ) ); } sub throw { my $self = shift; croak($self); } sub throw_log4perl { my $self = shift; $self-logger-logcroak($self); } package main; use Data::Dumper; my $s = Status-new( code = 500, message = 'Foobar'); eval { $s-throw }; print Dumper($@); eval { $s-throw_log4perl }; print Dumper($@); --- END --- Output: $VAR1 = bless( { 'message' = 'Foobar', 'code' = 500 }, 'Status' ); 2012/10/15 12:19:41 ESB Error: Foobar (500) at log4perl-test.pl line 50 $VAR1 = 'ESB Error: Foobar (500) at log4perl-test.pl line 50 '; --- -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Introspecting the $logger object for log file path and name?
On Thu, 27 Dec 2012, Hugh Esco wrote: Using Log::Log4perl, I need to test for the existence of a log path and create it if necessary, I had hopes that this might give me what I was looking for: my $path = Log::Log4perl-appender_by_name( 'log4perl.appender.A1.filename'); Hi Hugh, looks what you want to find out is if a file appender's log file is present before you start your program. Note that this is not related to the logger object, but to the appender object instead. First off, Log4perl will create missing log files. You can do this either at log time or at init time. The former is the default behavior, the second is triggered by the 'create_at_logtime' option. See 'perldoc Log::Log4perl::Appender::File' for this and other create/recreate options. Now, there are cases where you want to make sure the log file exists before you init Log4perl, e.g. if the program's permissions don't allow for creating the log file, but then you need to create it outside the program anyway. Typically package installers (like rpm, dpkg etc.) take care of this. Anyway, if you want access to the file appender's filename, you need to change the line Log::Log4perl-appender_by_name( 'log4perl.appender.A1.filename'); to something like my $appender = Log::Log4perl-appender_by_name( 'A1' ); print $appender-filename(); Hope that helps, let me know if you need anything else! -- -- Mike Mike Schilli m...@perlmeister.com But I am getting (on the next line): Use of uninitialized value $path in substitution. Is there some way to query the class or perhaps the $logger object for what path and filename it expects from the configuration so I can created it before it is needed and its absence blows things up? I would try this with the $logger object itself, but attempting to instantiate one when the log file's path is missing blows things up. How do I automate this process so that an arbitrary path and file are created when my application is deployed into a fresh bare-metal environment? -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_122712 ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log::Log4perl::Catalyst
On Wed, 27 Mar 2013, Lee Goddard wrote: I'm trying Log::Log4perl::Catalyst in the way described in the SYNOPSIS of the POD, with the configuration below. I get my own log statements in the expected location but still some of Catalyst's -Debug statements go to STDERR. If those messages aren't formatted with the Log4perl layout you've specified, it's safe to assume that they're not using Log4perl for those. You might want to ask on the Catalyst forums, I've had good luck with speedy responses in the Freenode #catalyst IRC channel. -- -- Mike Mike Schilli m...@perlmeister.com Is this a feature of Catalyst, or am I doing something wrong? TIA Lee Config: log4perl.logger = TRACE, FILE log4perl.appender.FILE= Log::Log4perl::Appender::File log4perl.appender.FILE.mode= append log4perl.appender.FILE.filename = /logs/engine/FifteenGifts-Engine/logs/l4p.log log4perl.appender.FILE.layout=Log::Log4perl::Layout::PatternLayout log4perl.appender.FILE.layout.ConversionPattern = %5p | %-50m | %-30M{4} %4L%n Output in l4p.log: TRACE | Leave | Engine.Model.DAO.retrieve 135 DEBUG | Response Code: 200; Content-Type: application/json; charset=utf-8; Content-Length: 13587 | Catalyst::log_response_status_line 2264 INFO | Request took 26.607410s (0.038/s) .+---. | Action | Time | ++---+ | /threshold/default | 26.59772s | | - /threshold/update | 26.59430s | | /end | 0.002213s | | - FifteenGifts::Engine::View::JSON-process | 0.001421s | '+---' | Catalyst::finalize 1820 Output in error_log (STDERR) [Wed Mar 27 09:42:13 2013] [error] [client 127.0.0.1] [debug] Loaded Path actions:, referer: http://engineeditor/threshold/ [Wed Mar 27 09:42:13 2013] [error] [client 127.0.0.1] [info] FifteenGifts::Engine powered by Catalyst 5.90019, referer: http://engineeditor/threshold/ etc : -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Usage of easy_init() with multiple definitions
On Mon, 23 Dec 2013, Dave Pointon wrote: Would it be worthwhile to document this 'feature' in order to head off further such questions? I added this to the FAQ: http://feedproxy.google.com/~r/FatwalletHotDeals/~3/YyseBpP9ZeU/ Good enough? -- -- Mike Mike Schilli m...@perlmeister.com -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Usage of easy_init() with multiple definitions
On Mon, 23 Dec 2013, Dave Pointon wrote: Would it be worthwhile to document this 'feature' in order to head off further such questions? Gah, wrong link :). I added this item to the FAQ: https://github.com/mschilli/log4perl/commit/18c615ec1c81d780faeff8b95f49494ad29dbcfa Good enough? -- -- Mike Mike Schilli m...@perlmeister.com -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Functionality question
On Fri, 14 Mar 2014, Claudio Steel wrote: I have a new catalyst app and i think your module is exactly what I need. However, I'm not able to find where I can set the file path that I want the log to be written to. Any advice you have is appreciated. Check out http://search.cpan.org/~mschilli/Log-Log4perl-1.42/lib/Log/Log4perl/Catalyst.pm which says that you can provide a configuration file like __PACKAGE__-log(Log::Log4perl::Catalyst-new('l4p.conf')); and in your configuration file you can specify a file appender with a user-defined path: # l4p.conf log4perl.category = WARN, Logfile log4perl.appender.Logfile = Log::Log4perl::Appender::File log4perl.appender.Logfile.filename = /foo/bar/test.log log4perl.appender.Logfile.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.Logfile.layout.ConversionPattern = %d %F{1} %L %m %n Hope this helps! -- -- Mike Mike Schilli m...@perlmeister.com -- Learn Graph Databases - Download FREE O'Reilly Book Graph Databases is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] logcroak not sent to syslog when using Log::Dispatch::Syslog
On Sun, 16 Mar 2014, Sonderegger, Markus wrote: I noticed that $logger-logcroak(Go to Syslog”) is not seen in syslog because the FATAL error level is not mapped to one of the Log::Dispatch::Syslog levels. This is a bug in earlier versions of Sys::Syslog, not Log4perl. Make sure you have a recent installation of Sys::Syslog, the problem got fixed in 0.31: http://cpansearch.perl.org/src/SAPER/Sys-Syslog-0.33/Changes 0.31 -- 2012.08.18 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] Level 'emerg' could not be used since v0.29. Simply get the latest Sys::Syslog (0.33) from CPAN, and you're golden. -- -- Mike Mike Schilli m...@perlmeister.com Is there a way to circumvent this or do I oversee anything? Regards Markus _ Dr. Markus Sonderegger Application Integration Bank Julius Baer Co. Ltd. Hohlstrasse 600, P.O. Box, CH-8010 Zurich, Switzerland Telephone +41 58 88 77281, Telefax +41 58 88 74851 Mobile Phone +41 79 698 09 79 www.juliusbaer.com Julius Baer cares about the environment: Please do not print this e-mail unless you really need to. *JuliusBaer Disclaimer* This e-mail is for the intended recipient only and may contain confidential or privileged information. If you have received this e-mail by mistake, please contact us immediately and completely delete it (and any attachments) and do not forward it or inform any other person of its contents. If you send us messages by e-mail, we take this as your authorisation to correspond with you by e-mail, however, we reserve the right not to execute orders and instructions transmitted by e-mail at any time and without further explanation. If you do not wish to receive any further e-mail correspondence please let us know. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, amended, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. Neither the Julius Baer Group nor the sender accept liability for any errors or omissions in the content of this message which arise as a result of its e-mail transmission. Please note that all e-mail communications to and from the Julius Baer Group may be monitored. This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. -- Learn Graph Databases - Download FREE O'Reilly Book Graph Databases is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] Log::Log4perl 1.45 released
Hi Log4perl enthusiasts, the Log::Log4perl 1.45 maintenance release was just pushed to CPAN, including the following features: 1.45 (2014/10/25) *(ms) fgeueke provided a pull request for short-circuiting boolean filters: https://github.com/mschilli/log4perl/pull/48 *(ms) [rt.cpan.org #94009] Tim Bunce had requested that the PatternLayout's %m specifier allow for fixed indentation, variable indentation, and at the same time permit the use of the chomp option. Added with tests and docs. *(ms) Gianni Ceccarelli added the log4perl.utcDateTimes config option to select UTC instead of localtime: https://github.com/mschilli/log4perl/pull/53 *(ms) @bokutin fixed Catalyst.pm buffer flush: https://github.com/mschilli/log4perl/pull/51 https://github.com/mschilli/log4perl/issues/54 Enjoy! -- -- Mike Mike Schilli m...@perlmeister.com -- ___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] a quick suggestion
On Thu, 4 Dec 2014, Christopher Collins wrote: I have one small suggestion for the synopsis Makes perfect sense, I've added it: https://github.com/mschilli/log4perl/commit/953797d4bf330f34ca2628a7c24629c330d2f5b6 Thanks for your suggestion! -- -- Mike Mike Schilli m...@perlmeister.com Add Log::Log4perl::init ( \$config ) ; my $logger = Log::Log4perl-get_logger () ; above $logger-warn ($custid, 'big problem!!', $ip_addr); It tripped me up #!/usr/bin/env perl use strict ; use warnings ; use Log::Log4perl; use Log::Log4perl::Appender::DBI; my $config = q{ log4j.category = WARN, DBAppndr, SCREEN log4j.appender.DBAppndr = Log::Log4perl::Appender::DBI log4j.appender.DBAppndr.datasource = DBI:mysql:APPLOG log4j.appender.DBAppndr.username = logger log4j.appender.DBAppndr.password = ready log4j.appender.DBAppndr.sql = \ insert into LOG \ (level, script, message) \ values (?,?,?) log4j.appender.DBAppndr.params.1 = %p log4j.appender.DBAppndr.usePreparedStmt = 1 #just pass through the array of message items in the log statement log4j.appender.DBAppndr.layout = Log::Log4perl::Layout::NoopLayout log4j.appender.DBAppndr.warp_message = 0 #driver attributes support log4j.appender.DBAppndr.attrs.f_encoding = utf8 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 = %d %p %m %n }; Log::Log4perl::init ( \$config ) ; my $log = Log::Log4perl-get_logger () ; $log-warn( $0, 'big problem!!' ); cid:391340D9-4168-4ECC-B9D2-999681BA1C55@lan Chris Collins Programmer Analyst Phone: 630-282-0361 Mobile: 630-247-6705 Address: 605 Territorial Dr. Bolingbrook, IL 60440 www.multipkg.com ?? ? -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151iu=/4140/ostg.clktrk___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel