From 97358b9b35233c732be555c5a261ff5d487ad894 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 13 May 2011 11:06:16 +0200 Subject: [PATCH] =?utf8?q?Separates=20Logging=20f=C3=BCr=20die=20Console.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Wenn man mit Userrechten arbeitet gibt es ständig Konflikte welcher Prozess nun auf das Logfile zugreifen darf. LXDebug ignoriert das still, aber Log4Perl stirbt mit einer Fehlermeldung. Ab nu gibt es eine separate Logdatei für die Konsole, und gut ist. Conflicts: SL/DB.pm scripts/console --- SL/DBConnect.pm | 2 +- SL/LXDebug.pm | 4 ++++ config/lx_office.conf.default | 4 ++++ scripts/console | 3 ++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/SL/DBConnect.pm b/SL/DBConnect.pm index fbcf1d5a1..4e084502a 100644 --- a/SL/DBConnect.pm +++ b/SL/DBConnect.pm @@ -12,7 +12,7 @@ sub connect { require Log::Log4perl; require DBIx::Log4perl; - my $filename = $LXDebug::file_name; + my $filename = $::lxdebug->file; my $config = $::lx_office_conf{debug}->{dbix_log4perl_config}; $config =~ s/LXDEBUGFILE/${filename}/g; diff --git a/SL/LXDebug.pm b/SL/LXDebug.pm index b24372445..1f0110f39 100644 --- a/SL/LXDebug.pm +++ b/SL/LXDebug.pm @@ -292,4 +292,8 @@ sub want_request_timer { $global_level & REQUEST_TIMER; } +sub file { + @_ == 2 ? $_[0]->{file} = $_[1] : $_[0]->{file}; +} + 1; diff --git a/config/lx_office.conf.default b/config/lx_office.conf.default index e78f2c357..ef620c0e2 100644 --- a/config/lx_office.conf.default +++ b/config/lx_office.conf.default @@ -171,6 +171,10 @@ login = # location of history file for permanent history history_file = users/console_history +# location of a separate log file for the console. everything normally written +# to the lx-office log will be put here if triggered from the console +log_file = /tmp/lxoffice_console_debug.log + [debug] # Use DBIx::Log4perl for logging DBI calls. The string LXDEBUGFILE # will be replaced by the file name configured for $::lxdebug. diff --git a/scripts/console b/scripts/console index 78b730559..fa570c3be 100755 --- a/scripts/console +++ b/scripts/console @@ -18,6 +18,7 @@ SL::LxOfficeConf->read; my $login = shift || $::lx_office_conf{console}{login} || 'demo'; my $history_file = $::lx_office_conf{console}{history_file} || '/tmp/lxoffice_console_history.log'; # fallback if users is not writable +my $debug_file = $::lx_office_conf{Console}{log_file} || '/tmp/lxoffice_console_debug.log'; my $autorun = $::lx_office_conf{console}{autorun}; # will be configed eventually @@ -58,7 +59,7 @@ sub lxinit { package main; - $::lxdebug = LXDebug->new; + $::lxdebug = LXDebug->new(file => $debug_file); $::locale = Locale->new($::lx_office_conf{system}->{language}); $::cgi = CGI->new qw(); $::form = Form->new; -- 2.20.1