From 1cc676b7cb3b82c4669aca0dee38780cfdb8c2a4 Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Wed, 10 Dec 2025 16:54:57 +0100 Subject: [PATCH] MT#64098 enable logger autoflush * Preamble: disabled autoflush caused logs to be written only when a request is finished, and what is worse, all of them with exact same time. As logging $c->log->* happens via syslog and rsyslog already uses buffering for that, there is no reason to cause such additional buffering by the Perl logger (which is Log4perl in this case). On top of it, it's already the default option for Log4Perl and was only inactive in the Panel app. * enable autoflush during Log4Perl init in the Panel app. Change-Id: I7cdcf7de30489d84fd8a9af88cb40669113ddbc1 (cherry picked from commit bb6b737c26bd6188909186beb525615a8322a4a8) (cherry picked from commit 158b6a46ca3e596c28bc8b14a280c6f9b1c1fd41) --- lib/NGCP/Panel.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/NGCP/Panel.pm b/lib/NGCP/Panel.pm index 2d402a453c..c75b56d6d2 100644 --- a/lib/NGCP/Panel.pm +++ b/lib/NGCP/Panel.pm @@ -331,7 +331,8 @@ __PACKAGE__->config( ); __PACKAGE__->config( default_view => 'HTML' ); -__PACKAGE__->log(Log::Log4perl::Catalyst->new($logger_config_file)); +__PACKAGE__->log(Log::Log4perl::Catalyst->new($logger_config_file, autoflush => 1)); +# autoflush => 1: since we are not writing directly to the log file but to syslog instead, let syslog/rsyslog take care of the buffering part, otherwise $c->log->* invokations get buffered and delayed until a request if fully completed and response is sent, on top of it all logs such dumped buffer to syslog will be logged with exact same time, which is not correct. As well as autoflush is enabled by default in Log4Perl. # configure Data::HAL depending on our config {