Skip Menu |

This queue is for tickets about the Log-Log4perl CPAN distribution.

Report information
The Basics
Id: 23140
Status: resolved
Priority: 0/
Queue: Log-Log4perl

People
Owner: Nobody in particular
Requestors: jschulz.cpan [...] bloonix.de
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Feature request for Log::Log4perl::Appender::File
Hi, now: use Log::Log4perl::Appender::File; use Log::Log4perl::DateFormat; my $file = Log::Log4perl::Appender::File->new( filename => 'file.log', mode => 'append', autoflush => 1, umask => 0027, ); my $time = time(); my $format = Log::Log4perl::DateFormat->new("yyyy-MM-dd HH:mm:ss"); $file->log(message => $format->format($time)." Log me\n"); wish: my $file = Log::Log4perl::Appender::File->new( filename => 'file.log', mode => 'append', autoflush => 1, umask => 0027, dateformat => "yyyy-MM-dd HH:mm:ss", ); $file->log(timestamp => 1, message => "Log me\n"); Is there a chance? :) Cheers, Jonny
... use Log4perl's layout functions: use strict; use Log::Log4perl qw(get_logger); my $conf = q( log4perl.category = DEBUG, Logfile log4perl.appender.Logfile = Log::Log4perl::Appender::File log4perl.appender.Logfile.filename = test.log log4perl.appender.Logfile.layout = PatternLayout log4perl.appender.Logfile.layout.ConversionPattern = \\ %d{yyyy-MM-dd hh:mm:ss} %m %n ); Log::Log4perl::init(\$conf); my $logger = get_logger(""); $logger->debug("Blah");