[Koha-bugs] [Bug 13413] Koha::Log - an attempt to have sane logging in Koha
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Feb 19 12:26:19 CET 2015
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13413
--- Comment #12 from Jonathan Druart <jonathan.druart at biblibre.com> ---
Actually this patch is stuck in NSO without any test plan.
Since I really would like to see a logging module integrated into Koha, I just
try to make this moving forward.
So let's test this lazily:
$ git bz apply 13413 # ok
Try to use the module:
diff --git a/C4/Context.pm b/C4/Context.pm
index c5f92ee..9a88758 100644
--- a/C4/Context.pm
+++ b/C4/Context.pm
@@ -107,6 +107,8 @@ use DateTime::TimeZone;
use Module::Load::Conditional qw(can_load);
use Carp;
+use Koha::Log qw(:log with_debug);
+
=head1 NAME
C4::Context - Maintain and manipulate the context of a Koha script
@@ -564,6 +566,7 @@ sub preference {
}
$sysprefs{lc $var} = $value;
+ log_debug{"pref $var = $value"};
return $value;
}
diff --git a/mainpage.pl b/mainpage.pl
index ab3a7ab..635a233 100755
--- a/mainpage.pl
+++ b/mainpage.pl
@@ -30,6 +30,8 @@ use C4::Suggestions qw/CountSuggestion/;
use C4::Tags qw/get_count_by_tag_status/;
use Koha::Borrower::Modifications;
+use Koha::Log qw(:log with_debug);
+
my $query = new CGI;
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
@@ -42,6 +44,8 @@ my ( $template, $loggedinuser, $cookie, $flags ) =
get_template_and_user(
}
);
+log_debug{'User on the mainpage!'};
+
my $homebranch;
if (C4::Context->userenv) {
$homebranch = C4::Context->userenv->{'branch'};
$ tail -f koha_logs
Go on the mainpage.
boom, module is missing
ok let's install it (no mention in the commit messages)
$ sudo apt-get install liblog-contextual-perl
Go on the mainpage, nothing in the logs.
Ha, debug no defined, let's replace with log_info
Go on the mainpage.
The messages appear in the logs \o/
So the question is: How can I configure a log level for all the application?
perldoc Koha/Log.pm mentions 3 levels: debug, info, warn. What about others?
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list