From: Lee G. <LGo...@UK...> - 2007-06-28 09:24:24
|
Please could Log/Log4perl/Config.pm line 619 offer a stack backtrace as well as barfing? =20 My current project has four config files, several potential initialisers (bad idea, I know) and reports only via e-mail, since it is part of a MTA process. =20 Thanks in anticipation Lee =20 =20 # The Postfix program # # <tq...@uk...>: Command died with status 2: "perl # -I/home/lgoddard/trafficjam/trunk/lib -MTrafficJam::Controller::Root -e # 'warn TrafficJam::Controller::Root->mail_in'". Command output: Cannot open # config file '/home/lgoddard/trafficjam/trunk/config/mail.l4p' at # /usr/local/share/perl/5.8.4/Log/Log4perl/Config.pm line 619, <STDIN> line # 26. # =20 Lee Goddard Senior Software Developer Advertising.com, London =20 P Think of the environment before you print this email =20 |
From: Mike S. <m...@pe...> - 2007-06-28 17:36:19
|
On Thu, 28 Jun 2007, Lee Goddard wrote: > Please could Log/Log4perl/Config.pm line 619 offer a stack backtrace as > well as barfing? > > My current project has four config files, several potential initialisers > (bad idea, I know) and reports only via e-mail, since it is part of a > MTA process. Dumping a stack trace by default might be confusing to the casual L4p user, but you can certainly use the following: use Log::Log4perl; use Carp; eval { Log::Log4perl->init(...); }; if($@) { confess($@); } Would this work for you? -- Mike Mike Schilli m...@pe... > > > > Thanks in anticipation > > Lee > > > > > > # The Postfix program > > # > > # <tq...@uk...>: Command died with status 2: > "perl > > # -I/home/lgoddard/trafficjam/trunk/lib > -MTrafficJam::Controller::Root -e > > # 'warn TrafficJam::Controller::Root->mail_in'". Command output: > Cannot open > > # config file '/home/lgoddard/trafficjam/trunk/config/mail.l4p' at > > # /usr/local/share/perl/5.8.4/Log/Log4perl/Config.pm line 619, > <STDIN> line > > # 26. > > # > > > > Lee Goddard > > Senior Software Developer > > Advertising.com, London > > > > P Think of the environment before you print this email > > > > |
From: John O. <joh...@o-...> - 2007-06-28 10:42:42
|
Try putting: use Error; in one of your modules/scripts - it will override the warn/die handlers globally, so unless Log4perl overrides them again it will give you a stack trace. cheers John Lee Goddard wrote: > > Please could Log/Log4perl/Config.pm line 619 offer a stack backtrace > as well as barfing? > > > > My current project has four config files, several potential > initialisers (bad idea, I know) and reports only via e-mail, since it > is part of a MTA process. > > > > Thanks in anticipation > > Lee > > > > > > # The Postfix program > > # > > # <tq...@uk...>: Command died with status 2: "perl > > # -I/home/lgoddard/trafficjam/trunk/lib > -MTrafficJam::Controller::Root -e > > # 'warn TrafficJam::Controller::Root->mail_in'". Command output: > Cannot open > > # config file '/home/lgoddard/trafficjam/trunk/config/mail.l4p' at > > # /usr/local/share/perl/5.8.4/Log/Log4perl/Config.pm line 619, > <STDIN> line > > # 26. > > # > > > > Lee Goddard > > Senior Software Developer > > Advertising.com, London > > > > P Think of the environment before you print this email > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ------------------------------------------------------------------------ > > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |
From: Lee G. <LGo...@UK...> - 2007-06-28 12:50:25
|
Thanks for the tip, John: I don't recall the module, but it looks like a good quick-fix, quicker than tracking-down and editing every version of L4p I install ! =20 But I'd still like the shortmess near configuration file errors, because they're pretty common end-user errors. > -----Original Message----- > From: John ORourke [mailto:joh...@o-...] >=20 > Try putting: >=20 > use Error; >=20 > in one of your modules/scripts - it will override the warn/die handlers > globally, so unless Log4perl overrides them again it will give you a > stack trace. >=20 > Lee Goddard wrote: > > > > Please could Log/Log4perl/Config.pm line 619 offer a stack backtrace > > as well as barfing? |
From: Berg, E. <eri...@le...> - 2007-06-28 17:49:49
|
I've been looking for a way to get l4p to tell me where the config under which it's running comes from. Essentially, I'd like to have a method that would return the full path to the config file that it's currently using. Obviously, there are complications, such as those relating to programatic configuration subsequent to loading configs from a file, in-line, and config (ini) files, but I could find nowhere that the file name passed in to init() is retrievable. Am I right about that? -Eric. -----Original Message----- From: log4perl-devel-bounces=40lists.sourceforge.net =5Bmailto:log4perl-devel-bounces=40lists.sourceforge.net=5D On Behalf Of = John ORourke Sent: Thursday, June 28, 2007 6:42 AM To: Lee Goddard Cc: log4perl-devel=40lists.sourceforge.net Subject: Re: =5Blog4perl-devel=5D When a missing config file Try putting: use Error; in one of your modules/scripts - it will override the warn/die handlers globally, so unless Log4perl overrides them again it will give you a stack trace. cheers John Lee Goddard wrote: > > Please could Log/Log4perl/Config.pm line 619 offer a stack backtrace=20 > as well as barfing? > > My current project has four config files, several potential=20 > initialisers (bad idea, I know) and reports only via e-mail, since it=20 > is part of a MTA process. > > Thanks in anticipation > > Lee > > =20 > > =20 > > =23 The Postfix program > > =23 > > =23 <tqm=40uk-sandbox.corp.advertising.com>: Command died with status = 2:=20 > =22perl > > =23 -I/home/lgoddard/trafficjam/trunk/lib=20 > -MTrafficJam::Controller::Root -e > > =23 'warn TrafficJam::Controller::Root->mail_in'=22. Command = output:=20 > Cannot open > > =23 config file '/home/lgoddard/trafficjam/trunk/config/mail.l4p' at > > =23 /usr/local/share/perl/5.8.4/Log/Log4perl/Config.pm line 619,=20 > <STDIN> line > > =23 26. > > =23 > > =20 > > Lee Goddard > > Senior Software Developer > > Advertising.com, London > > =20 > > P Think of the environment before you print this email > > =20 > > ---------------------------------------------------------------------- > -- > > ---------------------------------------------------------------------- > --- This SF.net email is sponsored by DB2 Express Download DB2 Express > C - the FREE version of DB2 express and take control of your XML. No=20 > limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ---------------------------------------------------------------------- > -- > > _______________________________________________ > log4perl-devel mailing list > log4perl-devel=40lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > =20 ------------------------------------------------------------------------ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ log4perl-devel mailing list log4perl-devel=40lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - = - - - - - - - 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. |
From: Mike S. <m...@pe...> - 2007-06-28 23:54:24
|
On Thu, 28 Jun 2007, Berg, Eric wrote: > I've been looking for a way to get l4p to tell me where the config > under which it's running comes from. Essentially, I'd like to have > a method that would return the full path to the config file that it's > currently using. > > Obviously, there are complications, such as those relating to > programatic configuration subsequent to loading configs from a file, > in-line, and config (ini) files, but I could find nowhere that the file > name passed in to init() is retrievable. The name of the file isn't stored usually, since you can not only use 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 to store the filename in your application instead? -- Mike Mike Schilli m...@pe... > > -Eric. > > -----Original Message----- > From: log...@li... > [mailto:log...@li...] On Behalf Of John > ORourke > Sent: Thursday, June 28, 2007 6:42 AM > To: Lee Goddard > Cc: log...@li... > Subject: Re: [log4perl-devel] When a missing config file > > Try putting: > > use Error; > > in one of your modules/scripts - it will override the warn/die handlers > globally, so unless Log4perl overrides them again it will give you a > stack trace. > > cheers > John > > Lee Goddard wrote: > > > > Please could Log/Log4perl/Config.pm line 619 offer a stack backtrace > > as well as barfing? > > > > My current project has four config files, several potential > > initialisers (bad idea, I know) and reports only via e-mail, since it > > is part of a MTA process. > > > > Thanks in anticipation > > > > Lee > > > > > > > > > > > > # The Postfix program > > > > # > > > > # <tq...@uk...>: Command died with status 2: > > "perl > > > > # -I/home/lgoddard/trafficjam/trunk/lib > > -MTrafficJam::Controller::Root -e > > > > # 'warn TrafficJam::Controller::Root->mail_in'". Command output: > > Cannot open > > > > # config file '/home/lgoddard/trafficjam/trunk/config/mail.l4p' at > > > > # /usr/local/share/perl/5.8.4/Log/Log4perl/Config.pm line 619, > > <STDIN> line > > > > # 26. > > > > # > > > > > > > > Lee Goddard > > > > Senior Software Developer > > > > Advertising.com, London > > > > > > > > P Think of the environment before you print this email > > > > > > > > ---------------------------------------------------------------------- > > -- > > > > ---------------------------------------------------------------------- > > --- This SF.net email is sponsored by DB2 Express Download DB2 Express > > > C - the FREE version of DB2 express and take control of your XML. No > > limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > ---------------------------------------------------------------------- > > -- > > > > _______________________________________________ > > log4perl-devel mailing list > > log...@li... > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > > > ------------------------------------------------------------------------ > - > This SF.net email is sponsored by DB2 Express Download DB2 Express C - > the FREE version of DB2 express and take control of your XML. No limits. > Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > 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 DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |
From: Berg, E. <eri...@le...> - 2007-06-29 00:33:25
|
I do store it in my app, but I've set up my wrapper to look for an environment variable first, then a local whatever.ini, and then a full path to the default. I am trying to work with my other developers to initialize =22properly=22, but sometimes they don't and when that happens, it often leads to a search for which config file is being read. It's not an insurmountable problem, but knowing whence cometh the config would be nice. This is particularly an issue when they go outside of the parameters for getting configs from my wrapper class. None of my modules (underlying data and business logic) even include (use) Log::Log4perl; it's all from whatever script uses them. Are there any best practices, examples, etc. for the best way to provide a wrapper to log? I'm using some of the sample code that provides a _get_logger() function that derives the category based on the package from which it's called, but I've created a problem for myself when it's in an inherited class in a subclass called in a subclass -- my wrapper is set up to provide _get_logger() as an inherited method -- because if I define a method in a superclass, and it's called in a subclass, then I can't just enable logging for the method in the superclass, because it's the package name of the subclass from which the category is derived. So, to reiterate, I have a class hierarchy, and the top-level class is the one that does a=20 use base qw(My::Logger); Then, when one of my subclasses calls _get_logger(), it creates a logger with the category of the subclass, whereas at least sometimes I want to enable logging for that inherited method whenever it's called. Another solution would be wildcard/regex categories. Can we do that? Thanks=21 -Eric. -----Original Message----- From: Mike Schilli =5Bmailto:m=40perlmeister.com=5D=20 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 a=20 > method that would return the full path to the config file that it's=20 > currently using. > > Obviously, there are complications, such as those relating to=20 > programatic configuration subsequent to loading configs from a file,=20 > 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 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 to store the filename in your application instead? -- Mike Mike Schilli m=40perlmeister.com > > -Eric. > > -----Original Message----- > From: log4perl-devel-bounces=40lists.sourceforge.net > =5Bmailto:log4perl-devel-bounces=40lists.sourceforge.net=5D On Behalf = Of=20 > John ORourke > Sent: Thursday, June 28, 2007 6:42 AM > To: Lee Goddard > Cc: log4perl-devel=40lists.sourceforge.net > Subject: Re: =5Blog4perl-devel=5D When a missing config file > > Try putting: > > use Error; > > in one of your modules/scripts - it will override the warn/die=20 > handlers globally, so unless Log4perl overrides them again it will=20 > give you a stack trace. > > cheers > John > > Lee Goddard wrote: > > > > Please could Log/Log4perl/Config.pm line 619 offer a stack backtrace > > as well as barfing? > > > > My current project has four config files, several potential=20 > > initialisers (bad idea, I know) and reports only via e-mail, since=20 > > it is part of a MTA process. > > > > Thanks in anticipation > > > > Lee > > > > > > > > > > > > =23 The Postfix program > > > > =23 > > > > =23 <tqm=40uk-sandbox.corp.advertising.com>: Command died with status 2: > > =22perl > > > > =23 -I/home/lgoddard/trafficjam/trunk/lib > > -MTrafficJam::Controller::Root -e > > > > =23 'warn TrafficJam::Controller::Root->mail_in'=22. Command output: > > Cannot open > > > > =23 config file '/home/lgoddard/trafficjam/trunk/config/mail.l4p' at > > > > =23 /usr/local/share/perl/5.8.4/Log/Log4perl/Config.pm line 619, > > <STDIN> line > > > > =23 26. > > > > =23 > > > > > > > > Lee Goddard > > > > Senior Software Developer > > > > Advertising.com, London > > > > > > > > P Think of the environment before you print this email > > > > > > > > -------------------------------------------------------------------- > > -- > > -- > > > > -------------------------------------------------------------------- > > -- > > --- This SF.net email is sponsored by DB2 Express Download DB2=20 > > Express > > > C - the FREE version of DB2 express and take control of your XML. No > > limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > -------------------------------------------------------------------- > > -- > > -- > > > > _______________________________________________ > > log4perl-devel mailing list > > log4perl-devel=40lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > > > ---------------------------------------------------------------------- > -- > - > This SF.net email is sponsored by DB2 Express Download DB2 Express C - > the FREE version of DB2 express and take control of your XML. No limits. > Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > log4perl-devel mailing list > log4perl-devel=40lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -=20 > - - - - - - - - - > > 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 DB2 Express Download DB2 Express > C - the FREE version of DB2 express and take control of your XML. No=20 > limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > log4perl-devel mailing list > log4perl-devel=40lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - = - - - - - - - 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. |
From: Mike S. <m...@pe...> - 2007-06-29 00:45:27
|
On Thu, 28 Jun 2007, Berg, Eric wrote: > Are there any best practices, examples, etc. for the best way to > provide a wrapper to log? Here's a couple of hints: http://log4perl.sourceforge.net/d/Log/Log4perl.html#6acb7 > I'm using some of the sample code that provides a _get_logger() > function that derives the category based on the package from which > it's called Isn't that already provided by __PACKAGE__? > , but I've created a problem for myself when it's in an inherited > class in a subclass called in a subclass -- my wrapper is set up to > provide _get_logger() as an inherited method -- because if I define > a method in a superclass, and it's called in a subclass, then I can't > just enable logging for the method in the superclass, because it's the > package name of the subclass from which the category is derived. Hmm, any reason why you aren't simply using Log4perl's get_logger()? > So, to reiterate, I have a class hierarchy, and the top-level class is > the one that does a > > use base qw(My::Logger); > > Then, when one of my subclasses calls _get_logger(), it creates a logger > with the category of the subclass, whereas at least sometimes I want to > enable logging for that inherited method whenever it's called. Just to clarify: Is this your application or your logger class hierarchy? If the former, it shouldn't be a subclass of Logger. If the latter, you probably want to use L4p's get_logger() and pass it the category you want. > Another solution would be wildcard/regex categories. Can we do that? What's the problem you're trying to solve there? -- Mike Mike Schilli m...@pe... > > Thanks! > > -Eric. > > -----Original Message----- > From: Mike Schilli [mailto:m...@pe...] > Sent: Thursday, June 28, 2007 7:54 PM > To: Berg, Eric > Cc: log...@li... > Subject: Re: [log4perl-devel] 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 > > under which it's running comes from. Essentially, I'd like to have a > > method that would return the full path to the config file that it's > > currently using. > > > > Obviously, there are complications, such as those relating to > > programatic configuration subsequent to loading configs from a file, > > in-line, and config (ini) files, but I could find nowhere that the > > file name passed in to init() is retrievable. > > The name of the file isn't stored usually, since you can not only use 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 to > store the filename in your application instead? > > -- Mike > > Mike Schilli > m...@pe... > > > > > -Eric. > > > > -----Original Message----- > > From: log...@li... > > [mailto:log...@li...] On Behalf Of > > John ORourke > > Sent: Thursday, June 28, 2007 6:42 AM > > To: Lee Goddard > > Cc: log...@li... > > Subject: Re: [log4perl-devel] When a missing config file > > > > Try putting: > > > > use Error; > > > > in one of your modules/scripts - it will override the warn/die > > handlers globally, so unless Log4perl overrides them again it will > > give you a stack trace. > > > > cheers > > John > > > > Lee Goddard wrote: > > > > > > Please could Log/Log4perl/Config.pm line 619 offer a stack backtrace > > > > as well as barfing? > > > > > > My current project has four config files, several potential > > > initialisers (bad idea, I know) and reports only via e-mail, since > > > it is part of a MTA process. > > > > > > Thanks in anticipation > > > > > > Lee > > > > > > > > > > > > > > > > > > # The Postfix program > > > > > > # > > > > > > # <tq...@uk...>: Command died with status 2: > > > "perl > > > > > > # -I/home/lgoddard/trafficjam/trunk/lib > > > -MTrafficJam::Controller::Root -e > > > > > > # 'warn TrafficJam::Controller::Root->mail_in'". Command output: > > > Cannot open > > > > > > # config file '/home/lgoddard/trafficjam/trunk/config/mail.l4p' > at > > > > > > # /usr/local/share/perl/5.8.4/Log/Log4perl/Config.pm line 619, > > > <STDIN> line > > > > > > # 26. > > > > > > # > > > > > > > > > > > > Lee Goddard > > > > > > Senior Software Developer > > > > > > Advertising.com, London > > > > > > > > > > > > P Think of the environment before you print this email > > > > > > > > > > > > -------------------------------------------------------------------- > > > -- > > > -- > > > > > > -------------------------------------------------------------------- > > > -- > > > --- This SF.net email is sponsored by DB2 Express Download DB2 > > > Express > > > > > C - the FREE version of DB2 express and take control of your XML. No > > > > limits. Just data. Click to get it now. > > > http://sourceforge.net/powerbar/db2/ > > > -------------------------------------------------------------------- > > > -- > > > -- > > > > > > _______________________________________________ > > > log4perl-devel mailing list > > > log...@li... > > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > > > > > > > ---------------------------------------------------------------------- > > -- > > - > > This SF.net email is sponsored by DB2 Express Download DB2 Express C - > > > the FREE version of DB2 express and take control of your XML. No > limits. > > Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > log4perl-devel mailing list > > log...@li... > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > - - - - - - - - - > > > > 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 DB2 Express Download DB2 Express > > > C - the FREE version of DB2 express and take control of your XML. No > > limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > log4perl-devel mailing list > > log...@li... > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > 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. > > > |
From: Berg, E. <eri...@le...> - 2007-06-29 13:45:24
|
Thanks, Mike. Extremely helpful. I've never used caller for anything but endeavors of curiosity. I've read that document before, but... Here's what I quickly came up with: sub get_logger =7B =2E.. =23 get the caller that we want. =40caller =3D caller(1); =24package =3D =24caller=5B0=5D; =40log_focus =3D split( '::', =24package ); =23 If there's a category submitted to this sub, append it to =40log_focus if (=24category) =7B push( =40log_focus, =24category ) =7D =24log_focus =3D join( '.', =40log_focus ); =24logger =3D Log::Log4perl::get_logger(=24log_focus); return =24logger; =7D Obviously, this is a much better way to do this. I guess a short recursive subroutine which uses caller could tell you in which package a function is defined. And that's how carp works, huh? Pretty cool. Thank you very much. -Eric -----Original Message----- From: Mike Schilli =5Bmailto:m=40perlmeister.com=5D=20 Sent: Thursday, June 28, 2007 8:45 PM To: Berg, Eric Cc: Mike Schilli; log4perl-devel=40lists.sourceforge.net Subject: RE: =5Blog4perl-devel=5D When a missing config file On Thu, 28 Jun 2007, Berg, Eric wrote: > Are there any best practices, examples, etc. for the best way to=20 > provide a wrapper to log? Here's a couple of hints: http://log4perl.sourceforge.net/d/Log/Log4perl.html=236acb7 > I'm using some of the sample code that provides a _get_logger()=20 > function that derives the category based on the package from which=20 > it's called Isn't that already provided by __PACKAGE__? > , but I've created a problem for myself when it's in an inherited=20 > class in a subclass called in a subclass -- my wrapper is set up to=20 > provide _get_logger() as an inherited method -- because if I define a=20 > method in a superclass, and it's called in a subclass, then I can't=20 > just enable logging for the method in the superclass, because it's the > package name of the subclass from which the category is derived. Hmm, any reason why you aren't simply using Log4perl's get_logger()? > So, to reiterate, I have a class hierarchy, and the top-level class is > the one that does a > > use base qw(My::Logger); > > Then, when one of my subclasses calls _get_logger(), it creates a=20 > logger with the category of the subclass, whereas at least sometimes I > want to enable logging for that inherited method whenever it's called. Just to clarify: Is this your application or your logger class hierarchy? If the former, it shouldn't be a subclass of Logger. If the latter, you probably want to use L4p's get_logger() and pass it the category you want. > Another solution would be wildcard/regex categories. Can we do that? What's the problem you're trying to solve there? -- Mike Mike Schilli m=40perlmeister.com > > Thanks=21 > > -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 > > Mike Schilli > m=40perlmeister.com > > > > > -Eric. > > > > -----Original Message----- > > From: log4perl-devel-bounces=40lists.sourceforge.net > > =5Bmailto:log4perl-devel-bounces=40lists.sourceforge.net=5D On Behalf = Of=20 > > John ORourke > > Sent: Thursday, June 28, 2007 6:42 AM > > To: Lee Goddard > > Cc: log4perl-devel=40lists.sourceforge.net > > Subject: Re: =5Blog4perl-devel=5D When a missing config file > > > > Try putting: > > > > use Error; > > > > in one of your modules/scripts - it will override the warn/die=20 > > handlers globally, so unless Log4perl overrides them again it will=20 > > give you a stack trace. > > > > cheers > > John > > > > Lee Goddard wrote: > > > > > > Please could Log/Log4perl/Config.pm line 619 offer a stack=20 > > > backtrace > > > > as well as barfing? > > > > > > My current project has four config files, several potential=20 > > > initialisers (bad idea, I know) and reports only via e-mail, since > > > it is part of a MTA process. > > > > > > Thanks in anticipation > > > > > > Lee > > > > > > > > > > > > > > > > > > =23 The Postfix program > > > > > > =23 > > > > > > =23 <tqm=40uk-sandbox.corp.advertising.com>: Command died with status 2: > > > =22perl > > > > > > =23 -I/home/lgoddard/trafficjam/trunk/lib > > > -MTrafficJam::Controller::Root -e > > > > > > =23 'warn TrafficJam::Controller::Root->mail_in'=22. Command output: > > > Cannot open > > > > > > =23 config file '/home/lgoddard/trafficjam/trunk/config/mail.l4p' > at > > > > > > =23 /usr/local/share/perl/5.8.4/Log/Log4perl/Config.pm line 619, > > > <STDIN> line > > > > > > =23 26. > > > > > > =23 > > > > > > > > > > > > Lee Goddard > > > > > > Senior Software Developer > > > > > > Advertising.com, London > > > > > > > > > > > > P Think of the environment before you print this email > > > > > > > > > > > > ------------------------------------------------------------------ > > > -- > > > -- > > > -- > > > > > > ------------------------------------------------------------------ > > > -- > > > -- > > > --- This SF.net email is sponsored by DB2 Express Download DB2=20 > > > Express > > > > > C - the FREE version of DB2 express and take control of your XML.=20 > > > No > > > > limits. Just data. Click to get it now. > > > http://sourceforge.net/powerbar/db2/ > > > ------------------------------------------------------------------ > > > -- > > > -- > > > -- > > > > > > _______________________________________________ > > > log4perl-devel mailing list > > > log4perl-devel=40lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > > > > > > > -------------------------------------------------------------------- > > -- > > -- > > - > > This SF.net email is sponsored by DB2 Express Download DB2 Express C > > - > > > the FREE version of DB2 express and take control of your XML. No > limits. > > Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > log4perl-devel mailing list > > log4perl-devel=40lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -=20 > > - > > - - - - - - - - - > > > > This message is intended only for the personal and confidential use=20 > > of > the designated recipient(s) named above. If you are not the intended=20 > recipient of this message you are hereby notified that any review,=20 > dissemination, distribution or copying of this message is strictly=20 > prohibited. This communication is for information purposes only and=20 > should not be regarded as an offer to sell or as a solicitation of an=20 > offer to buy any financial product, an official confirmation of any=20 > transaction, or as an official statement of Lehman Brothers. Email=20 > transmission cannot be guaranteed to be secure or error-free. > Therefore, we do not represent that this information is complete or=20 > 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=20 > or written to be used and cannot be used for the purpose of (i)=20 > avoiding U.S. tax related penalties or (ii) promoting, marketing or=20 > recommending to another party any transaction or matter addressed herein. > > > > > > > > -------------------------------------------------------------------- > > -- > > --- This SF.net email is sponsored by DB2 Express Download DB2=20 > > Express > > > C - the FREE version of DB2 express and take control of your XML. No > > limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > log4perl-devel mailing list > > log4perl-devel=40lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -=20 > - - - - - - - - - > > 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 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. |
From: Berg, E. <eri...@le...> - 2007-07-01 13:59:49
|
=20 -----Original Message----- From: Mike Schilli =5Bmailto:m=40perlmeister.com=5D=20 Sent: Thursday, June 28, 2007 8:45 PM To: Berg, Eric Cc: Mike Schilli; log4perl-devel=40lists.sourceforge.net Subject: RE: =5Blog4perl-devel=5D When a missing config file >> Another solution would be wildcard/regex categories. Can we do that? > > What's the problem you're trying to solve there? I like this one quite a bit, actually. I've got a number of classes that have methods called =22run=22, and I'd like to be able to change the log level for just the run() methods all at once. log4perl.logger.Class.Path1.run DEBUG, DebugLog log4perl.logger.Class.Path2.run DEBUG, DebugLog log4perl.logger.Class.Path3.run DEBUG, DebugLog Could nicely be written as: log4perl.logger.Class=5C.Path.*=5C.run DEBUG, DebugLog Or a little finer grained: log4perl.logger.Class.Path=5B13=5D.run DEBUG, DebugLog -Eric. > > Thanks=21 > > -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 > > Mike Schilli > m=40perlmeister.com > > > > > -Eric. > > > > -----Original Message----- > > From: log4perl-devel-bounces=40lists.sourceforge.net > > =5Bmailto:log4perl-devel-bounces=40lists.sourceforge.net=5D On Behalf = Of=20 > > John ORourke > > Sent: Thursday, June 28, 2007 6:42 AM > > To: Lee Goddard > > Cc: log4perl-devel=40lists.sourceforge.net > > Subject: Re: =5Blog4perl-devel=5D When a missing config file > > > > Try putting: > > > > use Error; > > > > in one of your modules/scripts - it will override the warn/die=20 > > handlers globally, so unless Log4perl overrides them again it will=20 > > give you a stack trace. > > > > cheers > > John > > > > Lee Goddard wrote: > > > > > > Please could Log/Log4perl/Config.pm line 619 offer a stack=20 > > > backtrace > > > > as well as barfing? > > > > > > My current project has four config files, several potential=20 > > > initialisers (bad idea, I know) and reports only via e-mail, since > > > it is part of a MTA process. > > > > > > Thanks in anticipation > > > > > > Lee > > > > > > > > > > > > > > > > > > =23 The Postfix program > > > > > > =23 > > > > > > =23 <tqm=40uk-sandbox.corp.advertising.com>: Command died with status 2: > > > =22perl > > > > > > =23 -I/home/lgoddard/trafficjam/trunk/lib > > > -MTrafficJam::Controller::Root -e > > > > > > =23 'warn TrafficJam::Controller::Root->mail_in'=22. Command output: > > > Cannot open > > > > > > =23 config file '/home/lgoddard/trafficjam/trunk/config/mail.l4p' > at > > > > > > =23 /usr/local/share/perl/5.8.4/Log/Log4perl/Config.pm line 619, > > > <STDIN> line > > > > > > =23 26. > > > > > > =23 > > > > > > > > > > > > Lee Goddard > > > > > > Senior Software Developer > > > > > > Advertising.com, London > > > > > > > > > > > > P Think of the environment before you print this email > > > > > > > > > > > > ------------------------------------------------------------------ > > > -- > > > -- > > > -- > > > > > > ------------------------------------------------------------------ > > > -- > > > -- > > > --- This SF.net email is sponsored by DB2 Express Download DB2=20 > > > Express > > > > > C - the FREE version of DB2 express and take control of your XML.=20 > > > No > > > > limits. Just data. Click to get it now. > > > http://sourceforge.net/powerbar/db2/ > > > ------------------------------------------------------------------ > > > -- > > > -- > > > -- > > > > > > _______________________________________________ > > > log4perl-devel mailing list > > > log4perl-devel=40lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > > > > > > > -------------------------------------------------------------------- > > -- > > -- > > - > > This SF.net email is sponsored by DB2 Express Download DB2 Express C > > - > > > the FREE version of DB2 express and take control of your XML. No > limits. > > Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > log4perl-devel mailing list > > log4perl-devel=40lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -=20 > > - > > - - - - - - - - - > > > > This message is intended only for the personal and confidential use=20 > > of > the designated recipient(s) named above. If you are not the intended=20 > recipient of this message you are hereby notified that any review,=20 > dissemination, distribution or copying of this message is strictly=20 > prohibited. This communication is for information purposes only and=20 > should not be regarded as an offer to sell or as a solicitation of an=20 > offer to buy any financial product, an official confirmation of any=20 > transaction, or as an official statement of Lehman Brothers. Email=20 > transmission cannot be guaranteed to be secure or error-free. > Therefore, we do not represent that this information is complete or=20 > 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=20 > or written to be used and cannot be used for the purpose of (i)=20 > avoiding U.S. tax related penalties or (ii) promoting, marketing or=20 > recommending to another party any transaction or matter addressed herein. > > > > > > > > -------------------------------------------------------------------- > > -- > > --- This SF.net email is sponsored by DB2 Express Download DB2=20 > > Express > > > C - the FREE version of DB2 express and take control of your XML. No > > limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > log4perl-devel mailing list > > log4perl-devel=40lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -=20 > - - - - - - - - - > > 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 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. |
From: Lee G. <LGo...@UK...> - 2007-06-29 09:58:59
|
Mike Schilli [mailto:m...@pe...] wrote: >=20 > On Thu, 28 Jun 2007, Lee Goddard wrote: >=20 > > Please could Log/Log4perl/Config.pm line 619 offer a stack backtrace as > > well as barfing? > > > > My current project has four config files, several potential initialisers > > (bad idea, I know) and reports only via e-mail, since it is part of a > > MTA process. >=20 > Dumping a stack trace by default might be confusing to the casual L4p > user, but you can certainly use the following: >=20 > use Log::Log4perl; > use Carp; >=20 > eval { > Log::Log4perl->init(...); > }; >=20 > if($@) { > confess($@); > } >=20 > Would this work for you? That's what I've ended up with, but I just thought it logical that an error generated by an operator error, such as wrong path to a config file, would Carp::croak, to let the user know from whence their error came.... Lee |