From: Sven Schöling Date: Fri, 13 May 2011 09:06:16 +0000 (+0200) Subject: Separates Logging für die Console. X-Git-Tag: release-2.6.3~25^2~37^2~11 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=97358b9b35233c732be555c5a261ff5d487ad894;p=kivitendo-erp.git Separates Logging für die Console. 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 --- 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;