From: <Sag...@ub...> - 2003-02-26 18:33:18
|
Hi, I'm having a problem trying to use Log4perl with the = Log::Dispatch::ApacheLog appender. I haven't managed to get it down to a = simple test case yet, but i'm wondering whether the error i'm getting is = something that twigs with anyone on this list. The configuration i'm using is: 'log4perl.logger.Main' =3D> = 'WARN, apache_log', 'log4perl.logger.Screen' =3D> = 'WARN, apache_log', 'log4perl.logger' =3D> = 'WARN, apache_log', 'log4perl.appender.apache_log' =3D> = 'Log::Dispatch::ApacheLog', 'log4perl.appender.apache_log.apache' =3D> = $r, 'log4perl.appender.apache_log.Threshold' =3D> = 'WARN', 'log4perl.appender.apache_log.layout' =3D> = 'Log::Log4perl::Layout::PatternLayout', 'log4perl.appender.apache_log.layout.ConversionPattern' =3D> = '[%d] %m', Where $r is either Apache->request or Apache->request->server = (i.e. i get the problem in both cases). The error i get when trying to create my logger is: [Wed Feb 26 18:09:34 2003] [error] The 'apache' parameter to = Log::Dispatch::ApacheLog::new does not have the method: 'log' Params::Validate::__ANON__('The \'apache\' parameter to = Log::Dispatch::ApacheLog::new doe...') called at = /home/shahsag/my_tree/links/cpan/lib/Params/Validate.pm line 415 = Params::Validate::_validate_one_param('Apache::Server=3DSCALAR(0x1c77f20)= ','HASH(0xa266b4)','The \'apache\' parameter') called at = /home/shahsag/my_tree/links/cpan/lib/Params/Validate.pm line 258 Params::Validate::validate('ARRAY(0xa26510)','HASH(0xa264ec)') called = at /home/shahsag/my_tree/links/cpan/lib/Log/Dispatch/ApacheLog.pm line = 25 = Log::Dispatch::ApacheLog::new('undef','min_level','debug','apache','Apach= e::Server=3DSCALAR(0x1c77f20)','Threshold','WARN','name','apache_log',...= ) called at = /home/shahsag/my_tree/links/cpan/lib/Log/Log4perl/Appender.pm line 68 = Log::Log4perl::Appender::new('Log::Log4perl::Appender','Log::Dispatch::Ap= acheLog','name','apache_log','apache','Apache::Server=3DSCALAR(0x1c77f20)= ','Threshold','WARN') called at = /home/shahsag/my_tree/links/cpan/lib/Log/Log4perl/Config.pm line 209 Log::Log4perl::Config::_init('Log::Log4perl::Config','HASH(0x1c99dd4)') = called at /home/shahsag/my_tree/links/cpan/lib/Log/Log4perl/Config.pm = line 35 Log::Log4perl::Config::init('Log::Log4perl::Config','HASH(0x1c99dd4)') = called at /home/shahsag/my_tree/links/cpan/lib/Log/Log4perl.pm line 142 Log::Log4perl::init('Log::Log4perl','HASH(0x1c99dd4)') called at = /home/shahsag/my_tree/links/CORE/lib/Log/OPG.pm line 705 However i run a $r->can('log') before trying to create my logger and = it's all okay. Am i doing something wrong with my configuration? If = not, any ideas about why/how my Apache object is becomming mangled? thanks Sagar Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. |
From: Mike S. <msc...@ao...> - 2003-02-26 21:22:14
|
Sag...@ub... wrote: >I'm having a problem trying to use Log4perl with the Log::Dispatch::ApacheLog appender. I haven't managed to get it down to a simple test case yet, but i'm wondering whether the error i'm getting is something that twigs with anyone on this list. > >The configuration i'm using is: > > > 'log4perl.logger.Main' => 'WARN, apache_log', > > I'm suspecting that it is related to the underscore used in the appender name "apache_log", maybe a bug in Log4perl, I'll investigate it tonight. For now, just try using a name without an underscore (like "apachelog") and let me know if it fixes the problem ... -- -- Mike Mike Schilli log...@so... |
From: Kevin G. <ke...@go...> - 2003-02-27 00:26:05
|
Sagar, it looks like log4perl is taking the values from your config hash and converting them into text strings: Log::Log4perl::Config.pm @text = map { $_ . '=' . $config->{$_} } keys %{$config}; so $r is being munged into a string. We can look into fixing that. I was going to suggest you could use the other older method of init and do something like this $stash_package::r = $r; Log::Log4perl::init( \<<'EOL' log4perl.logger.Main = INFO, apache_log log4perl.appender.apache_log = Log::Dispatch::ApacheLog log4perl.appender.apache_log.apache = sub {$stash_package::r } ... EOL ); but there is another problem in Log4perl. Log::Dispatch expects the 'level' param to be a word, we are passing an integer, which suggests that the hash %Log::Log4perl::Levels::L4P_TO_LD should have values that are words not integers, and that this stuff in Levels.pm add_priority("WARN", WARN_INT, 4, 3); should actually be add_priority("WARN", WARN_INT, 4, 'warning'); Mike, you added that fourth parameter as part of "log dispatch level fix" back on 11/8/2002, can you take a look at that when you get a minute? Sag...@ub... wrote: > Hi, > > I'm having a problem trying to use Log4perl with the Log::Dispatch::ApacheLog appender. I haven't managed to get it down to a simple test case yet, but i'm wondering whether the error i'm getting is something that twigs with anyone on this list. > > The configuration i'm using is: > > > 'log4perl.logger.Main' => 'WARN, apache_log', > 'log4perl.logger.Screen' => 'WARN, apache_log', > 'log4perl.logger' => 'WARN, apache_log', > 'log4perl.appender.apache_log' => 'Log::Dispatch::ApacheLog', > 'log4perl.appender.apache_log.apache' => $r, > 'log4perl.appender.apache_log.Threshold' => 'WARN', > 'log4perl.appender.apache_log.layout' => 'Log::Log4perl::Layout::PatternLayout', > 'log4perl.appender.apache_log.layout.ConversionPattern' => '[%d] %m', > > > > Where $r is either Apache->request or Apache->request->server (i.e. i get the problem in both cases). > > The error i get when trying to create my logger is: > > > [Wed Feb 26 18:09:34 2003] [error] The 'apache' parameter to Log::Dispatch::ApacheLog::new does not have the method: 'log' > Params::Validate::__ANON__('The \'apache\' parameter to Log::Dispatch::ApacheLog::new doe...') called at /home/shahsag/my_tree/links/cpan/lib/Params/Validate.pm line 415 > Params::Validate::_validate_one_param('Apache::Server=SCALAR(0x1c77f20)','HASH(0xa266b4)','The \'apache\' parameter') called at /home/shahsag/my_tree/links/cpan/lib/Params/Validate.pm line 258 > Params::Validate::validate('ARRAY(0xa26510)','HASH(0xa264ec)') called at /home/shahsag/my_tree/links/cpan/lib/Log/Dispatch/ApacheLog.pm line 25 > Log::Dispatch::ApacheLog::new('undef','min_level','debug','apache','Apache::Server=SCALAR(0x1c77f20)','Threshold','WARN','name','apache_log',...) called at /home/shahsag/my_tree/links/cpan/lib/Log/Log4perl/Appender.pm line 68 > Log::Log4perl::Appender::new('Log::Log4perl::Appender','Log::Dispatch::ApacheLog','name','apache_log','apache','Apache::Server=SCALAR(0x1c77f20)','Threshold','WARN') called at /home/shahsag/my_tree/links/cpan/lib/Log/Log4perl/Config.pm line 209 > Log::Log4perl::Config::_init('Log::Log4perl::Config','HASH(0x1c99dd4)') called at /home/shahsag/my_tree/links/cpan/lib/Log/Log4perl/Config.pm line 35 > Log::Log4perl::Config::init('Log::Log4perl::Config','HASH(0x1c99dd4)') called at /home/shahsag/my_tree/links/cpan/lib/Log/Log4perl.pm line 142 > Log::Log4perl::init('Log::Log4perl','HASH(0x1c99dd4)') called at /home/shahsag/my_tree/links/CORE/lib/Log/OPG.pm line 705 > > > > However i run a $r->can('log') before trying to create my logger and it's all okay. Am i doing something wrong with my configuration? If not, any ideas about why/how my Apache object is becomming mangled? > > thanks > > Sagar > > Visit our website at http://www.ubswarburg.com > > This message contains confidential information and is intended only > for the individual named. If you are not the named addressee you > should not disseminate, distribute or copy this e-mail. Please > notify the sender immediately by e-mail if you have received this > e-mail by mistake and delete this e-mail from your system. > > E-mail transmission cannot be guaranteed to be secure or error-free > as information could be intercepted, corrupted, lost, destroyed, > arrive late or incomplete, or contain viruses. The sender therefore > does not accept liability for any errors or omissions in the contents > of this message which arise as a result of e-mail transmission. If > verification is required please request a hard-copy version. This > message is provided for informational purposes and should not be > construed as a solicitation or offer to buy or sell any securities or > related financial instruments. > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Scholarships for Techies! > Can't afford IT training? All 2003 ictp students receive scholarships. > Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more. > www.ictp.com/training/sourceforge.asp > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |