Bugzilla – Attachment 45826 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), 38.24 KB, created by
Kyle M Hall (khall)
on 2015-12-18 14:00:40 UTC
(
hide
)
Description:
Bug 15253 - Remove use of syslog
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-12-18 14:00:40 UTC
Size:
38.24 KB
patch
obsolete
>From 04a995d1fa597ed8cdb8e0b79bcef22ce9fa921a Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 17 Dec 2015 16:00:20 +0000 >Subject: [PATCH] Bug 15253 - Remove use of syslog > >--- > C4/SIP/ILS.pm | 12 -------- > C4/SIP/ILS/Item.pm | 5 ---- > C4/SIP/ILS/Patron.pm | 6 ---- > C4/SIP/ILS/Transaction/Checkout.pm | 2 -- > C4/SIP/ILS/Transaction/RenewAll.pm | 7 ----- > C4/SIP/README | 9 ++++-- > C4/SIP/SIPServer.pm | 25 ---------------- > C4/SIP/Sip.pm | 17 ++--------- > C4/SIP/Sip/Configuration.pm | 2 -- > C4/SIP/Sip/MsgType.pm | 58 ------------------------------------ > etc/SIPconfig.xml | 3 -- > 11 files changed, 8 insertions(+), 138 deletions(-) > >diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm >index 61058df..d160b32 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); > $server->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: new ILS $institution->{id}"); >- syslog("LOG_DEBUG", "new ILS '%s'", $institution->{id}); > $self->{institution} = $institution; > $self->{server} = $server; > return bless $self, $type; >@@ -85,7 +83,6 @@ sub check_inst_id { > my ($self, $id, $whence) = @_; > if ($id ne $self->{institution}->{id}) { > $self->{server}->{logger}->warn("$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: $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 > } > } >@@ -166,12 +163,9 @@ sub checkout { > $circ->desensitize(!$item->magnetic_media); > > $self->{server}->{logger}->debug("$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: ILS::Checkout: patron $patron_id has checked out " . join(', ', @{$patron->{items}}) ); >- syslog("LOG_DEBUG", "ILS::Checkout: patron %s has checked out %s", >- $patron_id, join(', ', @{$patron->{items}})); > } > else { > $self->{server}->{logger}->error("$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: ILS::Checkout Issue failed"); >- syslog("LOG_ERR", "ILS::Checkout Issue failed"); > } > } > # END TRANSACTION >@@ -201,12 +195,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} ) ); > $self->{server}->{logger}->debug("$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: 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; > $self->{server}->{logger}->debug("$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: C4::SIP::ILS::checkin - item not checked out"); >- syslog("LOG_DEBUG", "C4::SIP::ILS::checkin - item not checked out"); > } > else { > if ( $circ->ok ) { >@@ -434,14 +426,12 @@ sub renew { > foreach my $i (@{$patron->{items}}) { > unless (defined $i->{barcode}) { # FIXME: using data instead of objects may violate the abstraction layer > $self->{server}->{logger}->error("$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: 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; > } > $self->{server}->{logger}->debug( "$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: " > . "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, $self->{server} ); >@@ -476,10 +466,8 @@ sub renew_all { > $trans->patron( $patron = C4::SIP::ILS::Patron->new( $patron_id, $self->{server} ) ); > if (defined $patron) { > $self->{server}->{logger}->debug("$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: 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 { > $self->{server}->{logger}->debug("$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: 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 2ae11bf..0f2bd40 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 C4::SIP::ILS::Transaction; >@@ -80,7 +79,6 @@ sub new { > my $item = GetBiblioFromItemNumber($itemnumber); # actually biblio.*, biblioitems.* AND items.* (overkill) > if (! $item) { > $server->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: 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; > } >@@ -110,8 +108,6 @@ sub new { > bless $self, $type; > > $server->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: 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; > } >@@ -174,7 +170,6 @@ sub hold_patron_name { > my $holder = GetMember(borrowernumber=>$borrowernumber); > unless ($holder) { > $self->{server}->{logger}->debug("$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: While checking hold, GetMember failed for borrowernumber '$borrowernumber'"); >- syslog("LOG_ERR", "While checking hold, GetMember failed for borrowernumber '$borrowernumber'"); > return; > } > my $email = $holder->{email} || ''; >diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm >index 2d6057f..fa827cf 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 (GetMember): " . Dumper($kp); > unless (defined $kp) { > $server->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: new ILS::Patron($patron_id): no such patron"); >- syslog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id); > return; > } > $kp = GetMemberDetails($kp->{borrowernumber}); >@@ -126,7 +124,6 @@ sub new { > $self->{server} = $server; > $debug and warn Dumper($self); > $self->{server}->{logger}->debug("$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: 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; > } >@@ -329,9 +326,6 @@ sub enable { > $self->{server}->{logger}->debug( "$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: " > . "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 91430c4..23b730b 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 ); > >@@ -50,7 +49,6 @@ sub new { > sub do_checkout { > my $self = shift; > $self->{server}->{logger}->debug("$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: 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; >diff --git a/C4/SIP/ILS/Transaction/RenewAll.pm b/C4/SIP/ILS/Transaction/RenewAll.pm >index c4fb5a6..b3e3822 100644 >--- a/C4/SIP/ILS/Transaction/RenewAll.pm >+++ b/C4/SIP/ILS/Transaction/RenewAll.pm >@@ -6,7 +6,6 @@ package C4::SIP::ILS::Transaction::RenewAll; > use strict; > use warnings; > >-use Sys::Syslog qw(syslog); > use C4::SIP::ILS::Item; > > use C4::Members qw( GetMember ); >@@ -45,12 +44,6 @@ sub do_renew_all { > my $item = C4::SIP::ILS::Item->new($item_id); > if ( !defined($item) ) { > $self->{server}->{logger}->debug("$self->{server}->{server}->{peeraddr}:$self->{server}->{account}->{id}: 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..21c736c 100644 >--- a/C4/SIP/README >+++ b/C4/SIP/README >@@ -14,11 +14,14 @@ 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 14d3d07..7559807 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); >@@ -112,7 +111,6 @@ sub process_request { > > if (!defined($self->{service})) { > $self->{logger}->error("$self->{server}->{peeraddr}: 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"; > } > >@@ -120,7 +118,6 @@ sub process_request { > > if (!defined($transport)) { > $self->{logger}->warn("$self->{server}->{peeraddr}: Unknown transport '$service->{transport}', dropping"); >- syslog("LOG_WARNING", "Unknown transport '%s', dropping", $service->{transport}); > return; > } else { > &$transport($self); >@@ -140,14 +137,12 @@ sub raw_transport { > local $SIG{ALRM} = sub { die "raw_transport Timed Out!\n"; }; > > $self->{logger}->debug("$self->{server}->{peeraddr}: raw_transport: timeout is $service->{timeout}"); >- syslog("LOG_DEBUG", "raw_transport: timeout is %d", $service->{timeout}); > > $C4::SIP::Sip::server = $self; > $input = read_SIP_packet(*STDIN); > if (!$input) { > # EOF on the socket > $self->{logger}->info("$self->{server}->{peeraddr}: 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) >@@ -156,12 +151,10 @@ sub raw_transport { > > $self->{logger} = Koha::Logger->get( { interface => 'sip', category => $self->{account}->{id} } ); # Add id to namespace > $self->{logger}->debug("$self->{server}->{peeraddr}:$self->{account}->{id}: 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}); > > $self->sip_protocol_loop(); > > $self->{logger}->info("$self->{server}->{peeraddr}:$self->{account}->{id}: raw_transport: shutting down"); >- syslog("LOG_INFO", "raw_transport: shutting down"); > } > > sub get_clean_string { >@@ -169,18 +162,15 @@ sub get_clean_string { > my $string = shift; > if ( defined $string ) { > $self->{logger}->debug( "$self->{server}->{peeraddr}: 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]+$//; > > $self->{logger}->debug( "$self->{server}->{peeraddr}: get_clean_string post-clean(length " . length($string) . "): $string)" ); >- syslog( "LOG_DEBUG", "get_clean_string post-clean(length %s): %s", length($string), $string ); > } > else { > $self->{logger}->info("$self->{server}->{peeraddr}: get_clean_string called on undefined"); >- syslog( "LOG_INFO", "get_clean_string called on undefined" ); > } > return $string; > } >@@ -191,10 +181,6 @@ sub get_clean_input { > my $in = <STDIN>; > $in = get_clean_string($in); > >- while ( my $extra = <STDIN> ) { >- syslog( "LOG_ERR", "get_clean_input got extra lines: %s", $extra ); >- } >- > return $in; > } > >@@ -208,7 +194,6 @@ sub telnet_transport { > my $timeout = $self->{service}->{timeout} || $config->{timeout} || 30; > > $self->{logger}->debug("$self->{server}->{peeraddr}: telnet_transport: timeout is $timeout"); >- syslog("LOG_DEBUG", "telnet_transport: timeout is %s", $timeout); > > eval { > local $SIG{ALRM} = sub { die "telnet_transport: Timed Out ($timeout seconds)!\n"; }; >@@ -228,11 +213,9 @@ sub telnet_transport { > alarm 0; > > $self->{logger}->debug( "$self->{server}->{peeraddr}: 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 = $self->get_clean_string($uid); > $pwd = $self->get_clean_string($pwd); > $self->{logger}->debug( "$self->{server}->{peeraddr}: 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})) { >@@ -242,19 +225,16 @@ sub telnet_transport { > } > } > $self->{logger}->warn("$self->{server}->{peeraddr}: Invalid login attempt: ' . ($uid||'') . '"); >- syslog("LOG_WARNING", "Invalid login attempt: '%s'", ($uid||'')); > print("Invalid login$CRLF"); > } > }; # End of eval > > if ($@) { > $self->{logger}->error("$self->{server}->{peeraddr}: telnet_transport: Login timed out"); >- syslog( "LOG_ERR", "telnet_transport: Login timed out" ); > die "Telnet Login Timed out"; > } > elsif ( !defined($account) ) { > $self->{logger}->error("$self->{server}->{peeraddr}: telnet_transport: Login Failed"); >- syslog( "LOG_ERR", "telnet_transport: Login Failed" ); > die "Login Failure"; > } > else { >@@ -264,10 +244,8 @@ sub telnet_transport { > $self->{account} = $account; > $self->{logger} = Koha::Logger->get( { interface => 'sip', category => $self->{account}->{id} } ); # Add id to namespace > $self->{logger}->debug("$self->{server}->{peeraddr}:$self->{account}->{id}: 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(); > $self->{logger}->info("$self->{server}->{peeraddr}:$self->{account}->{id}: telnet_transport: shutting down"); >- syslog("LOG_INFO", "telnet_transport: shutting down"); > } > > # >@@ -311,7 +289,6 @@ sub sip_protocol_loop { > while (chomp($input)) {warn "Extra line ending on input";} > unless ($input) { > $self->{logger}->error("$self->{server}->{peeraddr}:$self->{account}->{id}: sip_protocol_loop: empty input skipped"); >- syslog("LOG_ERR", "sip_protocol_loop: empty input skipped"); > print("96$CR"); > next; > } >@@ -319,13 +296,11 @@ sub sip_protocol_loop { > my $status = handle($input, $self, $expect); > if ( !$status ) { > $self->{logger}->error( "$self->{server}->{peeraddr}:$self->{account}->{id}: sip_protocol_loop: failed to handle " . substr( $input, 0, 2 ) ); >- syslog( "LOG_ERR", "sip_protocol_loop: failed to handle %s", substr( $input, 0, 2 ) ); > } > next if $status eq REQUEST_ACS_RESEND; > if ( $expect && ( $status ne $expect ) ) { > # We received a non-"RESEND" that wasn't what we were expecting. > $self->{logger}->error("$self->{server}->{peeraddr}:$self->{account}->{id}: sip_protocol_loop: expected $expect, received $input, exiting"); >- syslog( "LOG_ERR", "sip_protocol_loop: expected %s, received %s, exiting", $expect, $input ); > } > # We successfully received and processed what we were expecting > $expect = ''; >diff --git a/C4/SIP/Sip.pm b/C4/SIP/Sip.pm >index ea678a5..edb3f26 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; >@@ -71,8 +70,6 @@ sub add_field { > > if (!defined($value)) { > $server->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: 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 >@@ -125,11 +122,9 @@ sub add_count { > } > > $count = sprintf("%04d", $count); >- if (length($count) != 4) { >+ if ( length($count) != 4 ) { > $server->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: handle_patron_info: $label wrong size: '$count'"); >- syslog("LOG_WARNING", "handle_patron_info: %s wrong size: '%s'", >- $label, $count); >- $count = ' ' x 4; >+ $count = ' ' x 4; > } > return $count; > } >@@ -170,7 +165,6 @@ sub read_SIP_packet { > my $fh; > unless ( $fh = shift ) { > $server->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: read_SIP_packet: no filehandle argument!"); >- syslog("LOG_ERR", "read_SIP_packet: no filehandle argument!"); > } > my $len1 = 999; > >@@ -183,7 +177,6 @@ sub read_SIP_packet { > while ( chomp($record) ) { 1; } > $len1 = length($record); > $server->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: read_SIP_packet, INPUT MSG: '$record'"); >- syslog( "LOG_DEBUG", "read_SIP_packet, INPUT MSG: '$record'" ); > $record =~ s/^\s*[^A-z0-9]+//s; # Every line must start with a "real" character. Not whitespace, control chars, etc. > $record =~ s/[^A-z0-9]+$//s; # Same for the end. Note this catches the problem some clients have sending empty fields at the end, like ||| > $record =~ s/\015?\012//g; # Extra line breaks must die >@@ -198,18 +191,15 @@ sub read_SIP_packet { > my $len2 = length($record); > if ( $record ) { > $server->{logger}->info("$server->{server}->{peeraddr}:$server->{account}->{id}: read_SIP_packet, INPUT MSG: '$record'"); >- syslog("LOG_INFO", "read_SIP_packet, INPUT MSG: '$record'"); > } > if ($len1 != $len2) { > $server->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: read_SIP_packet, trimmed " . $len1-$len2 . " character(s) (after chomps)."); >- syslog("LOG_DEBUG", "read_SIP_packet, trimmed %s character(s) (after chomps).", $len1-$len2); > } > } else { > $server->{logger}->debug( "$server->{server}->{peeraddr}:$server->{account}->{id}: " > . "read_SIP_packet input " > . ( defined($record) ? "empty ($record)" : 'undefined' ) > . ", end of input." ); >- syslog("LOG_WARNING", "read_SIP_packet input %s, end of input.", (defined($record) ? "empty ($record)" : 'undefined')); > } > # > # Cen-Tec self-check terminals transmit '\r\n' line terminators. >@@ -223,10 +213,8 @@ sub read_SIP_packet { > # on the input. > # > # This is now handled by the vigorous cleansing above. >- # syslog("LOG_INFO", encode_utf8("INPUT MSG: '$record'")) if $record; > if ( $record ) { > $server->{logger}->debug( "$server->{server}->{peeraddr}:$server->{account}->{id}: INPUT MSG: '$record'" ); >- syslog("LOG_INFO", "INPUT MSG: '$record'"); > } > return $record; > } >@@ -270,7 +258,6 @@ sub write_msg { > STDOUT->autoflush(1); > print $msg, $terminator; > $server->{logger}->info( "$server->{server}->{peeraddr}:$server->{account}->{id}: 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 8450fcc..f17cb16 100644 >--- a/C4/SIP/Sip/Configuration.pm >+++ b/C4/SIP/Sip/Configuration.pm >@@ -65,8 +65,6 @@ sub find_service { > foreach my $addr ( '', '*:', "$sockaddr:", "[$sockaddr]:" ) { > $portstr = sprintf( "%s%s/%s", $addr, $port, lc $proto ); > $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 a2b9440..8a95577 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); >@@ -290,17 +289,11 @@ sub new { > my $id = $server->{account} ? $server->{account}->{id} . ':' : q{}; > $server->{logger}->debug( "$server->{server}->{peeraddr}:$id 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); > if (!exists($handlers{$msgtag})) { > $server->{logger}->warn("$server->{server}->{peeraddr}:$id 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})) { > $server->{logger}->warn("$server->{server}->{peeraddr}:$id 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; > } > >@@ -335,8 +328,6 @@ sub _initialize { > > my $id = $self->{server}->{account} ? $self->{server}->{account}->{id} . ':' : q{}; > $self->{server}->{logger}->debug("$self->{server}->{server}->{peeraddr}:$id 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 > >@@ -347,12 +338,8 @@ sub _initialize { > > if (!exists($self->{fields}->{$fn})) { > $self->{server}->{logger}->warn("$self->{server}->{server}->{peeraddr}:$id: 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})) { > $self->{server}->{logger}->warn("$self->{server}->{server}->{peeraddr}:$id: 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); > } >@@ -388,7 +375,6 @@ sub handle { > > if (!verify_cksum($msg)) { > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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; > print("$last_response\r"); >@@ -402,8 +388,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. > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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, $server ); > } else { >@@ -416,7 +400,6 @@ sub handle { > } > unless ($self->{handler}) { > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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; >@@ -531,7 +514,6 @@ sub handle_checkout { > # Off-line transactions need to be recorded, but there's > # not a lot we can do about it > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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 ); > } >@@ -654,7 +636,6 @@ sub handle_checkin { > if ($no_block eq 'Y') { > # Off-line transactions, ick. > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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}); >@@ -774,24 +755,18 @@ sub handle_sc_status { > $new_proto = 2; > } else { > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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) { > $server->{logger}->info("$server->{server}->{peeraddr}:$server->{account}->{id}: Setting protocol level to $new_proto"); >- syslog("LOG_INFO", "Setting protocol level to $new_proto"); > $protocol_version = $new_proto; > } > > if ($status == SC_STATUS_PAPER) { > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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) { > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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; >@@ -829,11 +804,9 @@ sub login_core { > my $status = 1; # Assume it all works > if (!exists($server->{config}->{accounts}->{$uid})) { > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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) { > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: MsgType::login_core: Invalid password for login '$uid'"); >- syslog("LOG_WARNING", "MsgType::login_core: Invalid password for login '$uid'"); > $status = 0; > } else { > # Store the active account someplace handy for everybody else to find. >@@ -847,18 +820,14 @@ sub login_core { > my $auth_status = api_auth($uid,$pwd,$inst); > if (!$auth_status or $auth_status !~ /^ok$/i) { > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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 { > $server->{logger}->info("$server->{server}->{peeraddr}:$server->{account}->{id}: 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}; > $server->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: 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') { > $module = 'C4::SIP::ILS'; >@@ -866,8 +835,6 @@ sub login_core { > $module->use; > if ($@) { > $server->{logger}->error("$server->{server}->{peeraddr}:$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"); > } > >@@ -876,7 +843,6 @@ sub login_core { > $server->{ils} = $module->new( $server->{institution}, $server->{account}, $server ); > if (!$server->{ils}) { > $server->{logger}->error("$server->{server}->{peeraddr}:$server->{account}->{id}: $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'"); > } > } >@@ -900,7 +866,6 @@ sub handle_login { > > if ($uid_algorithm || $pwd_algorithm) { > $server->{logger}->error("$server->{server}->{peeraddr}:$server->{account}->{id}: 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); } >@@ -938,15 +903,12 @@ sub summary_info { > } > > $server->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: 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->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: summary_info: list = (" . join(", ", @{$itemlist}) . ")"); >- syslog("LOG_DEBUG", "summary_info: list = (%s)", join(", ", @{$itemlist})); > foreach my $i (@{$itemlist}) { > $resp .= add_field($fid, $i->{barcode}); > } >@@ -1207,8 +1169,6 @@ sub handle_item_status_update { > > if (!defined($item_id)) { > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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); > } >@@ -1252,8 +1212,6 @@ sub handle_patron_enable { > $patron_pwd = $fields->{(FID_PATRON_PWD)}; > > $server->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: 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); > >@@ -1324,8 +1282,6 @@ sub handle_hold { > $expiry_date, $pickup_locn, $hold_type, $fee_ack); > } else { > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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."); > } >@@ -1375,9 +1331,6 @@ sub handle_renew { > > if ($no_block eq 'Y') { > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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)}; >@@ -1545,15 +1498,11 @@ sub send_acs_status { > > if (length($timeout) != 3) { > $server->{logger}->error("$server->{server}->{peeraddr}:$server->{account}->{id}: handle_acs_status: timeout field wrong size: '$timeout'"); >- syslog("LOG_ERR", "handle_acs_status: timeout field wrong size: '%s'", >- $timeout); > $timeout = '000'; > } > > if (length($retries) != 3) { > $server->{logger}->error("$server->{server}->{peeraddr}:$server->{account}->{id}: handle_acs_status: retries field wrong size: '$retries'"); >- syslog("LOG_ERR", "handle_acs_status: retries field wrong size: '%s'", >- $retries); > $retries = '000'; > } > >@@ -1567,9 +1516,6 @@ sub send_acs_status { > $msg .= '2.00'; > } else { > $server->{logger}->error("$server->{server}->{peeraddr}:$server->{account}->{id}: 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'; > } > >@@ -1589,7 +1535,6 @@ sub send_acs_status { > } > if (length($supported_msgs) < 16) { > $server->{logger}->error("$server->{server}->{peeraddr}:$server->{account}->{id}: 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); > } >@@ -1599,8 +1544,6 @@ sub send_acs_status { > if (defined($account->{print_width}) && defined($print_line) > && $account->{print_width} < length($print_line)) { > $server->{logger}->warn("$server->{server}->{peeraddr}:$server->{account}->{id}: 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}); > } > >@@ -1622,7 +1565,6 @@ sub patron_status_string { > my $patron_status; > > $server->{logger}->debug("$server->{server}->{peeraddr}:$server->{account}->{id}: 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 141bc4f..02b2428 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> >-- >1.7.10.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