|
From: Kevin G. <ke...@go...> - 2003-09-24 23:54:07
|
David, thanks for the investigation and the patch, but the problem is
actually that JavaMap::RollingFileAppender isn't meant to be used
directly as an appender, it's only there as a translation layer if you
want to use java syntax, so that people can do
log4perl.appender.FR1 = \
org.apache.log4j.RollingFileAppender
and use the attribute names from log4j.
If you just want to use FileRotate and don't care about being compatible
with the java log4j, you can just say
log4perl.appender.FR1 = \
Log::Dispatch::FileRotate
It's an understandable mistake, though. Maybe I should put a note about
that in the docs.
Viner, David wrote:
> After some more digging, I think I've found the problem.
>
> Log::Log4perl::JavaMap::RollingFileAppender is a wrapper around
> Log::Dispatch::FileRotate. This module uses the token 'debug' as a flag to
> toggle internal debugging statements. I believe that this causes a conflict
> with the Log::Log4perl's expections of the 'debug' token in the hash that is
> $self.
>
> The attached patch to Log::Dispatch::FileRotate fixes the problem for
> Log::Log4perl. Mark, as the owner of the FileRotate module, can you review
> this patch?
>
> thanks
> dave viner
>
>
> -----Original Message-----
> From: Viner, David [mailto:dv...@ya...]
> Sent: Wednesday, September 24, 2003 10:47 AM
> To: 'log...@li...'
> Subject: [log4perl-devel] use strict and JavaMap::RollingFileAppender
> problem
>
>
> Hi,
> I'm trying to use the RollingFileAppender, but I keep getting this
> error:
>
> Can't use string ("debug") as a HASH ref while "strict refs" in use at
> /home/y/lib/perl5/site_perl/5.6.1/Log/Log4perl/JavaMap/RollingFileAppender.p
> m line 12.
>
> My log config file is really simple:
>
> log4perl.logger.test = DEBUG, FR1
> log4perl.appender.FR1 =
> Log::Log4perl::JavaMap::RollingFileAppender
> log4perl.appender.FR1.Threshold = DEBUG
> log4perl.appender.FR1.layout = Log::Log4perl::Layout::PatternLayout
> log4perl.appender.FR1.layout.ConversionPattern = \
> %d %p> %F{1}:%L %M - %m%n
> log4perl.appender.FR1.filename = test.log
> log4perl.appender.FR1.mode = append
> log4perl.appender.FR1.autoflush = 1
> log4perl.appender.FR1.size = 2
> log4perl.appender.FR1.max = 2
>
> and my script is equally simple:
>
> #!/usr/local/bin/perl -w
>
> use strict;
> use Log::Log4perl qw|get_logger|;
>
> use constant LOGGER_NAME => 'test';
>
> Log::Log4perl->init_and_watch('log.conf', 60);
> my $logger = get_logger(LOGGER_NAME);
>
> for(my $i=0; $i<100000; $i++)
> {
> $logger->debug("Message number $i is hello");
> }
>
>
> I'm using version 0.36 of Log::Log4perl and perl 5.6.1.
>
> Am I doing something wrong? Or is this a known problem with a work-around?
>
> thanks
> dave viner
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> 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
|