From 741252362450aedc8903ef75658b4c5342f8e6f9 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 2 Feb 2016 16:40:06 +0100 Subject: [PATCH] Bug 15714: Remove zebra.log and add loglevels 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 Signed-off-by: Jonathan Druart Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com --- debian/scripts/koha-start-zebra | 8 ++++---- debian/scripts/koha-stop-zebra | 8 -------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/debian/scripts/koha-start-zebra b/debian/scripts/koha-start-zebra index ce6c469967..513547efe5 100755 --- a/debian/scripts/koha-start-zebra +++ b/debian/scripts/koha-start-zebra @@ -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 diff --git a/debian/scripts/koha-stop-zebra b/debian/scripts/koha-stop-zebra index e6aae7d10d..a584ca1ff5 100755 --- a/debian/scripts/koha-stop-zebra +++ b/debian/scripts/koha-stop-zebra @@ -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 } -- 2.39.5