Bug 15714: Remove zebra.log and add loglevels
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 2 Feb 2016 15:40:06 +0000 (16:40 +0100)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Wed, 24 Feb 2016 03:38:18 +0000 (03:38 +0000)
The file zebra.log is actually not used, because daemon's --output
parameter sends all message to zebra-output (making that stdout
goes there too and --stdout does nothing). We do not need any
differentiation (if any at all) here; behavior does not change.

Note: zebra-error will only contain the daemon's error messages and not
the zebra error messages! So you will probably only find messages about
stopping zebra in zebra-error.

The loglevels are by default none,fatal,warn and can be changed via the
zebra_loglevels config variable (read by koha-functions.sh). If you remove
'none', you will have request-messages in the log. You can also keep 'none'
and add 'request' to achieve something similar (undocumented however).

Some of the parameters passed to daemon when stopping zebra are
superfluous and have been removed.

Test plan:
[1] Remove the file zebra.log. Look at last lines in zebra-error and
    zebra-output.
[2] Remove zebra_loglevels from koha-conf (if present).
    Start/restart Zebra. Search to verify if Zebra runs.
    Stop Zebra and check zebra-error for a new line (killed by signal 15).
[3] Add fatal,warn in koha-conf:zebra_loglevels (do not include 'none').
    Start Zebra. Check zebra-output for a line "[log] zebra_start".
    Do a search and check zebra-output for lines with "[request]".
[4] Verify that zebra.log did not appear again.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
debian/scripts/koha-start-zebra
debian/scripts/koha-stop-zebra

index ce6c469..513547e 100755 (executable)
@@ -30,19 +30,19 @@ start_zebra_instance()
 {
     local instancename=$1
 
+    # get zebra log levels from koha-conf.xml
+    local loglevels=$(get_loglevels $instancename)
+
     echo "Starting Zebra server for $instancename"
     touch "/var/log/koha/$instancename/zebra-error.log" \
-        "/var/log/koha/$instancename/zebra.log" \
         "/var/log/koha/$instancename/zebra-output.log"
     chown "$instancename-koha:$instancename-koha" \
         "/var/log/koha/$instancename/zebra-error.log" \
-        "/var/log/koha/$instancename/zebra.log" \
         "/var/log/koha/$instancename/zebra-output.log"
     daemon \
         --name="$instancename-koha-zebra" \
         --pidfiles="/var/run/koha/$instancename/" \
         --errlog="/var/log/koha/$instancename/zebra-error.log" \
-        --stdout="/var/log/koha/$instancename/zebra.log" \
         --output="/var/log/koha/$instancename/zebra-output.log" \
         --verbose=1 \
         --respawn \
@@ -50,7 +50,7 @@ start_zebra_instance()
         --user="$instancename-koha.$instancename-koha" \
         -- \
         zebrasrv \
-        -v none,fatal,warn \
+        -v $loglevels \
         -f "/etc/koha/sites/$instancename/koha-conf.xml" && \
         return 0 || \
         return 1
index e6aae7d..a584ca1 100755 (executable)
@@ -34,18 +34,10 @@ stop_zebra_instance()
     daemon \
         --name="$instancename-koha-zebra" \
         --pidfiles="/var/run/koha/$instancename/" \
-        --errlog="/var/log/koha/$instancename/zebra-error.log" \
-        --stdout="/var/log/koha/$instancename/zebra.log" \
-        --output="/var/log/koha/$instancename/zebra-output.log" \
-        --verbose=1 \
-        --respawn \
-        --delay=30 \
         --user="$instancename-koha.$instancename-koha" \
         --stop \
         -- \
         zebrasrv \
-        -v none,fatal,warn \
-        -f "/etc/koha/sites/$instancename/koha-conf.xml" && \
         return 0 || \
         return 1
 }