Bugzilla – Attachment 65225 Details for
Bug 15253
Add Koha::Logger based logging for SIP2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15253 - Remove use of syslog
Bug-15253---Remove-use-of-syslog.patch (text/plain), 34.63 KB, created by
Kyle M Hall (khall)
on 2017-07-25 14:01:42 UTC
(
hide
)
Description:
Bug 15253 - Remove use of syslog
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-07-25 14:01:42 UTC
Size:
34.63 KB
patch
obsolete
>From cb948e029b3329a91a4059dc0c9f954013be0c46 Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Tue, 3 Jan 2017 18:38:23 +0200 >Subject: [PATCH] Bug 15253 - Remove use of syslog > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/SIP/ILS.pm | 19 ++++--------------- > C4/SIP/ILS/Item.pm | 4 ---- > C4/SIP/ILS/Patron.pm | 6 ------ > C4/SIP/ILS/Transaction/Checkout.pm | 3 --- > C4/SIP/ILS/Transaction/RenewAll.pm | 8 -------- > C4/SIP/README | 8 +++++--- > C4/SIP/SIPServer.pm | 34 +--------------------------------- > C4/SIP/Sip.pm | 7 ------- > C4/SIP/Sip/Configuration.pm | 2 -- > C4/SIP/Sip/MsgType.pm | 35 ----------------------------------- > etc/SIPconfig.xml | 3 --- > 11 files changed, 10 insertions(+), 119 deletions(-) > >diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm >index 34492fd..e3dee06 100644 >--- a/C4/SIP/ILS.pm >+++ b/C4/SIP/ILS.pm >@@ -6,7 +6,6 @@ package C4::SIP::ILS; > > use warnings; > use strict; >-use Sys::Syslog qw(syslog); > use Data::Dumper; > > use C4::SIP::ILS::Item; >@@ -48,7 +47,6 @@ sub new { > my $self = {}; > $debug and warn "new ILS: INSTITUTION: " . Dumper($institution); > C4::SIP::SIPServer::get_logger()->debug("new ILS $institution->{id}"); >- syslog("LOG_DEBUG", "new ILS '%s'", $institution->{id}); > $self->{institution} = $institution; > return bless $self, $type; > } >@@ -84,7 +82,6 @@ sub check_inst_id { > my ($self, $id, $whence) = @_; > if ($id ne $self->{institution}->{id}) { > C4::SIP::SIPServer::get_logger()->warn("$whence: received institution '$id', expected '$self->{institution}->{id}'"); >- syslog("LOG_WARNING", "%s: received institution '%s', expected '%s'", $whence, $id, $self->{institution}->{id}); > # Just an FYI check, we don't expect the user to change location from that in SIPconfig.xml > } > } >@@ -169,14 +166,12 @@ sub checkout { > push( @{ $patron->{items} }, $item_id ); > $circ->desensitize( !$item->magnetic_media ); > >- syslog( >- "LOG_DEBUG", "ILS::Checkout: patron %s has checked out %s", >- $patron_id, join( ', ', @{ $patron->{items} } ) >- ); >+ C4::SIP::SIPServer::get_logger()->debug("ILS::Checkout: patron '$patron_id' has checked out '". >+ join( ', ', @{ $patron->{items} } ). >+ "' items"); > } > else { >- C4::SIP::SIPServer::get_logger()->debug("ILS::Checkout: patron $patron_id has checked out " . join(', ', @{$patron->{items}}) ); >- syslog( "LOG_ERR", "ILS::Checkout Issue failed" ); >+ C4::SIP::SIPServer::get_logger()->error("ILS::Checkout Issue failed"); > } > } > >@@ -221,12 +216,10 @@ sub checkin { > # or it was not checked out but the checked_in_ok flag was set > $circ->ok( ( $checked_in_ok && $item ) || ( $item && $item->{patron} ) ); > C4::SIP::SIPServer::get_logger()->debug("C4::SIP::ILS::checkin - using checked_in_ok") if $checked_in_ok; >- syslog("LOG_DEBUG", "C4::SIP::ILS::checkin - using checked_in_ok") if $checked_in_ok; > > if ( !defined( $item->{patron} ) ) { > $circ->screen_msg("Item not checked out") unless $checked_in_ok; > C4::SIP::SIPServer::get_logger()->debug("C4::SIP::ILS::checkin - item not checked out"); >- syslog("LOG_DEBUG", "C4::SIP::ILS::checkin - item not checked out"); > } > else { > if ( $circ->ok ) { >@@ -450,11 +443,9 @@ sub renew { > foreach my $i (@{$patron->{items}}) { > unless (defined $i->{barcode}) { # FIXME: using data instead of objects may violate the abstraction layer > C4::SIP::SIPServer::get_logger()->error("No barcode for item " . $j+1 . " of $count: $item_id"); >- syslog("LOG_ERR", "No barcode for item %s of %s: $item_id", $j+1, $count); > next; > } > C4::SIP::SIPServer::get_logger()->debug("checking item ". $j + 1 . " of $count: $item_id vs. $i->{barcode} " ); >- syslog("LOG_DEBUG", "checking item %s of %s: $item_id vs. %s", ++$j, $count, $i->{barcode}); > if ($i->{barcode} eq $item_id) { > # We have it checked out > $item = C4::SIP::ILS::Item->new( $item_id ); >@@ -489,10 +480,8 @@ sub renew_all { > $trans->patron($patron = C4::SIP::ILS::Patron->new( $patron_id )); > if (defined $patron) { > C4::SIP::SIPServer::get_logger()->debug("ILS::renew_all: patron '$patron->name': renew_ok: $patron->renew_ok"); >- syslog("LOG_DEBUG", "ILS::renew_all: patron '%s': renew_ok: %s", $patron->name, $patron->renew_ok); > } else { > C4::SIP::SIPServer::get_logger()->debug("ILS::renew_all: Invalid patron id: '$patron_id'"); >- syslog("LOG_DEBUG", "ILS::renew_all: Invalid patron id: '%s'", $patron_id); > } > > if (!defined($patron)) { >diff --git a/C4/SIP/ILS/Item.pm b/C4/SIP/ILS/Item.pm >index 2cd8bde..f485039 100644 >--- a/C4/SIP/ILS/Item.pm >+++ b/C4/SIP/ILS/Item.pm >@@ -9,7 +9,6 @@ package C4::SIP::ILS::Item; > use strict; > use warnings; > >-use Sys::Syslog qw(syslog); > use Carp; > use Template; > >@@ -78,7 +77,6 @@ sub new { > > unless ( $item ) { > C4::SIP::SIPServer::get_logger()->debug("new ILS::Item('$item_id'): not found"); >- syslog("LOG_DEBUG", "new ILS::Item('%s'): not found", $item_id); > warn "new ILS::Item($item_id) : No item '$item_id'."; > return; > } >@@ -108,7 +106,6 @@ sub new { > bless $self, $type; > > C4::SIP::SIPServer::get_logger()->debug("new ILS::Item('$item_id'): found with title '$self->{title}'"); >- syslog("LOG_DEBUG", "new ILS::Item('%s'): found with title '%s'", > $item_id, $self->{title}); > > return $self; >@@ -183,7 +180,6 @@ sub hold_patron_name { > my $holder = Koha::Patrons->find( $borrowernumber ); > unless ($holder) { > C4::SIP::SIPServer::get_logger()->debug("While checking hold, failed to retrieve the patron with borrowernumber '$borrowernumber'"); >- syslog("LOG_ERR", "While checking hold, failed to retrieve the patron with borrowernumber '$borrowernumber'"); > return; > } > my $email = $holder->email || ''; >diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm >index 0b29d12..fb42954 100644 >--- a/C4/SIP/ILS/Patron.pm >+++ b/C4/SIP/ILS/Patron.pm >@@ -12,7 +12,6 @@ use warnings; > use Exporter; > use Carp; > >-use Sys::Syslog qw(syslog); > use Data::Dumper; > > use C4::Debug; >@@ -37,7 +36,6 @@ sub new { > $debug and warn "new Patron: " . Dumper($kp->unblessed) if $kp; > unless ($kp) { > C4::SIP::SIPServer::get_logger()->debug("new ILS::Patron($patron_id): no such patron"); >- syslog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id); > return; > } > $kp = $kp->unblessed; >@@ -125,7 +123,6 @@ sub new { > $self = \%ilspatron; > $debug and warn Dumper($self); > C4::SIP::SIPServer::get_logger()->debug("new ILS::Patron($patron_id): found patron '$self->{id}'"); >- syslog("LOG_DEBUG", "new ILS::Patron(%s): found patron '%s'", $patron_id,$self->{id}); > bless $self, $type; > return $self; > } >@@ -382,9 +379,6 @@ sub enable { > } > C4::SIP::SIPServer::get_logger()->debug("Patron($self->{id})->enable: charge: $self->{charge_ok}, ". > "renew:$self->{renew_ok}, recall:$self->{recall_ok}, hold:$self->{hold_ok}"); >- syslog("LOG_DEBUG", "Patron(%s)->enable: charge: %s, renew:%s, recall:%s, hold:%s", >- $self->{id}, $self->{charge_ok}, $self->{renew_ok}, >- $self->{recall_ok}, $self->{hold_ok}); > $self->{screen_msg} = "Enable feature not implemented."; # "All privileges restored."; # TODO: not really affecting patron record > return $self; > } >diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm >index 2648906..73dbd94 100644 >--- a/C4/SIP/ILS/Transaction/Checkout.pm >+++ b/C4/SIP/ILS/Transaction/Checkout.pm >@@ -8,7 +8,6 @@ use warnings; > use strict; > > use POSIX qw(strftime); >-use Sys::Syslog qw(syslog); > use Data::Dumper; > use CGI qw ( -utf8 ); > >@@ -48,7 +47,6 @@ sub new { > sub do_checkout { > my $self = shift; > C4::SIP::SIPServer::get_logger()->debug("ILS::Transaction::Checkout performing checkout..."); >- syslog('LOG_DEBUG', "ILS::Transaction::Checkout performing checkout..."); > my $pending = $self->{item}->pending_queue; > my $shelf = $self->{item}->hold_shelf; > my $barcode = $self->{item}->id; >@@ -100,7 +98,6 @@ sub do_checkout { > $self->screen_msg($needsconfirmation->{$confirmation}); > $noerror = 0; > C4::SIP::SIPServer::get_logger()->debug("Blocking checkout Reason:$confirmation"); >- syslog('LOG_DEBUG', "Blocking checkout Reason:$confirmation"); > } > } > } >diff --git a/C4/SIP/ILS/Transaction/RenewAll.pm b/C4/SIP/ILS/Transaction/RenewAll.pm >index c6a907e..b0608a0 100644 >--- a/C4/SIP/ILS/Transaction/RenewAll.pm >+++ b/C4/SIP/ILS/Transaction/RenewAll.pm >@@ -6,8 +6,6 @@ package C4::SIP::ILS::Transaction::RenewAll; > use strict; > use warnings; > >-use Sys::Syslog qw(syslog); >- > use C4::SIP::ILS::Item; > > use Koha::Patrons; >@@ -43,12 +41,6 @@ sub do_renew_all { > my $item = C4::SIP::ILS::Item->new($item_id); > if ( !defined($item) ) { > C4::SIP::SIPServer::get_logger()->debug("renew_all: Invalid item id '$item_id' associated with patron '$patron->id'"); >- syslog( >- 'LOG_WARNING', >- q|renew_all: Invalid item id '%s' associated with patron '%s'|, >- $item_id, >- $patron->id >- ); > > # $all_ok = 0; Do net set as still ok > push @{ $self->unrenewed }, $item_id; >diff --git a/C4/SIP/README b/C4/SIP/README >index 73acdfd..1ce614d 100644 >--- a/C4/SIP/README >+++ b/C4/SIP/README >@@ -14,11 +14,13 @@ perl modules to run: > > LOGGING > >-SIPServer uses syslog() for status and debugging messages. All >-syslog messages are logged using the syslog facility 'local6'. >+By default, SIPServer uses syslog via log4perl for status and debugging messages. >+All syslog messages are logged using the syslog facility 'local6'. > If you need to change this, because something else on your system > is already using that facililty, just change the definition of >-'LOG_SIP' at the top of the file SIPServer.pm >+'ident' and/or 'facility' in the SIP section of file log4perl.conf. > > Make sure to update your syslog configuration to capture facility > 'local6' and record it. >+ >+See the log4perl documenation for logging to a file or other services. >diff --git a/C4/SIP/SIPServer.pm b/C4/SIP/SIPServer.pm >index a65089d..9168dbb 100755 >--- a/C4/SIP/SIPServer.pm >+++ b/C4/SIP/SIPServer.pm >@@ -5,7 +5,6 @@ use strict; > use warnings; > use FindBin qw($Bin); > use lib "$Bin"; >-use Sys::Syslog qw(syslog); > use Net::Server::PreFork; > use IO::Socket::INET; > use Socket qw(:DEFAULT :crlf); >@@ -118,7 +117,6 @@ sub process_request { > > if (!defined($self->{service})) { > C4::SIP::SIPServer::get_logger()->error("process_request: Unknown recognized server connection: $sockaddr:$port/$proto"); >- syslog("LOG_ERR", "process_request: Unknown recognized server connection: %s:%s/%s", $sockaddr, $port, $proto); > die "process_request: Bad server connection"; > } > >@@ -126,7 +124,6 @@ sub process_request { > > if (!defined($transport)) { > C4::SIP::SIPServer::get_logger()->warn("Unknown transport '$service->{transport}', dropping"); >- syslog("LOG_WARNING", "Unknown transport '%s', dropping", $service->{transport}); > return; > } else { > &$transport($self); >@@ -153,14 +150,12 @@ sub raw_transport { > local $SIG{ALRM} = sub { die 'raw transport Timed Out!' }; > my $timeout = $self->get_timeout({ transport => 1 }); > C4::SIP::SIPServer::get_logger()->debug("raw_transport: timeout is $service->{timeout}"); >- syslog('LOG_DEBUG', "raw_transport: timeout is $timeout"); > alarm $timeout; > while (!$self->{account}) { > $input = read_request(); > if (!$input) { > # EOF on the socket > C4::SIP::SIPServer::get_logger()->info("raw_transport: shutting down: EOF during login"); >- syslog("LOG_INFO", "raw_transport: shutting down: EOF during login"); > return; > } > $input =~ s/[\r\n]+$//sm; # Strip off trailing line terminator(s) >@@ -176,18 +171,14 @@ sub raw_transport { > Log::Log4perl::MDC->put("peeraddr", $self->{server}->{peeraddr}); > > C4::SIP::SIPServer::get_logger()->debug("raw_transport: uname/inst: '$self->{account}->{id}/$self->{account}->{institution}'"); >- syslog("LOG_DEBUG", "raw_transport: uname/inst: '%s/%s'", >- $self->{account}->{id}, >- $self->{account}->{institution}); > if (! $self->{account}->{id}) { >- syslog("LOG_ERR","Login failed shutting down"); >+ C4::SIP::SIPServer::get_logger()->error("Login failed shutting down"); > return; > } > > $self->sip_protocol_loop(); > > C4::SIP::SIPServer::get_logger()->info("raw_transport: shutting down"); >- syslog("LOG_INFO", "raw_transport: shutting down"); > return; > } > >@@ -195,15 +186,12 @@ sub get_clean_string { > my $string = shift; > if (defined $string) { > C4::SIP::SIPServer::get_logger()->debug("get_clean_string pre-clean(length " . length($string) . "): $string"); >- syslog("LOG_DEBUG", "get_clean_string pre-clean(length %s): %s", length($string), $string); > chomp($string); > $string =~ s/^[^A-z0-9]+//; > $string =~ s/[^A-z0-9]+$//; > C4::SIP::SIPServer::get_logger()->debug("get_clean_string post-clean(length " . length($string) . "): $string)"); >- syslog("LOG_DEBUG", "get_clean_string post-clean(length %s): %s", length($string), $string); > } else { > C4::SIP::SIPServer::get_logger()->info("get_clean_string called on undefined"); >- syslog("LOG_INFO", "get_clean_string called on undefined"); > } > return $string; > } >@@ -214,7 +202,6 @@ sub get_clean_input { > $in = get_clean_string($in); > while (my $extra = <STDIN>){ > C4::SIP::SIPServer::get_logger()->error("get_clean_input got extra lines: $extra"); >- syslog("LOG_ERR", "get_clean_input got extra lines: %s", $extra); > } > return $in; > } >@@ -228,7 +215,6 @@ sub telnet_transport { > my $config = $self->{config}; > my $timeout = $self->get_timeout({ transport => 1 }); > C4::SIP::SIPServer::get_logger()->debug("telnet_transport: timeout is $timeout"); >- syslog("LOG_DEBUG", "telnet_transport: timeout is $timeout"); > > eval { > local $SIG{ALRM} = sub { die "telnet_transport: Timed Out ($timeout seconds)!\n"; }; >@@ -248,11 +234,9 @@ sub telnet_transport { > alarm 0; > > C4::SIP::SIPServer::get_logger()->debug("telnet_transport 1: uid length " . length($uid) . ", pwd length " . length($pwd)); >- syslog("LOG_DEBUG", "telnet_transport 1: uid length %s, pwd length %s", length($uid), length($pwd)); > $uid = get_clean_string ($uid); > $pwd = get_clean_string ($pwd); > C4::SIP::SIPServer::get_logger()->debug("telnet_transport 2: uid length " . length($uid) . ", pwd length " . length($pwd)); >- syslog("LOG_DEBUG", "telnet_transport 2: uid length %s, pwd length %s", length($uid), length($pwd)); > > if (exists ($config->{accounts}->{$uid}) > && ($pwd eq $config->{accounts}->{$uid}->{password})) { >@@ -262,18 +246,15 @@ sub telnet_transport { > } > } > C4::SIP::SIPServer::get_logger()->warn("Invalid login attempt: ' . ($uid||'') . '"); >- syslog("LOG_WARNING", "Invalid login attempt: '%s'", ($uid||'')); > print("Invalid login$CRLF"); > } > }; # End of eval > > if ($@) { > C4::SIP::SIPServer::get_logger()->error("telnet_transport: Login timed out"); >- syslog("LOG_ERR", "telnet_transport: Login timed out"); > die "Telnet Login Timed out"; > } elsif (!defined($account)) { > C4::SIP::SIPServer::get_logger()->error("telnet_transport: Login Failed"); >- syslog("LOG_ERR", "telnet_transport: Login Failed"); > die "Login Failure"; > } else { > print "Login OK. Initiating SIP$CRLF"; >@@ -282,10 +263,8 @@ sub telnet_transport { > $self->{account} = $account; > $self->{logger} = _set_logger( Koha::Logger->get( { interface => 'sip', category => $self->{account}->{id} } ) ); # Add id to namespace > C4::SIP::SIPServer::get_logger()->debug("telnet_transport: uname/inst: '$account->{id}/$account->{institution}'"); >- syslog("LOG_DEBUG", "telnet_transport: uname/inst: '%s/%s'", $account->{id}, $account->{institution}); > $self->sip_protocol_loop(); > C4::SIP::SIPServer::get_logger()->info("telnet_transport: shutting down"); >- syslog("LOG_INFO", "telnet_transport: shutting down"); > return; > } > >@@ -316,7 +295,6 @@ sub sip_protocol_loop { > eval { > local $SIG{ALRM} = sub { > C4::SIP::SIPServer::get_logger()->debug("Inactive: timed out"); >- syslog( 'LOG_DEBUG', 'Inactive: timed out' ); > die "Timed Out!\n"; > }; > my $previous_alarm = alarm($timeout); >@@ -329,7 +307,6 @@ sub sip_protocol_loop { > > unless ($inputbuf) { > C4::SIP::SIPServer::get_logger()->error("sip_protocol_loop: empty input skipped"); >- syslog( "LOG_ERR", "sip_protocol_loop: empty input skipped" ); > print("96$CR"); > next; > } >@@ -337,11 +314,6 @@ sub sip_protocol_loop { > my $status = C4::SIP::Sip::MsgType::handle( $inputbuf, $self, q{} ); > if ( !$status ) { > C4::SIP::SIPServer::get_logger()->error("sip_protocol_loop: failed to handle " . substr( $inputbuf, 0, 2 ) ); >- syslog( >- "LOG_ERR", >- "sip_protocol_loop: failed to handle %s", >- substr( $inputbuf, 0, 2 ) >- ); > } > next if $status eq REQUEST_ACS_RESEND; > } >@@ -377,18 +349,15 @@ sub read_request { > } > else { > C4::SIP::SIPServer::get_logger()->debug('EOF returned on read'); >- syslog( 'LOG_DEBUG', 'EOF returned on read' ); > return; > } > my $len = length $buffer; > if ( $len != $raw_length ) { > my $trim = $raw_length - $len; > C4::SIP::SIPServer::get_logger()->debug("read_request trimmed $trim character(s) "); >- syslog( 'LOG_DEBUG', "read_request trimmed $trim character(s) " ); > } > > C4::SIP::SIPServer::get_logger()->info("INPUT MSG: '$buffer'"); >- syslog( 'LOG_INFO', "INPUT MSG: '$buffer'" ); > return $buffer; > } > >@@ -425,7 +394,6 @@ sub get_timeout { > my $rv = sprintf( "%03d", $policy->{timeout} // 0 ); > if( length($rv) != 3 ) { > C4::SIP::SIPServer::get_logger()->error("LOG_ERR", "Policy timeout has wrong size: '$rv'"); >- syslog( "LOG_ERR", "Policy timeout has wrong size: '%s'", $rv ); > return '000'; > } > return $rv; >diff --git a/C4/SIP/Sip.pm b/C4/SIP/Sip.pm >index 1775eaf..52b02c8 100644 >--- a/C4/SIP/Sip.pm >+++ b/C4/SIP/Sip.pm >@@ -8,7 +8,6 @@ use strict; > use warnings; > use Exporter; > use Encode; >-use Sys::Syslog qw(syslog); > use POSIX qw(strftime); > use Socket qw(:crlf); > use IO::Handle; >@@ -62,9 +61,6 @@ sub add_field { > > if (!defined($value)) { > C4::SIP::SIPServer::get_logger()->debug("add_field: Undefined value being added to '$field_id'"); >- syslog("LOG_DEBUG", "add_field: Undefined value being added to '%s'", >- $field_id); >- $value = ''; > } > $value=~s/\r/ /g; # CR terminates a sip message > # Protect against them in sip text fields >@@ -118,8 +114,6 @@ sub add_count { > $count = sprintf("%04d", $count); > if (length($count) != 4) { > C4::SIP::SIPServer::get_logger()->debug("handle_patron_info: $label wrong size: '$count'"); >- syslog("LOG_WARNING", "handle_patron_info: %s wrong size: '%s'", >- $label, $count); > $count = ' ' x 4; > } > return $count; >@@ -190,7 +184,6 @@ sub write_msg { > STDOUT->autoflush(1); > print $msg, $terminator; > C4::SIP::SIPServer::get_logger()->info("OUTPUT MSG: '$msg'"); >- syslog("LOG_INFO", "OUTPUT MSG: '$msg'"); > } > > $last_response = $msg; >diff --git a/C4/SIP/Sip/Configuration.pm b/C4/SIP/Sip/Configuration.pm >index ea3d64f..56ffbc1 100644 >--- a/C4/SIP/Sip/Configuration.pm >+++ b/C4/SIP/Sip/Configuration.pm >@@ -64,8 +64,6 @@ sub find_service { > foreach my $addr ( '', '*:', "$sockaddr:", "[$sockaddr]:" ) { > $portstr = sprintf( "%s%s/%s", $addr, $port, lc $proto ); > C4::SIP::SIPServer::get_logger()->debug("Configuration::find_service: Trying $portstr"); >- Sys::Syslog::syslog( "LOG_DEBUG", >- "Configuration::find_service: Trying $portstr" ); > last if ( exists( ( $self->{listeners} )->{$portstr} ) ); > } > return $self->{listeners}->{$portstr}; >diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm >index 7db5ee2..56ebd54 100644 >--- a/C4/SIP/Sip/MsgType.pm >+++ b/C4/SIP/Sip/MsgType.pm >@@ -9,7 +9,6 @@ package C4::SIP::Sip::MsgType; > use strict; > use warnings; > use Exporter; >-use Sys::Syslog qw(syslog); > > use C4::SIP::Sip qw(:all); > use C4::SIP::Sip::Constants qw(:all); >@@ -267,16 +266,13 @@ sub new { > C4::SIP::SIPServer::get_logger()->debug("Sip::MsgType::new('$class', '". > substr($msg, 0, 10). > "...', '$msgtag'): seq.no '$seqno', protocol $protocol_version"); >- syslog( "LOG_DEBUG", "Sip::MsgType::new('%s', '%s...', '%s'): seq.no '%s', protocol %s", $class, substr( $msg, 0, 10 ), $msgtag, $seqno, $protocol_version ); > > # warn "SIP PROTOCOL: $protocol_version"; > if ( !exists( $handlers{$msgtag} ) ) { > C4::SIP::SIPServer::get_logger()->warn("new Sip::MsgType: Skipping message of unknown type '$msgtag' in '$msg'"); >- syslog( "LOG_WARNING", "new Sip::MsgType: Skipping message of unknown type '%s' in '%s'", $msgtag, $msg ); > return; > } elsif ( !exists( $handlers{$msgtag}->{protocol}->{$protocol_version} ) ) { > C4::SIP::SIPServer::get_logger()->warn("new Sip::MsgType: Skipping message '$msgtag' unsupported by protocol rev. '$protocol_version'"); >- syslog( "LOG_WARNING", "new Sip::MsgType: Skipping message '%s' unsupported by protocol rev. '%d'", $msgtag, $protocol_version ); > return; > } > >@@ -309,7 +305,6 @@ sub _initialize { > } > > C4::SIP::SIPServer::get_logger()->debug("Sip::MsgType::_initialize('$self->{name}', '$msg', '$proto->{template}', '$proto->{template_len}', ...)"); >- syslog( "LOG_DEBUG", "Sip::MsgType::_initialize('%s', '%s', '%s', '%s', ...)", $self->{name}, $msg, $proto->{template}, $proto->{template_len} ); > > $self->{fixed_fields} = [ unpack( $proto->{template}, $msg ) ]; # see http://perldoc.perl.org/5.8.8/functions/unpack.html > >@@ -320,10 +315,8 @@ sub _initialize { > > if ( !exists( $self->{fields}->{$fn} ) ) { > C4::SIP::SIPServer::get_logger()->warn("Unsupported field '$fn' in $self->{name}, message '$msg'"); >- syslog( "LOG_WARNING", "Unsupported field '%s' in %s message '%s'", $fn, $self->{name}, $msg ); > } elsif ( defined( $self->{fields}->{$fn} ) ) { > C4::SIP::SIPServer::get_logger()->warn("Duplicate field '$fn' (previous value '$self->{fields}->{$fn}') in $self->{name} message '$msg'"); >- syslog( "LOG_WARNING", "Duplicate field '%s' (previous value '%s') in %s message '%s'", $fn, $self->{fields}->{$fn}, $self->{name}, $msg ); > } else { > $self->{fields}->{$fn} = substr( $field, 2 ); > } >@@ -360,7 +353,6 @@ sub handle { > > if ( !verify_cksum($msg) ) { > C4::SIP::SIPServer::get_logger()->warn("Checksum failed on message '$msg'"); >- syslog( "LOG_WARNING", "Checksum failed on message '%s'", $msg ); > > # REQUEST_SC_RESEND with error detection > $last_response = REQUEST_SC_RESEND_CKSUM; >@@ -377,7 +369,6 @@ sub handle { > # We received a non-ED message when ED is supposed to be active. > # Warn about this problem, then process the message anyway. > C4::SIP::SIPServer::get_logger()->warn("Received message without error detection: '$msg'"); >- syslog( "LOG_WARNING", "Received message without error detection: '%s'", $msg ); > $error_detection = 0; > $self = C4::SIP::Sip::MsgType->new( $msg, 0 ); > } else { >@@ -391,7 +382,6 @@ sub handle { > } > unless ( $self->{handler} ) { > C4::SIP::SIPServer::get_logger()->warn("No handler defined for '$msg'"); >- syslog( "LOG_WARNING", "No handler defined for '%s'", $msg ); > $last_response = REQUEST_SC_RESEND; > print("$last_response\r"); > return REQUEST_ACS_RESEND; >@@ -515,7 +505,6 @@ sub handle_checkout { > # Off-line transactions need to be recorded, but there's > # not a lot we can do about it > C4::SIP::SIPServer::get_logger()->warn("received no-block checkout from terminal '$account->{id}'"); >- syslog( "LOG_WARNING", "received no-block checkout from terminal '%s'", $account->{id} ); > > $status = $ils->checkout_no_block( $patron_id, $item_id, $sc_renewal_policy, $trans_date, $nb_due_date ); > } else { >@@ -643,7 +632,6 @@ sub handle_checkin { > > # Off-line transactions, ick. > C4::SIP::SIPServer::get_logger()->warn("received no-block checkin from terminal '$account->{id}'"); >- syslog( "LOG_WARNING", "received no-block checkin from terminal '%s'", $account->{id} ); > $status = $ils->checkin_no_block( $item_id, $trans_date, $return_date, $item_props, $cancel ); > } else { > $status = $ils->checkin( $item_id, $trans_date, $return_date, $my_branch, $item_props, $cancel, $account->{checked_in_ok} ); >@@ -758,22 +746,18 @@ sub handle_sc_status { > $new_proto = 2; > } else { > C4::SIP::SIPServer::get_logger()->warn("Unrecognized protocol revision '$sc_protocol_version', falling back to '1'"); >- syslog( "LOG_WARNING", "Unrecognized protocol revision '%s', falling back to '1'", $sc_protocol_version ); > $new_proto = 1; > } > > if ( $new_proto != $protocol_version ) { > C4::SIP::SIPServer::get_logger()->info("Setting protocol level to $new_proto"); >- syslog( "LOG_INFO", "Setting protocol level to $new_proto" ); > $protocol_version = $new_proto; > } > > if ( $status == SC_STATUS_PAPER ) { > C4::SIP::SIPServer::get_logger()->warn("Self-Check unit '$self->{account}->{id}@$self->{account}->{institution}' out of paper"); >- syslog( "LOG_WARNING", "Self-Check unit '%s@%s' out of paper", $self->{account}->{id}, $self->{account}->{institution} ); > } elsif ( $status == SC_STATUS_SHUTDOWN ) { > C4::SIP::SIPServer::get_logger()->warn("Self-Check unit '$self->{account}->{id}@$self->{account}->{institution}' shutting down"); >- syslog( "LOG_WARNING", "Self-Check unit '%s@%s' shutting down", $self->{account}->{id}, $self->{account}->{institution} ); > } > > $self->{account}->{print_width} = $print_width; >@@ -814,11 +798,9 @@ sub login_core { > my $status = 1; # Assume it all works > if ( !exists( $server->{config}->{accounts}->{$uid} ) ) { > C4::SIP::SIPServer::get_logger()->warn("MsgType::login_core: Unknown login '$uid'"); >- syslog( "LOG_WARNING", "MsgType::login_core: Unknown login '$uid'" ); > $status = 0; > } elsif ( $server->{config}->{accounts}->{$uid}->{password} ne $pwd ) { > C4::SIP::SIPServer::get_logger()->warn("MsgType::login_core: Invalid password for login '$uid'"); >- syslog( "LOG_WARNING", "MsgType::login_core: Invalid password for login '$uid'" ); > $status = 0; > } else { > >@@ -833,18 +815,15 @@ sub login_core { > my $auth_status = api_auth( $uid, $pwd, $inst ); > if ( !$auth_status or $auth_status !~ /^ok$/i ) { > C4::SIP::SIPServer::get_logger()->warn("api_auth failed for SIP terminal '$uid' of '$inst': " . ($auth_status||'unknown') ); >- syslog( "LOG_WARNING", "api_auth failed for SIP terminal '%s' of '%s': %s", $uid, $inst, ( $auth_status || 'unknown' ) ); > $status = 0; > } else { > C4::SIP::SIPServer::get_logger()->info("Successful login/auth for '$server->{account}->{id}' of '$inst'"); >- syslog( "LOG_INFO", "Successful login/auth for '%s' of '%s'", $server->{account}->{id}, $inst ); > > # > # initialize connection to ILS > # > my $module = $server->{config}->{institutions}->{$inst}->{implementation}; > C4::SIP::SIPServer::get_logger()->debug("login_core: " . Dumper($module) ); >- syslog( "LOG_DEBUG", 'login_core: ' . Dumper($module) ); > > # Suspect this is always ILS but so we don't break any eccentic install (for now) > if ( $module eq 'ILS' ) { >@@ -853,7 +832,6 @@ sub login_core { > $module->use; > if ($@) { > C4::SIP::SIPServer::get_logger()->error("$server->{service}: Loading ILS implementation '$module' for institution '$inst' failed"); >- syslog( "LOG_ERR", "%s: Loading ILS implementation '%s' for institution '%s' failed", $server->{service}, $module, $inst ); > die("Failed to load ILS implementation '$module' for $inst"); > } > >@@ -861,7 +839,6 @@ sub login_core { > $server->{ils} = $module->new( $server->{institution}, $server->{account} ); > if ( !$server->{ils} ) { > C4::SIP::SIPServer::get_logger()->error("$server->{service}: ILS connection to '$inst' failed"); >- syslog( "LOG_ERR", "%s: ILS connection to '%s' failed", $server->{service}, $inst ); > die("Unable to connect to ILS '$inst'"); > } > } >@@ -885,7 +862,6 @@ sub handle_login { > > if ( $uid_algorithm || $pwd_algorithm ) { > C4::SIP::SIPServer::get_logger()->error("LOGIN: Unsupported non-zero encryption method(s): uid = $uid_algorithm, pwd = $pwd_algorithm"); >- syslog( "LOG_ERR", "LOGIN: Unsupported non-zero encryption method(s): uid = $uid_algorithm, pwd = $pwd_algorithm" ); > $status = 0; > } else { > $status = login_core( $server, $uid, $pwd ); >@@ -925,14 +901,12 @@ sub summary_info { > } > > C4::SIP::SIPServer::get_logger()->debug("Summary_info: index == '$summary_type', field '$summary_map[$summary_type]->{fid}'"); >- syslog( "LOG_DEBUG", "Summary_info: index == '%d', field '%s'", $summary_type, $summary_map[$summary_type]->{fid} ); > > my $func = $summary_map[$summary_type]->{func}; > my $fid = $summary_map[$summary_type]->{fid}; > my $itemlist = &$func( $patron, $start, $end, $server ); > > C4::SIP::SIPServer::get_logger()->debug("summary_info: list = (" . join(", ", @{$itemlist}) . ")"); >- syslog( "LOG_DEBUG", "summary_info: list = (%s)", join( ", ", @{$itemlist} ) ); > foreach my $i ( @{$itemlist} ) { > $resp .= add_field( $fid, $i->{barcode} ); > } >@@ -1205,7 +1179,6 @@ sub handle_item_status_update { > > if ( !defined($item_id) ) { > C4::SIP::SIPServer::get_logger()->warn("handle_item_status: received message without Item ID field"); >- syslog( "LOG_WARNING", "handle_item_status: received message without Item ID field" ); > } else { > $item = $ils->find_item($item_id); > } >@@ -1251,7 +1224,6 @@ sub handle_patron_enable { > $patron_pwd = $fields->{ (FID_PATRON_PWD) }; > > C4::SIP::SIPServer::get_logger()->debug("handle_patron_enable: patron_id: '$patron_id', patron_pwd: '$patron_pwd'"); >- syslog( "LOG_DEBUG", "handle_patron_enable: patron_id: '%s', patron_pwd: '%s'", $patron_id, $patron_pwd ); > > $patron = $ils->find_patron($patron_id); > >@@ -1322,7 +1294,6 @@ sub handle_hold { > $status = $ils->alter_hold( $patron_id, $patron_pwd, $item_id, $title_id, $expiry_date, $pickup_locn, $hold_type, $fee_ack ); > } else { > C4::SIP::SIPServer::get_logger()->warn("handle_hold: Unrecognized hold mode '$hold_mode' from terminal '$server->{account}->{id}'"); >- syslog( "LOG_WARNING", "handle_hold: Unrecognized hold mode '%s' from terminal '%s'", $hold_mode, $server->{account}->{id} ); > $status = $ils->Transaction::Hold; # new? > $status->screen_msg("System error. Please contact library staff."); > } >@@ -1371,7 +1342,6 @@ sub handle_renew { > > if ( $no_block eq 'Y' ) { > C4::SIP::SIPServer::get_logger()->warn("handle_renew: received 'no block' renewal from terminal '$server->{account}->{id}'"); >- syslog( "LOG_WARNING", "handle_renew: received 'no block' renewal from terminal '%s'", $server->{account}->{id} ); > } > > $patron_id = $fields->{ (FID_PATRON_ID) }; >@@ -1539,7 +1509,6 @@ sub send_acs_status { > > if ( length($retries) != 3 ) { > C4::SIP::SIPServer::get_logger()->error("handle_acs_status: timeout field wrong size: '$timeout'"); >- syslog( "LOG_ERR", "handle_acs_status: retries field wrong size: '%s'", $retries ); > $retries = '000'; > } > >@@ -1553,7 +1522,6 @@ sub send_acs_status { > $msg .= '2.00'; > } else { > C4::SIP::SIPServer::get_logger()->error("Bad setting for \$protocol_version, '$protocol_version' in send_acs_status"); >- syslog( "LOG_ERR", 'Bad setting for $protocol_version, "%s" in send_acs_status', $protocol_version ); > $msg .= '1.00'; > } > >@@ -1574,7 +1542,6 @@ sub send_acs_status { > } > if ( length($supported_msgs) < 16 ) { > C4::SIP::SIPServer::get_logger()->error("send_acs_status: supported messages '$supported_msgs' too short"); >- syslog( "LOG_ERR", 'send_acs_status: supported messages "%s" too short', $supported_msgs ); > } > $msg .= add_field( FID_SUPPORTED_MSGS, $supported_msgs ); > } >@@ -1585,7 +1552,6 @@ sub send_acs_status { > && defined($print_line) > && $account->{print_width} < length($print_line) ) { > C4::SIP::SIPServer::get_logger()->warn("send_acs_status: print line '$print_line' too long. Truncating"); >- syslog( "LOG_WARNING", "send_acs_status: print line '%s' too long. Truncating", $print_line ); > $print_line = substr( $print_line, 0, $account->{print_width} ); > } > >@@ -1606,7 +1572,6 @@ sub patron_status_string { > my $patron_status; > > C4::SIP::SIPServer::get_logger()->debug("patron_status_string: $patron->id charge_ok: $patron->charge_ok"); >- syslog( "LOG_DEBUG", "patron_status_string: %s charge_ok: %s", $patron->id, $patron->charge_ok ); > $patron_status = sprintf( > '%s%s%s%s%s%s%s%s%s%s%s%s%s%s', > denied( $patron->charge_ok ), >diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml >index f51f093..a60f959 100644 >--- a/etc/SIPconfig.xml >+++ b/etc/SIPconfig.xml >@@ -10,9 +10,6 @@ > <server-params > min_servers='1' > min_spare_servers='0' >- log_file='Sys::Syslog' >- syslog_ident='koha_sip' >- syslog_facility='local6' > /> > > <listeners> >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15253
:
45824
|
45825
|
45826
|
58570
|
58571
|
58572
|
58573
|
58582
|
60872
|
65219
|
65220
|
65221
|
65222
|
65223
|
65224
|
65225
|
65226
|
65227
|
65228
|
71702
|
71703
|
74947
|
86573
|
86574
|
87993
|
88383
|
100062
|
100063
|
100379
|
102216
|
102217
|
102218
|
102219
|
103456
|
103457
|
103458
|
103459
|
103462
|
103499
|
103500
|
103501
|
103502
|
103503
|
103599
|
103915
|
103916
|
103917
|
103918
|
103919
|
103920
|
103921
|
104016
|
104667
|
104668
|
104669
|
104670
|
104671
|
104672
|
104673
|
104674
|
111169