[Koha-patches] [PATCH] [labels_recon] [ 1/6] replace syslog with warns

Galen Charlton gmcharlt at gmail.com
Sun Sep 6 03:42:36 CEST 2009


As discussed with Chris Nighswonger on #koha, this patch
removes the calls to syslog and replaces them with warns
so that error messages generated by the labels code
are sent to the Apache error log.  This avoids splitting
this sort of logging across multiple files and is consistent
with current practice in most of the rest of Koha.

Signed-off-by: Galen Charlton <gmcharlt at gmail.com>
---
 C4/Labels/Batch.pm                                 |   28 +++++++--------
 C4/Labels/Label.pm                                 |   35 +++++++++----------
 C4/Labels/Layout.pm                                |   21 ++++++------
 C4/Labels/Lib.pm                                   |   29 ++++++++--------
 C4/Labels/Profile.pm                               |   21 ++++++------
 C4/Labels/Template.pm                              |   19 +++++------
 C4/Patroncards/Patroncards.pm                      |   22 ++++++-------
 .../prog/en/modules/labels/label-edit-batch.tmpl   |    2 +-
 .../prog/en/modules/labels/label-manage.tmpl       |    2 +-
 labels/label-create-csv.pl                         |    3 +-
 labels/label-create-pdf.pl                         |    1 -
 labels/label-create-xml.pl                         |    5 ---
 labels/label-edit-batch.pl                         |    1 -
 labels/label-edit-layout.pl                        |    5 +--
 labels/label-edit-profile.pl                       |    1 -
 labels/label-edit-template.pl                      |    1 -
 labels/label-item-search.pl                        |    3 +-
 labels/label-manage.pl                             |    1 -
 t/db_dependent/Labels/t_Batch.t                    |   14 ++++----
 t/db_dependent/Labels/t_Layout.t                   |   10 +++---
 t/db_dependent/Labels/t_Profile.t                  |   12 +++---
 t/db_dependent/Labels/t_Template.t                 |   10 +++---
 tools/manage-marc-import.pl                        |    5 +--
 23 files changed, 115 insertions(+), 136 deletions(-)

diff --git a/C4/Labels/Batch.pm b/C4/Labels/Batch.pm
index d1bc677..8ac4f69 100644
--- a/C4/Labels/Batch.pm
+++ b/C4/Labels/Batch.pm
@@ -3,8 +3,6 @@ package C4::Labels::Batch;
 use strict;
 use warnings;
 
-use Sys::Syslog qw(syslog);
-
 use C4::Context;
 use C4::Debug;
 
@@ -25,14 +23,14 @@ sub _check_params {
         $given_params = {@_};
         foreach my $key (keys %{$given_params}) {
             if (!(grep m/$key/, @valid_template_params)) {
-                syslog("LOG_ERR", "C4::Labels::Batch : Unrecognized parameter type of \"%s\".", $key);
+                warn sprintf('Unrecognized parameter type of "%s".', $key);
                 $exit_code = 1;
             }
         }
     }
     else {
         if (!(grep m/$_/, @valid_template_params)) {
-            syslog("LOG_ERR", "C4::Labels::Batch : Unrecognized parameter type of \"%s\".", $_);
+            warn sprintf('Unrecognized parameter type of %s', $_);
             $exit_code = 1;
         }
     }
@@ -65,7 +63,7 @@ sub add_item {
 #    $sth->{'TraceLevel'} = 3;
     $sth->execute($self->{'batch_id'}, $item_number, $self->{'branch_code'});
     if ($sth->err) {
-        syslog("LOG_ERR", "C4::Labels::Batch->add_item : Database returned the following error on attempted INSERT: %s", $sth->errstr);
+        warn sprintf('Database returned the following error on attempted INSERT: %s', $sth->errstr);
         return -1;
     }
     $query = "SELECT max(label_id) FROM labels_batches WHERE batch_id=? AND item_number=? AND branch_code=?;";
@@ -90,7 +88,7 @@ sub remove_item {
 #    $sth->{'TraceLevel'} = 3;
     $sth->execute($label_id, $self->{'batch_id'});
     if ($sth->err) {
-        syslog("LOG_ERR", "C4::Labels::Batch->remove_item : Database returned the following error on attempted DELETE: %s", $sth->errstr);
+        warn sprintf('Database returned the following error on attempted DELETE: %s', $sth->errstr);
         return -1;
     }
     @{$self->{'items'}} = grep{$_->{'label_id'} != $label_id} @{$self->{'items'}};
@@ -106,7 +104,7 @@ sub remove_item {
 #
 #    Invoking the I<save> method attempts to insert the batch into the database. The method returns
 #    the new record batch_id upon success and -1 upon failure (This avoids conflicting with a record
-#    batch_id of 1). Errors are logged to the syslog.
+#    batch_id of 1). Errors are logged to the Apache log.
 #
 #    example:
 #        my $exitstat = $batch->save(); # to save the record behind the $batch object
@@ -120,7 +118,7 @@ sub remove_item {
 #        my $sth1 = C4::Context->dbh->prepare($query);
 #        $sth1->execute($self->{'batch_id'}, $item_number->{'item_number'}, $self->{'branch_code'});
 #        if ($sth1->err) {
-#            syslog("LOG_ERR", "C4::Labels::Batch->save : Database returned the following error on attempted INSERT: %s", $sth1->errstr);
+#            warn sprintf('Database returned the following error on attempted INSERT: %s', $sth1->errstr);
 #            return -1;
 #        }
 #        $self->{'batch_stat'} = 1;
@@ -148,7 +146,7 @@ sub retrieve {
     }
     return -2 if $record_flag == 0;     # a hackish sort of way of indicating no such record exists
     if ($sth->err) {
-        syslog("LOG_ERR", "C4::Labels::Batch->retrieve : Database returned the following error on attempted SELECT: %s", $sth->errstr);
+        warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr);
         return -1;
     }
     $self->{'batch_stat'} = 1;
@@ -172,7 +170,7 @@ sub delete {
         @query_params = ($opts{'batch_id'}, $opts{'branch_code'});
     }
     if ($query_params[0] eq '') {   # If there is no template id then we cannot delete it
-        syslog("LOG_ERR", "%s : Cannot delete batch as the batch id is invalid or non-existant.", $call_type);
+        warn sprtinf('%s : Cannot delete batch as the batch id is invalid or non-existent.', $call_type);
         return -1;
     }
     my $query = "DELETE FROM labels_batches WHERE batch_id = ? AND branch_code =?";
@@ -180,7 +178,7 @@ sub delete {
 #    $sth->{'TraceLevel'} = 3;
     $sth->execute(@query_params);
     if ($sth->err) {
-        syslog("LOG_ERR", "%s : Database returned the following error on attempted INSERT: %s", $call_type, $sth->errstr);
+        warn sprintf('%s : Database returned the following error on attempted INSERT: %s', $call_type, $sth->errstr);
         return -1;
     }
     return 0;
@@ -195,7 +193,7 @@ sub remove_duplicates {
     foreach my $item (@duplicate_items) {
         $sth->execute($item->{'label_id'});
         if ($sth->err) {
-            syslog("LOG_ERR", "C4::Labels::Batch->remove_duplicates() : Database returned the following error on attempted DELETE for label_id %s: %s", $item->{'label_id'}, $sth->errstr);
+            warn sprintf('Database returned the following error on attempted DELETE for label_id %s: %s', $item->{'label_id'}, $sth->errstr);
             return -1;
         }
         $sth->finish(); # Per DBI.pm docs: "If execute() is called on a statement handle that's still active ($sth->{Active} is true) then it should effectively call finish() to tidy up the previous execution results before starting this new execution."
@@ -257,7 +255,7 @@ This module provides methods for creating, and otherwise manipulating batch obje
 =head2 C4::Labels::Batch->retrieve(batch_id => $batch_id)
 
     Invoking the I<retrieve> method constructs a new batch object containing the current values for batch_id. The method returns a new object upon success and 1 upon failure.
-    Errors are logged to the syslog.
+    Errors are logged to the Apache log.
 
     examples:
 
@@ -265,7 +263,7 @@ This module provides methods for creating, and otherwise manipulating batch obje
 
 =head2 delete()
 
-    Invoking the delete method attempts to delete the template from the database. The method returns -1 upon failure. Errors are logged to the syslog.
+    Invoking the delete method attempts to delete the template from the database. The method returns -1 upon failure. Errors are logged to the Apache log.
     NOTE: This method may also be called as a function and passed a key/value pair simply deleteing that batch from the database. See the example below.
 
     examples:
@@ -275,7 +273,7 @@ This module provides methods for creating, and otherwise manipulating batch obje
 =head2 remove_duplicates()
 
     Invoking the remove_duplicates method attempts to remove duplicate items in the batch from the database. The method returns the count of duplicate records removed upon
-    success and -1 upon failure. Errors are logged to the syslog.
+    success and -1 upon failure. Errors are logged to the Apache log.
     NOTE: This method may also be called as a function and passed a key/value pair removing duplicates in the batch passed in. See the example below.
 
     examples:
diff --git a/C4/Labels/Label.pm b/C4/Labels/Label.pm
index 798751c..26bdcf5 100644
--- a/C4/Labels/Label.pm
+++ b/C4/Labels/Label.pm
@@ -3,7 +3,6 @@ package C4::Labels::Label;
 use strict;
 use warnings;
 
-use Sys::Syslog qw(syslog);
 use Text::Wrap;
 use Algorithm::CheckDigits;
 use Text::CSV_XS;
@@ -45,14 +44,14 @@ sub _check_params {
         $given_params = {@_};
         foreach my $key (keys %{$given_params}) {
             if (!(grep m/$key/, @valid_label_params)) {
-                syslog("LOG_ERR", "C4::Labels::Label : Unrecognized parameter type of \"%s\".", $key);
+                warn sprintf('Unrecognized parameter type of "%s".', $key);
                 $exit_code = 1;
             }
         }
     }
     else {
         if (!(grep m/$_/, @valid_label_params)) {
-            syslog("LOG_ERR", "C4::Labels::Label : Unrecognized parameter type of \"%s\".", $_);
+            warn sprintf('Unrecognized parameter type of "%s".', $_);
             $exit_code = 1;
         }
     }
@@ -81,14 +80,14 @@ sub _get_label_item {
     my $sth = $dbh->prepare("SELECT bi.*, i.*, b.* FROM items AS i, biblioitems AS bi ,biblio AS b WHERE itemnumber=? AND i.biblioitemnumber=bi.biblioitemnumber AND bi.biblionumber=b.biblionumber;");
     $sth->execute($item_number);
     if ($sth->err) {
-        syslog("LOG_ERR", "C4::Labels::Label::_get_label_item : Database returned the following error: %s", $sth->errstr);
+        warn sprintf('Database returned the following error: %s', $sth->errstr);
     }
     my $data = $sth->fetchrow_hashref;
     # Replaced item's itemtype with the more user-friendly description...
     my $sth1 = $dbh->prepare("SELECT itemtype,description FROM itemtypes WHERE itemtype = ?");
     $sth1->execute($data->{'itemtype'});
     if ($sth1->err) {
-        syslog("LOG_ERR", "C4::Labels::Label::_get_label_item : Database returned the following error: %s", $sth1->errstr);
+        warn sprintf('Database returned the following error: %s', $sth1->errstr);
     }
     my $data1 = $sth->fetchrow_hashref;
     $data->{'itemtype'} = $data1->{'description'};
@@ -102,7 +101,7 @@ sub _get_text_fields {
     my $status = $csv->parse($format_string);
     my @sorted_fields = map {{ 'code' => $_, desc => $_ }} $csv->fields();
     my $error = $csv->error_input();
-    syslog("LOG_ERR", "C4::Labels::Label::_get_text_fields : Text field sort failed with this error: %s", $error) if $error;
+    warn sprintf('Text field sort failed with this error: %s', $error) if $error;
     return \@sorted_fields;
 }
 
@@ -121,11 +120,11 @@ sub _split_lccn {
         \s*
         /x;
     unless (scalar @parts)  {
-        syslog("LOG_ERR", "C4::Labels::Label::_split_lccn : regexp failed to match string: %s", $_);
+        warn sprintf('regexp failed to match string: %s', $_);
         push @parts, $_;     # if no match, just push the whole string.
     }
     push @parts, split /\s+/, pop @parts;   # split the last piece into an arbitrary number of pieces at spaces
-    $debug and print STDERR "split_lccn array: ", join(" | ", @parts), "\n";
+    $debug and warn "split_lccn array: ", join(" | ", @parts), "\n";
     return @parts;
 }
 
@@ -140,7 +139,7 @@ sub _split_ddcn {
         \s*
         /x;
     unless (scalar @parts)  {
-        syslog("LOG_ERR", "C4::Labels::Label::_split_ddcn : regexp failed to match string: %s", $_);
+        warn sprintf('regexp failed to match string: %s', $_);
         push @parts, $_;     # if no match, just push the whole string.
     }
 
@@ -175,7 +174,7 @@ sub _split_fcn {
         }
     }
     unless (scalar @fcn_split) {
-        syslog("LOG_ERR", "C4::Labels::Label::_split_fcn : regexp failed to match string: %s", $_);
+        warn sprintf('regexp failed to match string: %s', $_);
         push (@fcn_split, $_);
     }
     return @fcn_split;
@@ -208,7 +207,7 @@ sub _get_barcode_data {
                 $datastring .= $item->{$f};
             }
             else {
-                syslog("LOG_ERR", "C4::Labels::Label::_get_barcode_data : The '%s' field contains no data.", $f);
+                warn sprintf("The '%s' field contains no data.", $f);
             }
             $f = $';
             next FIELD_LIST;
@@ -227,7 +226,7 @@ sub _get_barcode_data {
                                 $datastring .= $itemfield->subfield($subf) . $ws;
                             }
                             else {
-                                syslog("LOG_ERR", "C4::Labels::Label::_get_barcode_data : The '%s' field contains no data.", $f);
+                                warn sprintf("The '%s' field contains no data.", $f);
                             }
                             last ITEM_FIELDS;
                         }
@@ -237,7 +236,7 @@ sub _get_barcode_data {
                         $datastring .= $marcfield[0]->subfield($subf) . $ws;
                     }
                     else {
-                        syslog("LOG_ERR", "C4::Labels::Label::_get_barcode_data : The '%s' field contains no data.", $f);
+                        warn sprintf("The '%s' field contains no data.", $f);
                     }
                 }
             }
@@ -245,7 +244,7 @@ sub _get_barcode_data {
             next FIELD_LIST;
         }
         else {
-            syslog("LOG_ERR", "C4::Labels::Label::_get_barcode_data : Failed to parse label format string: %s", $f);
+            warn sprintf('Failed to parse label format string: %s', $f);
             last FIELD_LIST;    # Failed to match
         }
     }
@@ -423,7 +422,7 @@ sub draw_label_text {
                 @label_lines = _split_fcn($field_data) if !@label_lines;
                 push (@label_lines, $field_data) if !@label_lines;
             } else {
-                syslog("LOG_ERR", "C4::Labels::Label->draw_label_text : Call number splitting failed for: %s. Please add this call number to bug #2500 at bugs.koha.org", $field_data);
+                warn sprintf('Call number splitting failed for: %s. Please add this call number to bug #2500 at bugs.koha.org', $field_data);
                 push @label_lines, $field_data;
             }
         }
@@ -513,7 +512,7 @@ sub barcode {
             );
         };
         if ($@) {
-            syslog("LOG_ERR", "Barcode generation failed for item %s with this error: %s", $self->{'item_number'}, $@);
+            warn sprintf('Barcode generation failed for item %s with this error: %s', $self->{'item_number'}, $@);
         }
     }
     elsif ($params{'barcode_type'} eq 'COOP2OF5') {
@@ -531,7 +530,7 @@ sub barcode {
             );
         };
         if ($@) {
-            syslog("LOG_ERR", "Barcode generation failed for item %s with this error: %s", $self->{'item_number'}, $@);
+            warn sprintf('Barcode generation failed for item %s with this error: %s', $self->{'item_number'}, $@);
         }
     }
     elsif ( $params{'barcode_type'} eq 'INDUSTRIAL2OF5' ) {
@@ -549,7 +548,7 @@ sub barcode {
             );
         };
         if ($@) {
-            syslog("LOG_ERR", "Barcode generation failed for item %s with this error: %s", $self->{'item_number'}, $@);
+            warn sprintf('Barcode generation failed for item %s with this error: %s', $self->{'item_number'}, $@);
         }
     }
 }
diff --git a/C4/Labels/Layout.pm b/C4/Labels/Layout.pm
index f7b2a8d..da2e26f 100644
--- a/C4/Labels/Layout.pm
+++ b/C4/Labels/Layout.pm
@@ -3,7 +3,6 @@ package C4::Labels::Layout;
 use strict;
 use warnings;
 
-use Sys::Syslog qw(syslog);
 use DBI qw(neat);
 
 use C4::Context;
@@ -43,14 +42,14 @@ sub _check_params {
         my %given_params = @_;
         foreach my $key (keys %given_params) {
             if (!(grep m/$key/, @valtmpl_id_params)) {
-                syslog("LOG_ERR", "C4::Labels::Layout : (Multiple parameters) Unrecognized parameter type of \"%s\".", $key);
+                warn sprintf('(Multiple parameters) Unrecognized parameter type of "%s".', $key);
                 $exit_code = 1;
             }
         }
     }
     else {
         if (!(grep m/$_/, @valtmpl_id_params)) {
-            syslog("LOG_ERR", "C4::Labels::Layout : (Single parameter) Unrecognized parameter type of \"%s\".", $_);
+            warn sprintf('(Single parameter) Unrecognized parameter type of "%s".', $_);
             $exit_code = 1;
         }
     }
@@ -87,7 +86,7 @@ sub retrieve {
     my $sth = C4::Context->dbh->prepare($query);
     $sth->execute($opts{'layout_id'});
     if ($sth->err) {
-        syslog("LOG_ERR", "Database returned the following error: %s", $sth->errstr);
+        warn sprintf('Database returned the following error: %s', $sth->errstr);
         return -1;
     }
     my $self = $sth->fetchrow_hashref;
@@ -111,14 +110,14 @@ sub delete {
         $query_param = $opts{'layout_id'};
     }
     if ($query_param eq '') {   # If there is no layout id then we cannot delete it
-        syslog("LOG_ERR", "%s : Cannot delete layout as the layout id is invalid or non-existant.", $call_type);
+        warn sprintf('%s : Cannot delete layout as the layout id is invalid or non-existant.', $call_type);
         return -1;
     }
     my $query = "DELETE FROM labels_layouts WHERE layout_id = ?";  
     my $sth = C4::Context->dbh->prepare($query);
     $sth->execute($query_param);
     if ($sth->err) {
-        syslog("LOG_ERR", "%s : Database returned the following error: %s", $call_type, $sth->errstr);
+        warn sprintf('%s : Database returned the following error: %s', $call_type, $sth->errstr);
         return -1;
     }
     return 0;
@@ -141,7 +140,7 @@ sub save {
         #local $sth->{TraceLevel} = "3";        # enable DBI trace and set level; outputs to STDERR
         $sth->execute(@params);
         if ($sth->err) {
-            syslog("LOG_ERR", "C4::Labels::Layout : Database returned the following error: %s", $sth->errstr);
+            warn sprintf('Database returned the following error: %s', $sth->errstr);
             return -1;
         }
         return $self->{'layout_id'};
@@ -163,7 +162,7 @@ sub save {
         my $sth = C4::Context->dbh->prepare($query);
         $sth->execute(@params);
         if ($sth->err) {
-            syslog("LOG_ERR", "C4::Labels::Layout : Database returned the following error: %s", $sth->errstr);
+            warn sprintf('Database returned the following error: %s', $sth->errstr);
             return -1;
         }
         my $sth1 = C4::Context->dbh->prepare("SELECT MAX(layout_id) FROM labels_layouts;");
@@ -350,14 +349,14 @@ R       = Right
 =head2 retrieve(layout_id => layout_id)
 
     Invoking the I<retrieve> method constructs a new layout object containing the current values for layout_id. The method returns a new object upon success and 1 upon failure.
-    Errors are logged to the syslog.
+    Errors are logged to the Apache log.
 
     example:
         C<my $layout = Layout->retrieve(layout_id => 1); # Retrieves layout record 1 and returns an object containing the record>
 
 =head2 delete()
 
-    Invoking the delete method attempts to delete the layout from the database. The method returns 0 upon success and -1 upon failure. Errors are logged to the syslog.
+    Invoking the delete method attempts to delete the layout from the database. The method returns 0 upon success and -1 upon failure. Errors are logged to the Apache log.
     NOTE: This method may also be called as a function and passed a key/value pair simply deleteing that template from the database. See the example below.
 
     examples:
@@ -367,7 +366,7 @@ R       = Right
 =head2 save()
 
     Invoking the I<save> method attempts to insert the layout into the database if the layout is new and update the existing layout record if the layout exists.
-    The method returns the new record id upon success and -1 upon failure (This avoids conflicting with a record id of 1). Errors are logged to the syslog.
+    The method returns the new record id upon success and -1 upon failure (This avoids conflicting with a record id of 1). Errors are logged to the Apache log.
 
     example:
         C<my $exitstat = $layout->save(); # to save the record behind the $layout object>
diff --git a/C4/Labels/Lib.pm b/C4/Labels/Lib.pm
index b253cbf..2229c60 100644
--- a/C4/Labels/Lib.pm
+++ b/C4/Labels/Lib.pm
@@ -20,7 +20,6 @@ package C4::Labels::Lib;
 use strict;
 use warnings;
 
-use Sys::Syslog qw(syslog);
 use Data::Dumper;
 
 use C4::Context;
@@ -48,7 +47,7 @@ BEGIN {
 
 #=head2 C4::Labels::Lib::_SELECT()
 #
-#    This function returns a recordset upon success and 1 upon failure. Errors are logged to the syslog.
+#    This function returns a recordset upon success and 1 upon failure. Errors are logged to the Apache log.
 #
 #    examples:
 #
@@ -64,7 +63,7 @@ sub _SELECT {
 #    $sth->{'TraceLevel'} = 3;
     $sth->execute();
     if ($sth->err) {
-        syslog("LOG_ERR", "C4::Labels::Lib::get_single_field_value : Database returned the following error: %s", $sth->errstr);
+        warn sprintf('Database returned the following error: %s', $sth->errstr);
         return 1;
     }
     my $record_set = [];
@@ -134,7 +133,7 @@ my $label_output_formats = [
 
 =head2 C4::Labels::Lib::get_all_templates()
 
-    This function returns a reference to a hash containing all templates upon success and 1 upon failure. Errors are logged to the syslog.
+    This function returns a reference to a hash containing all templates upon success and 1 upon failure. Errors are logged to the Apache log.
 
     examples:
 
@@ -150,7 +149,7 @@ sub get_all_templates {
     my $sth = C4::Context->dbh->prepare($query);
     $sth->execute();
     if ($sth->err) {
-        syslog("LOG_ERR", "C4::Labels::Lib::get_all_templates : Database returned the following error: %s", $sth->errstr);
+        warn sprintf('Database returned the following error: %s', $sth->errstr);
         return -1;
     }
     ADD_TEMPLATES:
@@ -162,7 +161,7 @@ sub get_all_templates {
 
 =head2 C4::Labels::Lib::get_all_layouts()
 
-    This function returns a reference to a hash containing all layouts upon success and 1 upon failure. Errors are logged to the syslog.
+    This function returns a reference to a hash containing all layouts upon success and 1 upon failure. Errors are logged to the Apache log.
 
     examples:
 
@@ -179,7 +178,7 @@ sub get_all_layouts {
     my $sth = C4::Context->dbh->prepare($query);
     $sth->execute();
     if ($sth->err) {
-        syslog("LOG_ERR", "C4::Labels::Lib::get_all_layouts : Database returned the following error: %s", $sth->errstr);
+        warn sprintf('Database returned the following error: %s', $sth->errstr);
         return -1;
     }
     ADD_LAYOUTS:
@@ -192,7 +191,7 @@ sub get_all_layouts {
 =head2 C4::Labels::Lib::get_all_profiles()
 
     This function returns an arrayref whose elements are hashes containing all profiles upon success and 1 upon failure. Errors are logged
-    to the syslog. Two parameters are accepted. The first limits the field(s) returned. This parameter should be string of comma separted
+    to the Apache log. Two parameters are accepted. The first limits the field(s) returned. This parameter should be string of comma separted
     fields. ie. "field_1, field_2, ...field_n" The second limits the records returned based on a string containing a valud SQL 'WHERE' filter.
     NOTE: Do not pass in the keyword 'WHERE.'
 
@@ -212,7 +211,7 @@ sub get_all_profiles {
 #    $sth->{'TraceLevel'} = 3 if $debug;
     $sth->execute();
     if ($sth->err) {
-        syslog("LOG_ERR", "C4::Labels::Lib::get_all_profiles : Database returned the following error: %s", $sth->errstr);
+        warn sprintf('Database returned the following error: %s', $sth->errstr);
         return -1;
     }
     ADD_PROFILES:
@@ -225,7 +224,7 @@ sub get_all_profiles {
 =head2 C4::Labels::Lib::get_batch_summary()
 
     This function returns an arrayref whose elements are hashes containing the batch_ids of current batches along with the item count
-    for each batch upon success and 1 upon failure. Item counts are stored under the key '_item_count' Errors are logged to the syslog.
+    for each batch upon success and 1 upon failure. Item counts are stored under the key '_item_count' Errors are logged to the Apache log.
     One parameter is accepted which limits the records returned based on a string containing a valud SQL 'WHERE' filter.
     
     NOTE: Do not pass in the keyword 'WHERE.'
@@ -246,7 +245,7 @@ sub get_batch_summary {
 #    $sth->{'TraceLevel'} = 3;
     $sth->execute();
     if ($sth->err) {
-        syslog("LOG_ERR", "C4::Labels::Lib::get_batch_summary : Database returned the following error on attempted SELECT: %s", $sth->errstr);
+        warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr);
         return -1;
     }
     ADD_BATCHES:
@@ -255,7 +254,7 @@ sub get_batch_summary {
         my $sth1 = C4::Context->dbh->prepare($query);
         $sth1->execute($batch->{'batch_id'});
         if ($sth1->err) {
-            syslog("LOG_ERR", "C4::Labels::Lib::get_batch_summary : Database returned the following error on attempted SELECT count: %s", $sth1->errstr);
+            warn sprintf('Database returned the following error on attempted SELECT count: %s', $sth1->errstr);
             return -1;
         }
         my $count = $sth1->fetchrow_arrayref;
@@ -268,7 +267,7 @@ sub get_batch_summary {
 =head2 C4::Labels::Lib::get_label_summary()
 
     This function returns an arrayref whose elements are hashes containing the label_ids of current labels along with the item count
-    for each label upon success and 1 upon failure. Item counts are stored under the key '_item_count' Errors are logged to the syslog.
+    for each label upon success and 1 upon failure. Item counts are stored under the key '_item_count' Errors are logged to the Apache log.
     One parameter is accepted which limits the records returned based on a string containing a valud SQL 'WHERE' filter.
     
     NOTE: Do not pass in the keyword 'WHERE.'
@@ -290,13 +289,15 @@ sub get_label_summary {
         $label_number++;
         $sth->execute($item->{'item_number'}, $params{'batch_id'});
         if ($sth->err) {
-            syslog("LOG_ERR", "C4::Labels::Lib::get_label_summary : Database returned the following error on attempted SELECT: %s", $sth->errstr);
+            warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr);
             return -1;
         }
         my $record = $sth->fetchrow_hashref;
         my $label_summary->{'_label_number'} = $label_number;
         $record->{'author'} =~ s/[^\.|\w]$// if $record->{'author'};  # strip off ugly trailing chars... but not periods or word chars
         $record->{'title'} =~ s/\W*$//;  # strip off ugly trailing chars
+        # FIXME contructing staff interface URLs should be done *much* higher up the stack - for the most part, C4 module code
+        # should not know that it's part of a web app
         $record->{'title'} = '<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' . $record->{'biblionumber'} . '"> ' . $record->{'title'} . '</a>';
         $label_summary->{'_summary'} = $record->{'title'} . " | " . ($record->{'author'} ? $record->{'author'} : 'N/A');
         $label_summary->{'_item_type'} = $record->{'itemtype'};
diff --git a/C4/Labels/Profile.pm b/C4/Labels/Profile.pm
index f5b2419..5cc4f73 100644
--- a/C4/Labels/Profile.pm
+++ b/C4/Labels/Profile.pm
@@ -2,7 +2,6 @@ package C4::Labels::Profile;
 
 use strict;
 use warnings;
-use Sys::Syslog qw(syslog);
 
 use C4::Context;
 use C4::Debug;
@@ -29,14 +28,14 @@ sub _check_params {
         $given_params = {@_};
         foreach my $key (keys %{$given_params}) {
             if (!(grep m/$key/, @valid_profile_params)) {
-                syslog("LOG_ERR", "C4::Labels::Profile : Unrecognized parameter type of \"%s\".", $key);
+                warn sprintf('Unrecognized parameter type of "%s".', $key);
                 $exit_code = 1;
             }
         }
     }
     else {
         if (!(grep m/$_/, @valid_profile_params)) {
-            syslog("LOG_ERR", "C4::Labels::Profile : Unrecognized parameter type of \"%s\".", $_);
+            warn sprintf('Unrecognized parameter type of "%s".', $_);
             $exit_code = 1;
         }
     }
@@ -82,7 +81,7 @@ sub retrieve {
     my $sth = C4::Context->dbh->prepare($query);
     $sth->execute($opts{profile_id});
     if ($sth->err) {
-        syslog("LOG_ERR", "Database returned the following error: %s", $sth->errstr);
+        warn sprintf('Database returned the following error: %s', $sth->errstr);
         return -1;
     }
     my $self = $sth->fetchrow_hashref;
@@ -107,7 +106,7 @@ sub delete {
         $query_param = $opts{'profile_id'};
     }
     if ($query_param eq '') {   # If there is no profile id then we cannot delete it
-        syslog("LOG_ERR", "%s : Cannot delete layout as the profile id is invalid or non-existant.", $call_type);
+        warn sprintf('%s : Cannot delete layout as the profile id is invalid or non-existant.', $call_type);
         return -1;
     }
     my $query = "DELETE FROM printers_profile WHERE profile_id = ?";  
@@ -133,7 +132,7 @@ sub save {
 #        $sth->{'TraceLevel'} = 3;
         $sth->execute(@params);
         if ($sth->err) {
-            syslog("LOG_ERR", "C4::Labels::Profile : Database returned the following error on attempted UPDATE: %s", $sth->errstr);
+            warn sprintf('Database returned the following error on attempted UPDATE: %s', $sth->errstr);
             return -1;
         }
         return $self->{'profile_id'};
@@ -155,7 +154,7 @@ sub save {
         my $sth = C4::Context->dbh->prepare($query);
         $sth->execute(@params);
         if ($sth->err) {
-            syslog("LOG_ERR", "C4::Labels::Profile : Database returned the following error on attempted INSERT: %s", $sth->errstr);
+            warn sprintf('Database returned the following error on attempted INSERT: %s', $sth->errstr);
             return -1;
         }
         my $sth1 = C4::Context->dbh->prepare("SELECT MAX(profile_id) FROM printers_profile;");
@@ -175,7 +174,7 @@ sub get_attr {
         return $self->{$attr};
     }
     else {
-        syslog("LOG_ERR", "C4::Labels::Profile : %s is currently undefined.", $attr);
+        warn sprintf('%s is currently undefined.', $attr);
         return -1;
     }
 }
@@ -250,7 +249,7 @@ CM      = SI Centimeters (28.3464567 points per)
 =head2 retrieve(profile_id => $profile_id, convert => 1)
 
     Invoking the I<retrieve> method constructs a new profile object containing the current values for profile_id. The method returns a new object upon success and 1 upon failure.
-    Errors are logged to the syslog. One further option maybe accessed. See the examples below for further description.
+    Errors are logged to the Apache log. One further option maybe accessed. See the examples below for further description.
 
     examples:
 
@@ -260,7 +259,7 @@ CM      = SI Centimeters (28.3464567 points per)
 
 =head2 delete()
 
-    Invoking the delete method attempts to delete the profile from the database. The method returns -1 upon failure. Errors are logged to the syslog.
+    Invoking the delete method attempts to delete the profile from the database. The method returns -1 upon failure. Errors are logged to the Apache log.
     NOTE: This method may also be called as a function and passed a key/value pair simply deleteing that profile from the database. See the example below.
 
     examples:
@@ -270,7 +269,7 @@ CM      = SI Centimeters (28.3464567 points per)
 =head2 save()
 
     Invoking the I<save> method attempts to insert the profile into the database if the profile is new and update the existing profile record if the profile exists. The method returns
-    the new record profile_id upon success and -1 upon failure (This avoids conflicting with a record profile_id of 1). Errors are logged to the syslog.
+    the new record profile_id upon success and -1 upon failure (This avoids conflicting with a record profile_id of 1). Errors are logged to the Apache log.
 
     example:
         C<my $exitstat = $profile->save(); # to save the record behind the $profile object>
diff --git a/C4/Labels/Template.pm b/C4/Labels/Template.pm
index 5e9569d..61751f9 100644
--- a/C4/Labels/Template.pm
+++ b/C4/Labels/Template.pm
@@ -2,7 +2,6 @@ package C4::Labels::Template;
 
 use strict;
 use warnings;
-use Sys::Syslog qw(syslog);
 use PDF::Reuse;
 use POSIX qw(ceil);
 
@@ -41,14 +40,14 @@ sub _check_params {
         $given_params = {@_};
         foreach my $key (keys %{$given_params}) {
             if (!(grep m/$key/, @valid_template_params)) {
-                syslog("LOG_ERR", "C4::Labels::Template : Unrecognized parameter type of \"%s\".", $key);
+                warn sprintf('Unrecognized parameter type of "%s".', $key);
                 $exit_code = 1;
             }
         }
     }
     else {
         if (!(grep m/$_/, @valid_template_params)) {
-            syslog("LOG_ERR", "C4::Labels::Template : Unrecognized parameter type of \"%s\".", $_);
+            warn sprintf('Unrecognized parameter type of "%s".', $_);
             $exit_code = 1;
         }
     }
@@ -119,7 +118,7 @@ sub retrieve {
     my $sth = C4::Context->dbh->prepare($query);
     $sth->execute($opts{template_id});
     if ($sth->err) {
-        syslog("LOG_ERR", "Database returned the following error: %s", $sth->errstr);
+        warn sprintf('Database returned the following error: %s', $sth->errstr);
         return -1;
     }
     my $self = $sth->fetchrow_hashref;
@@ -146,7 +145,7 @@ sub delete {
         $query_param = $opts{'template_id'};
     }
     if ($query_param eq '') {   # If there is no template id then we cannot delete it
-        syslog("LOG_ERR", "%s : Cannot delete layout as the template id is invalid or non-existant.", $call_type);
+        warn sprintf('%s : Cannot delete layout as the template id is invalid or non-existant.', $call_type);
         return -1;
     }
     my $query = "DELETE FROM labels_templates WHERE template_id = ?";  
@@ -171,7 +170,7 @@ sub save {
         my $sth = C4::Context->dbh->prepare($query);
         $sth->execute(@params);
         if ($sth->err) {
-            syslog("LOG_ERR", "Database returned the following error: %s", $sth->errstr);
+            warn sprintf('Database returned the following error: %s', $sth->errstr);
             return -1;
         }
         $self->{'template_stat'} = 1;
@@ -195,7 +194,7 @@ sub save {
         my $sth = C4::Context->dbh->prepare($query);
         $sth->execute(@params);
         if ($sth->err) {
-            syslog("LOG_ERR", "Database returned the following error: %s", $sth->errstr);
+            warn sprintf('Database returned the following error: %s', $sth->errstr);
             return -1;
         }
         my $sth1 = C4::Context->dbh->prepare("SELECT MAX(template_id) FROM labels_templates;");
@@ -317,7 +316,7 @@ CM      = SI Centimeters (28.3464567 points per)
 =head2 retrieve(template_id => $template_id)
 
     Invoking the I<retrieve> method constructs a new template object containing the current values for template_id. The method returns
-    a new object upon success and -1 upon failure. Errors are logged to the syslog. Two further options may be accessed. See the example
+    a new object upon success and -1 upon failure. Errors are logged to the Apache log. Two further options may be accessed. See the example
     below for further description.
 
     examples:
@@ -332,7 +331,7 @@ CM      = SI Centimeters (28.3464567 points per)
 
 =head2 delete()
 
-    Invoking the delete method attempts to delete the template from the database. The method returns -1 upon failure. Errors are logged to the syslog.
+    Invoking the delete method attempts to delete the template from the database. The method returns -1 upon failure. Errors are logged to the Apache log.
     NOTE: This method may also be called as a function and passed a key/value pair simply deleteing that template from the database. See the example below.
 
     examples:
@@ -343,7 +342,7 @@ CM      = SI Centimeters (28.3464567 points per)
 
     Invoking the I<save> method attempts to insert the template into the database if the template is new and update the existing template record if
     the template exists. The method returns the new record template_id upon success and -1 upon failure (This avoids template_ids conflicting with a
-    record template_id of 1). Errors are logged to the syslog.
+    record template_id of 1). Errors are logged to the Apache log.
 
     example:
         C<my $template_id = $template->save(); # to save the record behind the $template object>
diff --git a/C4/Patroncards/Patroncards.pm b/C4/Patroncards/Patroncards.pm
index 41184a2..e3cf150 100644
--- a/C4/Patroncards/Patroncards.pm
+++ b/C4/Patroncards/Patroncards.pm
@@ -20,8 +20,6 @@ package C4::Labels::Patroncard;
 use strict;
 use warnings;
 
-use Sys::Syslog qw(syslog);
-
 use C4::Context;
 use C4::Debug;
 use C4::Biblio;
@@ -45,14 +43,14 @@ sub _check_params {
         $given_params = {@_};
         foreach my $key (keys %{$given_params}) {
             if (!(grep m/$key/, @valid_template_params)) {
-                syslog("LOG_ERR", "C4::Labels::Batch : Unrecognized parameter type of \"%s\".", $key);
+                warn sprintf('Unrecognized parameter type of "%s".', $key);
                 $exit_code = 1;
             }
         }
     }
     else {
         if (!(grep m/$_/, @valid_template_params)) {
-            syslog("LOG_ERR", "C4::Labels::Batch : Unrecognized parameter type of \"%s\".", $_);
+            warn sprintf('Unrecognized parameter type of "%s".', $_);
             $exit_code = 1;
         }
     }
@@ -147,7 +145,7 @@ sub delete_item {
     Invoking the I<save> method attempts to insert the batch into the database if the batch is new and
     update the existing batch record if the batch exists. The method returns the new record batch_id upon
     success and -1 upon failure (This avoids conflicting with a record batch_id of 1). Errors are
-    logged to the syslog.
+    logged to the Apache log.
 
     example:
         my $exitstat = $batch->save(); # to save the record behind the $batch object
@@ -163,7 +161,7 @@ sub save {
             my $sth->C4::Context->dbh->prepare($query);
             $sth->execute($item_number, $self->{layout_id}, $self->{tmpl_id}, $self->{prof_id}, $self->{batch_id});
             if ($sth->err) {
-                syslog("LOG_ERR", "Database returned the following error: %s", $sth->errstr);
+                warn sprintf('Database returned the following error: %s', $sth->errstr);
                 return -1;
             }
         }
@@ -175,7 +173,7 @@ sub save {
             my $sth->C4::Context->dbh->prepare($query);
             $sth->execute($item_number, $self->{layout_id}, $self->{tmpl_id}, $self->{prof_id});
             if ($sth->err) {
-                syslog("LOG_ERR", "Database returned the following error: %s", $sth->errstr);
+                warn sprintf('Database returned the following error: %s', $sth->errstr);
                 return -1;
             }
             my $sth1 = C4::Context->dbh->prepare("SELECT MAX(batch_id) FROM labels_batches;");
@@ -191,7 +189,7 @@ sub save {
 =head2 C4::Labels::Template->retrieve(template_id)
 
     Invoking the I<retrieve> method constructs a new template object containing the current values for template_id. The method returns
-    a new object upon success and 1 upon failure. Errors are logged to the syslog. Two further options may be accessed. See the example
+    a new object upon success and 1 upon failure. Errors are logged to the Apache log. Two further options may be accessed. See the example
     below for further description.
 
     examples:
@@ -214,7 +212,7 @@ sub retrieve {
     my $sth = C4::Context->dbh->prepare($query);
     $sth->execute($opts{batch_id});
     if ($sth->err) {
-        syslog("LOG_ERR", "Database returned the following error: %s", $sth->errstr);
+        warn sprintf('Database returned the following error: %s', $sth->errstr);
         return 1;
     }
     my $self = {
@@ -235,7 +233,7 @@ sub retrieve {
 =head2 C4::Labels::Batch->delete(batch_id => batch_id) |  $batch->delete()
 
     Invoking the delete method attempts to delete the batch from the database. The method returns 0 upon success
-    and 1 upon failure. Errors are logged to the syslog.
+    and 1 upon failure. Errors are logged to the Apache log.
 
     examples:
         my $exitstat = $batch->delete(); # to delete the record behind the $batch object
@@ -247,11 +245,11 @@ sub delete {
     my $self = shift;
     my %opts = @_;
     if ((ref $self) && !$self->{'batch_id'}) {   # If there is no batch batch_id then we cannot delete it from the db
-        syslog("LOG_ERR", "Cannot delete batch: Batch has not been saved.");
+        warn 'Cannot delete batch: Batch has not been saved.';
         return 1;
     }
     elsif (!$opts{batch_id}) {
-        syslog("LOG_ERR", "Cannot delete batch: Missing batch_id.");
+        warn 'Cannot delete batch: Missing batch_id.';
         return 1;
     }
     my $query = "DELETE FROM labels_batches WHERE batch_id = ?";
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tmpl
index efd5d12..c6d0fac 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tmpl
@@ -49,7 +49,7 @@
                             <!-- TMPL_IF NAME="err" -->
                             <div class="yui-u">
                                 <div class="alert">
-                                    <strong>WARNING: An error was encountered and <!-- TMPL_VAR NAME="errstr" --> Please have your system administrator check the syslog for details.</strong>
+                                    <strong>WARNING: An error was encountered and <!-- TMPL_VAR NAME="errstr" --> Please have your system administrator check the error log for details.</strong>
                                 </div>
                             </div>
                             <!-- TMPL_ELSIF NAME="duplicate_message" -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tmpl
index 3e94a84..754f8cc 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tmpl
@@ -138,7 +138,7 @@
                         <!-- TMPL_IF NAME="error" -->
                         <div class="yui-u">
                             <div class="alert">
-                                <strong>WARNING: An error was encountered and <!-- TMPL_VAR NAME="label_element" --> <!-- TMPL_VAR NAME="element_id" --> was not deleted. Please have your system administrator check the syslog for details.</strong>
+                                <strong>WARNING: An error was encountered and <!-- TMPL_VAR NAME="label_element" --> <!-- TMPL_VAR NAME="element_id" --> was not deleted. Please have your system administrator check the error log for details.</strong>
                             </div>
                         </div>
                         <!-- /TMPL_IF -->
diff --git a/labels/label-create-csv.pl b/labels/label-create-csv.pl
index f86f55a..729cb88 100755
--- a/labels/label-create-csv.pl
+++ b/labels/label-create-csv.pl
@@ -4,7 +4,6 @@ use strict;
 use warnings;
 
 use CGI;
-use Sys::Syslog qw(syslog);
 use Text::CSV_XS;
 use Data::Dumper;
 
@@ -71,7 +70,7 @@ foreach my $item (@$items) {
         print $csv->string() . "\n";
     }
     else {
-        syslog("LOG_ERR", "labels/label-create-csv.pl : Text::CSV_XS->combine() returned the following error: %s", $csv->error_input);
+        warn sprintf('Text::CSV_XS->combine() returned the following error: %s', $csv->error_input);
         next CSV_ITEMS;
     }
 }
diff --git a/labels/label-create-pdf.pl b/labels/label-create-pdf.pl
index c2e01ca..91dad00 100755
--- a/labels/label-create-pdf.pl
+++ b/labels/label-create-pdf.pl
@@ -4,7 +4,6 @@ use strict;
 use warnings;
 
 use CGI;
-use Sys::Syslog qw(syslog);
 
 use C4::Debug;
 use C4::Labels::Batch 1.000000;
diff --git a/labels/label-create-xml.pl b/labels/label-create-xml.pl
index 5483659..7e90b1f 100755
--- a/labels/label-create-xml.pl
+++ b/labels/label-create-xml.pl
@@ -4,7 +4,6 @@ use strict;
 use warnings;
 
 use CGI;
-use Sys::Syslog qw(syslog);
 use XML::Simple;
 use Data::Dumper;
 
@@ -76,10 +75,6 @@ foreach my $item (@$items) {
         push(@{$xml_data->{'label'}[$item_count]->{$data_fields[$i]}}, $$csv_data[$i]);
     }
     $item_count++;
-#    else {
-#        syslog("LOG_ERR", "labels/label-create-csv.pl : Text::CSV_XS->combine() returned the following error: %s", $csv->error_input);
-#        next CSV_ITEMS;
-#    }
 }
 
 #die "XML DATA:\n" . Dumper($xml_data);
diff --git a/labels/label-edit-batch.pl b/labels/label-edit-batch.pl
index 93cd07b..6dfdeff 100755
--- a/labels/label-edit-batch.pl
+++ b/labels/label-edit-batch.pl
@@ -22,7 +22,6 @@ use strict;
 use warnings;
 use vars qw($debug);
 
-use Sys::Syslog qw(syslog);
 use CGI;
 use HTML::Template::Pro;
 
diff --git a/labels/label-edit-layout.pl b/labels/label-edit-layout.pl
index 62031b6..ef18cd5 100755
--- a/labels/label-edit-layout.pl
+++ b/labels/label-edit-layout.pl
@@ -21,7 +21,6 @@
 use strict;
 use warnings;
 
-use Sys::Syslog qw(syslog);
 use CGI;
 use HTML::Template::Pro;
 use POSIX;
@@ -75,7 +74,7 @@ sub _select_format_string {     # generate field table based on format_string
     my $csv = Text::CSV_XS->new({ allow_whitespace => 1 });
     my $status = $csv->parse($format_string);
     my @text_fields = $csv->fields();
-    syslog("LOG_ERR", "labels/label-edit-layout.pl : Error parsing format_string. Parser returned: %s",$csv->error_input()) if $csv->error_input();
+    warn sprintf('Error parsing format_string. Parser returned: %s', $csv->error_input()) if $csv->error_input();
     my $field_count = $#text_fields + 1;
     POPULATE_TABLE:
     foreach my $text_field (@text_fields) {
@@ -104,7 +103,7 @@ sub _select_format_string {     # generate field table based on format_string
 }
 
 if ($op eq 'edit') {
-    syslog("LOG_ERR", "labels/label-edit-layout.pl : Error performing '%s': No 'layout_id' passed in.", $op) unless ($layout_id);
+    warn sprintf("Error performing '%s': No 'layout_id' passed in.", $op) unless ($layout_id);
     $layout = C4::Labels::Layout->retrieve(layout_id => $layout_id);
 
 }
diff --git a/labels/label-edit-profile.pl b/labels/label-edit-profile.pl
index 93852ef..097fa72 100755
--- a/labels/label-edit-profile.pl
+++ b/labels/label-edit-profile.pl
@@ -21,7 +21,6 @@
 use strict;
 use warnings;
 
-use Sys::Syslog qw(syslog);
 use CGI;
 use HTML::Template::Pro;
 
diff --git a/labels/label-edit-template.pl b/labels/label-edit-template.pl
index 2b55eea..81443d6 100755
--- a/labels/label-edit-template.pl
+++ b/labels/label-edit-template.pl
@@ -21,7 +21,6 @@
 use strict;
 use warnings;
 
-use Sys::Syslog qw(syslog);
 use CGI;
 use HTML::Template::Pro;
 
diff --git a/labels/label-item-search.pl b/labels/label-item-search.pl
index c95bdf0..13add02 100755
--- a/labels/label-item-search.pl
+++ b/labels/label-item-search.pl
@@ -24,7 +24,6 @@ use vars qw($debug $cgi_debug);
 use CGI;
 use HTML::Template::Pro;
 use List::Util qw( max min );
-use Sys::Syslog qw(syslog);
 use POSIX qw(ceil);
 
 use C4::Auth qw(get_template_and_user);
@@ -140,7 +139,7 @@ if ($show_results) {
         }
         else {
             # FIXME: Some error trapping code needed
-            syslog("LOG_ERR", "labels/label-item-search.pl : No item numbers retrieved for biblio number: %s", $biblionumber);
+            warn sprintf('No item numbers retrieved for biblio number: %s', $biblionumber);
         }
     }
 
diff --git a/labels/label-manage.pl b/labels/label-manage.pl
index d57df26..4b6512b 100755
--- a/labels/label-manage.pl
+++ b/labels/label-manage.pl
@@ -22,7 +22,6 @@ use strict;
 use warnings;
 use vars qw($debug);
 
-use Sys::Syslog qw(syslog);
 use CGI;
 use HTML::Template::Pro;
 use Data::Dumper;
diff --git a/t/db_dependent/Labels/t_Batch.t b/t/db_dependent/Labels/t_Batch.t
index 325bd00..9fb4a84 100644
--- a/t/db_dependent/Labels/t_Batch.t
+++ b/t/db_dependent/Labels/t_Batch.t
@@ -31,7 +31,7 @@ BEGIN {
 my $sth = C4::Context->dbh->prepare('SELECT branchcode FROM branches b LIMIT 0,1');
 $sth->execute();
 my $branch_code = $sth->fetchrow_hashref()->{'branchcode'};
-syslog("LOG_ERR", "t/db_dependent/Labels/t_Batch.t : Database returned the following error: %s", $sth->errstr) if $sth->errstr;
+diag sprintf('Database returned the following error: %s', $sth->errstr) if $sth->errstr;
 my $expected_batch = {
         items           => [],
         branch_code     => $branch_code,
@@ -42,7 +42,7 @@ my $batch = 0;
 my $item_number = 0;
 
 diag "Testing Batch->new() method.";
-ok($batch = C4::Labels::Batch->new(branch_code => $branch_code)) || diag "Batch->new() FAILED. Check syslog for details.";
+ok($batch = C4::Labels::Batch->new(branch_code => $branch_code)) || diag "Batch->new() FAILED.";
 my $batch_id = $batch->get_attr('batch_id');
 $expected_batch->{'batch_id'} = $batch_id;
 is_deeply($batch, $expected_batch) || diag "New batch object FAILED to verify.";
@@ -61,22 +61,22 @@ diag "Testing Batch->add_item() method.";
 my $sth1 = C4::Context->dbh->prepare('SELECT itemnumber FROM items LIMIT 0,10');
 $sth1->execute();
 while (my $row = $sth1->fetchrow_hashref()) {
-    syslog("LOG_ERR", "t/db_dependent/Labels/t_Batch.t : Database returned the following error: %s", $sth1->errstr) if $sth1->errstr;
-    ok($batch->add_item($row->{'itemnumber'}) eq 0 ) || diag "Batch->add_item() FAILED. Check syslog for details.";
+    diag sprintf('Database returned the following error: %s', $sth1->errstr) if $sth1->errstr;
+    ok($batch->add_item($row->{'itemnumber'}) eq 0 ) || diag "Batch->add_item() FAILED.";
     $item_number = $row->{'itemnumber'};
 }
 
 diag "Testing Batch->retrieve() method.";
-ok(my $saved_batch = C4::Labels::Batch->retrieve(batch_id => $batch_id)) || diag "Batch->retrieve() FAILED. Check syslog for details.";
+ok(my $saved_batch = C4::Labels::Batch->retrieve(batch_id => $batch_id)) || diag "Batch->retrieve() FAILED.";
 is_deeply($saved_batch, $batch) || diag "Retrieved batch object FAILED to verify.";
 
 diag "Testing Batch->remove_item() method.";
 
-ok($batch->remove_item($item_number) eq 0) || diag "Batch->remove_item() FAILED. See syslog for details.";
+ok($batch->remove_item($item_number) eq 0) || diag "Batch->remove_item() FAILED.";
 my $updated_batch = C4::Labels::Batch->retrieve(batch_id => $batch_id);
 is_deeply($updated_batch, $batch) || diag "Updated batch object FAILED to verify.";
 
 diag "Testing Batch->delete() method.";
 
 my $del_results = $batch->delete();
-ok($del_results eq 0) || diag "Batch->delete() FAILED. See syslog for details.";
+ok($del_results eq 0) || diag "Batch->delete() FAILED.";
diff --git a/t/db_dependent/Labels/t_Layout.t b/t/db_dependent/Labels/t_Layout.t
index c0bd0f5..dce4f95 100644
--- a/t/db_dependent/Labels/t_Layout.t
+++ b/t/db_dependent/Labels/t_Layout.t
@@ -43,7 +43,7 @@ my $default_layout = {
 my $layout;
 
 diag "Testing Layout->new() method.";
-ok($layout = C4::Labels::Layout->new(layout_name => 'TEST')) || diag "Layout->new() FAILED. Check syslog for details.";
+ok($layout = C4::Labels::Layout->new(layout_name => 'TEST')) || diag "Layout->new() FAILED";
 is_deeply($layout, $default_layout) || diag "New layout object FAILED to verify.";
 
 diag "Testing Layout->get_attr() method.";
@@ -72,13 +72,13 @@ foreach my $key (keys %{$new_attr}) {
 diag "Testing Layout->save() method with a new object.";
 
 my $sav_results = $layout->save();
-ok($sav_results ne -1) || diag "Layout->save() FAILED. See syslog for details.";
+ok($sav_results ne -1) || diag "Layout->save() FAILED";
 
 my $saved_layout;
 if ($sav_results ne -1) {
     diag "Testing Layout->retrieve() method.";
     $new_attr->{'layout_id'} = $sav_results;
-    ok($saved_layout = C4::Labels::Layout->retrieve(layout_id => $sav_results)) || diag "Layout->retrieve() FAILED. Check syslog for details.";
+    ok($saved_layout = C4::Labels::Layout->retrieve(layout_id => $sav_results)) || diag "Layout->retrieve() FAILED";
     is_deeply($saved_layout, $new_attr) || diag "Retrieved layout object FAILED to verify.";
 }
 
@@ -86,7 +86,7 @@ diag "Testing Layout->save() method with an updated object.";
 
 $saved_layout->set_attr(font => 'C');
 my $upd_results = $saved_layout->save();
-ok($upd_results ne -1) || diag "Layout->save() FAILED. See syslog for details.";
+ok($upd_results ne -1) || diag "Layout->save() FAILED";
 my $updated_layout = C4::Labels::Layout->retrieve(layout_id => $sav_results);
 is_deeply($updated_layout, $saved_layout) || diag "Updated layout object FAILED to verify.";
 
@@ -97,4 +97,4 @@ ok($updated_layout->get_text_wrap_cols(label_width => 180, left_text_margin => 1
 diag "Testing Layout->delete() method.";
 
 my $del_results = $updated_layout->delete();
-ok($del_results eq 0) || diag "Layout->delete() FAILED. See syslog for details.";
+ok($del_results eq 0) || diag "Layout->delete() FAILED";
diff --git a/t/db_dependent/Labels/t_Profile.t b/t/db_dependent/Labels/t_Profile.t
index c1e921d..110e9eb 100644
--- a/t/db_dependent/Labels/t_Profile.t
+++ b/t/db_dependent/Labels/t_Profile.t
@@ -42,12 +42,12 @@ my $expected_profile = {
 my $err = 0;
 
 diag "Testing Profile->new() method.";
-ok(my $profile = C4::Labels::Profile->new(printer_name => 'Circulation Desk',paper_bin => 'bypass')) || diag"Profile->new() FAILED. Check syslog for details.";
+ok(my $profile = C4::Labels::Profile->new(printer_name => 'Circulation Desk',paper_bin => 'bypass')) || diag"Profile->new() FAILED.";
 is_deeply($profile, $expected_profile) || diag "New profile object FAILED to verify.";
 
 diag "Testing Profile->get_attr() method.";
 foreach my $key (keys %{$expected_profile}) {
-    ok($expected_profile->{$key} eq $profile->get_attr($key)) || diag "Profile->get_attr() FAILED on attribute $key. Check syslog for details.";
+    ok($expected_profile->{$key} eq $profile->get_attr($key)) || diag "Profile->get_attr() FAILED on attribute $key.";
 }
 
 diag "Testing Profile->set_attr() method.";
@@ -70,13 +70,13 @@ foreach my $key (keys %{$new_attr}) {
 diag "Testing Profile->save() method with a new object.";
 
 my $sav_results = $profile->save();
-ok($sav_results ne -1) || diag "Profile->save() FAILED. See syslog for details.";
+ok($sav_results ne -1) || diag "Profile->save() FAILED.";
 
 my $saved_profile;
 if ($sav_results ne -1) {
     diag "Testing Profile->retrieve() method.";
     $new_attr->{'profile_id'} = $sav_results;
-    ok($saved_profile = C4::Labels::Profile->retrieve(profile_id => $sav_results)) || diag "Profile->retrieve() FAILED. Check syslog for details.";
+    ok($saved_profile = C4::Labels::Profile->retrieve(profile_id => $sav_results)) || diag "Profile->retrieve() FAILED.";
     is_deeply($saved_profile, $new_attr) || diag "Retrieved profile object FAILED to verify.";
 }
 
@@ -85,11 +85,11 @@ diag "Testing Profile->save() method with an updated object.";
 $err = 0; # Reset error code
 $err = $saved_profile->set_attr(units => 'CM');
 my $upd_results = $saved_profile->save();
-ok(($upd_results ne -1) && ($err lt 1)) || diag "Profile->save() FAILED. See syslog for details.";
+ok(($upd_results ne -1) && ($err lt 1)) || diag "Profile->save() FAILED.";
 my $updated_profile = C4::Labels::Profile->retrieve(profile_id => $sav_results);
 is_deeply($updated_profile, $saved_profile) || diag "Updated layout object FAILED to verify.";
 
 diag "Testing Profile->delete() method.";
 
 my $del_results = $updated_profile->delete();
-ok($del_results ne -1) || diag "Profile->delete() FAILED. See syslog for details.";
+ok($del_results ne -1) || diag "Profile->delete() FAILED.";
diff --git a/t/db_dependent/Labels/t_Template.t b/t/db_dependent/Labels/t_Template.t
index 909852d..3a7af28 100644
--- a/t/db_dependent/Labels/t_Template.t
+++ b/t/db_dependent/Labels/t_Template.t
@@ -51,7 +51,7 @@ my $expect_template = {
 my $template;
 
 diag "Testing Template->new() method.";
-ok($template = C4::Labels::Template->new(page_width => 8.5,cols => 3))  || diag "Template->new() FAILED. Check syslog for details.";
+ok($template = C4::Labels::Template->new(page_width => 8.5,cols => 3))  || diag "Template->new() FAILED.";
 is_deeply($template, $expect_template) || diag "New template object FAILED to verify.";
 
 diag "Testing Template->get_attr() method.";
@@ -89,13 +89,13 @@ foreach my $key (keys %{$new_attr}) {
 diag "Testing Template->save() method with a new object.";
 
 my $sav_results = $template->save();
-ok($sav_results ne -1) || diag "Template->save() FAILED. See syslog for details.";
+ok($sav_results ne -1) || diag "Template->save() FAILED.";
 
 my $saved_template;
 if ($sav_results ne -1) {
     diag "Testing Template->retrieve() method.";
     $new_attr->{'template_id'} = $sav_results;
-    ok($saved_template = C4::Labels::Template->retrieve(template_id => $sav_results))  || diag "Template->retrieve() FAILED. Check syslog for details.";
+    ok($saved_template = C4::Labels::Template->retrieve(template_id => $sav_results))  || diag "Template->retrieve() FAILED.";
     is_deeply($saved_template, $new_attr) || diag "Retrieved template object FAILED to verify.";
 }
 
@@ -103,7 +103,7 @@ diag "Testing Template->save method with an updated object.";
 
 $saved_template->set_attr(template_desc => 'A test template');
 my $upd_results = $saved_template->save();
-ok($upd_results ne -1) || diag "Template->save() FAILED. See syslog for details.";
+ok($upd_results ne -1) || diag "Template->save() FAILED.";
 my $updated_template = C4::Labels::Template->retrieve(template_id => $sav_results);
 is_deeply($updated_template, $saved_template) || diag "Updated template object FAILED to verify.";
 
@@ -130,4 +130,4 @@ foreach my $key (keys %{$expect_conv}) {
 diag "Testing Template->delete() method.";
 
 my $del_results = $updated_template->delete();
-ok($del_results ne -1) || diag "Template->delete() FAILED. See syslog for details.";
+ok($del_results ne -1) || diag "Template->delete() FAILED.";
diff --git a/tools/manage-marc-import.pl b/tools/manage-marc-import.pl
index 97c4bab..ccf4e79 100755
--- a/tools/manage-marc-import.pl
+++ b/tools/manage-marc-import.pl
@@ -24,7 +24,6 @@ use warnings;
 use CGI;
 use CGI::Cookie;
 use MARC::File::USMARC;
-use Sys::Syslog qw(syslog);
 
 # Koha modules used
 use C4::Context;
@@ -182,13 +181,13 @@ sub create_labelbatch_from_importbatch {
         my $batch = C4::Labels::Batch->new(branch_code => $branch_code);
 	my @items = GetItemNumbersFromImportBatch($batch_id);
         if (grep{$_ == 0} @items) {
-            syslog("LOG_ERR", "tools/manage-marc-import.pl : create_labelbatch_from_importbatch() : Call to C4::ImportBatch::GetItemNumbersFromImportBatch returned no item number(s) from import batch #%s.", $batch_id);
+            warn sprintf('create_labelbatch_from_importbatch() : Call to C4::ImportBatch::GetItemNumbersFromImportBatch returned no item number(s) from import batch #%s.', $batch_id);
             return -1;
         }
         foreach my $item_number (@items) {
             $err = $batch->add_item($item_number);
             if ($err == -1) {
-                syslog("LOG_ERR", "tools/manage-marc-import.pl : create_labelbatch_from_importbatch() : Error attempting to add item #%s of import batch #%s to label batch.", $item_number, $batch_id);
+                warn sprintf('create_labelbatch_from_importbatch() : Error attempting to add item #%s of import batch #%s to label batch.', $item_number, $batch_id);
                 return -1;
             }
         }
-- 
1.6.3.3




More information about the Koha-patches mailing list