List Info

Thread: log4perl autoflush (buffering log output?)




log4perl autoflush (buffering log output?)
user name
2007-09-11 06:26:02
I have log4perl configured that way:

log4perl.appender.SCREEN=Log::Log4perl::Appender::Screen
log4perl.appender.SCREEN.layout=Log::Log4perl::Layout::Patte
rnLayout
log4perl.appender.SCREEN.layout.ConversionPattern =
%d{hh:mm:ss}> %m%n
log4perl.appender.SCREEN.autoflush = 1

and there is a controller which looks like:

sub test123 : Local {
    my ($self, $c) = _;
    $c->log->debug("time: " . localtime );
    sleep 5;
    $c->log->debug("time: " . localtime );
    $c->res->body("ok");
}

but the console output is like:
12:50:46> time: Tue Sep 11 12:50:40 2007
12:50:46> time: Tue Sep 11 12:50:45 2007

Log time from log4perl is the same for all debug messages
:(

I know there are problems (and patches) to show proper
line/module
where log event occured with log4perl. What about this
log-event time?

-- 
Adam Bartosik

_______________________________________________
List: Catalystlists.rawmode.org
Listinfo: ht
tp://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-
archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.per
l.org/

Re: log4perl autoflush (buffering log output?)
user name
2007-09-12 11:05:29
I use this hack to disable buffering for MyApp code (not for Catalyst core).
 
package MyApp;
 
__PACKAGE__->log( MyApp::Log->new );

package MyApp::Log;
use strict;
use base 'Catalyst::Log9;;

sub _log {
    my $self = shift;
    $self->SUPER::_log(_);
   ; $self->_flush if scalar(caller(1)) =~ /^MyApp(::|$)/;
}



 
2007/9/11, Adam Bartosik < moldovenugmail.com">moldovenugmail.com>:
I have log4perl configured that way:

log4perl.appender.SCREEN=Log::Log4perl::Appender::Screen
log4perl.appender.SCREEN.layout=Log::Log4perl::Layout::PatternLayout
log4perl.appender.SCREEN.layout.ConversionPattern = %d{hh:mm:ss}> %m%n
log4perl.appender.SCREEN.autoflush = 1

and there is a controller which looks like:

sub test123 : Local {
 &nbsp; my ($self, $c) = _;
 ;  $c->log->debug("time: " . localtime );
 &nbsp; sleep 5;
 &nbsp; $c->log->debug("time: " . localtime );
 &nbsp; $c->res->body(&quot;ok&quot;);
}

but the console output is like:
12:50:46> time: Tue Sep 11 12:50:40 2007
12:50:46> time: Tue Sep 11 12:50:45 2007

Log time from log4perl is the same for all debug messages :(

I know there are problems (and patches) to show proper line/module
where log event occured with log4perl. What about this log-event time?

--
Adam Bartosik

_______________________________________________
List: Catalystlists.rawmode.org">Catalystlists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: lists.rawmode.org/"> http://www.mail-archive.com/catalystlists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )