From: Jeff M. <jma...@e-...> - 2006-01-19 14:39:57
|
yes, it turned out I had other errors too. Thanks for the reply. On Wed, Jan 18, 2006 at 07:20:03PM -0800, Mike Schilli wrote: > On Wed, 18 Jan 2006, Jeff Macdonald wrote: > > > I'd like to do this (shortend line): > > layout.ConversionPattern = %d{yyyy-MM-dd\tHH:mm:ss}\t%m%n > > but I get this: > > > > ERROR: trying to set layout for mail-parser to 'ARRAY(0x98770ec)' failed at > > /home/jeff/projects/mail-parser-6/test-6/cpan-lib/Log/Log4perl/Config.pm > > line 464. > > > > I want to embed tabs in the log format. How can I do that? I've also tried > > \\t. > > Hi Jeff, > > I don't get your error message (there's probably something else with > your config file), but "\t" in your conversion pattern will print a > literal "\t". If you want real tabs, you can just type them literally > into the configuration file: > > use Log::Log4perl qw(get_logger); > > my $conf = q( > log4perl.category.Bar.Twix = WARN, Screen > log4perl.appender.Screen = Log::Log4perl::Appender::Screen > log4perl.appender.Screen.filename = test.log > log4perl.appender.Screen.layout = Log::Log4perl::Layout::PatternLayout > log4perl.appender.Screen.layout.ConversionPattern = \ > %d{yyyy-MM-dd HH:mm:ss} %m%n > ); > > Log::Log4perl::init(\$conf); > > my $logger = get_logger("Bar::Twix"); > $logger->error("Blah"); > > This will result in > > 2006-01-18[tab]19:15:09[tab]Blah > > -- Mike > > Mike Schilli > m...@pe... -- :: Jeff Macdonald | Principal Engineer, Messaging Technologies :: e-Dialog | jma...@e-... :: 131 Hartwell Ave. | Lexington, MA 02421 :: v: 781-372-1922 | f: 781-863-8118 :: www.e-dialog.com |