[OpenSRF-GIT] OpenSRF branch master updated. c8b808c739637ec68f2d8181f73d93f880f55dd6
Evergreen Git
git at git.evergreen-ils.org
Sat Mar 16 22:08:38 EDT 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OpenSRF".
The branch, master has been updated
via c8b808c739637ec68f2d8181f73d93f880f55dd6 (commit)
from df3155f9a3d9259ce64b27fb834450f99e85d8e2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c8b808c739637ec68f2d8181f73d93f880f55dd6
Author: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
Date: Wed Nov 14 14:50:46 2012 -0500
When running methods for clients, send plain warnings to "real" logs
Code inside an OpenSRF application method may use Perl libraries that warn
and carp like most Perl code is wont to do. Instead of letting
those message go to STDERR where they can be easily missed (and take up
lots of disk space on application boxes), why not catch them and
redirect them to our "real" logs using OpenSRF::Utils::Logger ?
Deployment of this change would probably have the side effect of bringing
to light bugs in applications (Evergreen) that will suddenly seem very
noisy.
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
Signed-off-by: Galen Charlton <gmc at esilibrary.com>
diff --git a/src/perl/lib/OpenSRF/Application.pm b/src/perl/lib/OpenSRF/Application.pm
index 0a5c188..5ae98bf 100644
--- a/src/perl/lib/OpenSRF/Application.pm
+++ b/src/perl/lib/OpenSRF/Application.pm
@@ -581,8 +581,16 @@ sub run {
if (!$self->{remote}) {
my $code = \&{$self->{package} . '::' . $self->{method}};
my $err = undef;
+ my $warnhandler;
try {
+ $warnhandler = $SIG{__WARN__};
+ $SIG{__WARN__} = sub {
+ (my $msg = shift) =~ s/\n$//;
+ $log->warn($self->{api_name} . ": $msg");
+ return 1; # prevents warning going out to stderr
+ };
+
$resp = $code->($self, $req, @params);
} catch Error with {
@@ -591,6 +599,8 @@ sub run {
if( ref($self) eq 'HASH') {
$log->error("Sub $$self{package}::$$self{method} DIED!!!\n\t$err\n", ERROR);
}
+ } finally {
+ $SIG{__WARN__} = $warnhandler;
};
if($err) {
-----------------------------------------------------------------------
Summary of changes:
src/perl/lib/OpenSRF/Application.pm | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
hooks/post-receive
--
OpenSRF
More information about the opensrf-commits
mailing list