diff options
| author | Martin Schwenke <martin@meltin.net> | 2014-08-11 17:07:41 +1000 |
|---|---|---|
| committer | Amitay Isaacs <amitay@samba.org> | 2014-10-28 05:42:04 +0100 |
| commit | 1d1cd04cb9b8e66e0303c362669db2c6c47fccae (patch) | |
| tree | 09244a813bbdbb0a0ad20a44c42cd5c8fe699860 /ctdb/config | |
| parent | 29745543566ef66c1f2972fd5cd68e17ddf4de4f (diff) | |
| download | samba-1d1cd04cb9b8e66e0303c362669db2c6c47fccae.tar.gz samba-1d1cd04cb9b8e66e0303c362669db2c6c47fccae.tar.xz samba-1d1cd04cb9b8e66e0303c362669db2c6c47fccae.zip | |
ctdb-logging: New option CTDB_LOGGING, remove CTDB_LOGFILE, CTDB_SYSLOG
Remove --logfile and --syslog daemon options and replace with
--logging.
Modularise and clean up logging initialisation code. The
initialisation API includes an app_name argument that is currently
unused - this will be used in extensions to the syslog backend.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/config')
| -rw-r--r-- | ctdb/config/ctdb.sysconfig | 3 | ||||
| -rwxr-xr-x | ctdb/config/ctdbd_wrapper | 14 | ||||
| -rwxr-xr-x | ctdb/config/functions | 26 |
3 files changed, 27 insertions, 16 deletions
diff --git a/ctdb/config/ctdb.sysconfig b/ctdb/config/ctdb.sysconfig index db34c07ef0..b44e478b93 100644 --- a/ctdb/config/ctdb.sysconfig +++ b/ctdb/config/ctdb.sysconfig @@ -23,8 +23,7 @@ CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses # ulimit -n 10000 # Default is to use the log file below instead of syslog. -# CTDB_LOGFILE=/var/log/log.ctdb -# CTDB_SYSLOG=no +# CTDB_LOGGING=file:/var/log/log.ctdb # Default log level is ERR. NOTICE is a little more verbose. CTDB_DEBUGLEVEL=NOTICE diff --git a/ctdb/config/ctdbd_wrapper b/ctdb/config/ctdbd_wrapper index c2c5c1a3e6..331ee43ba0 100755 --- a/ctdb/config/ctdbd_wrapper +++ b/ctdb/config/ctdbd_wrapper @@ -111,7 +111,7 @@ build_ctdb_options () maybe_set "--pidfile" "$pidfile" # build up ctdb_options variable from optional parameters - maybe_set "--logfile" "$CTDB_LOGFILE" + maybe_set "--logging" "$CTDB_LOGGING" maybe_set "--nlist" "$CTDB_NODES" maybe_set "--socket" "$CTDB_SOCKET" maybe_set "--public-addresses" "$CTDB_PUBLIC_ADDRESSES" @@ -129,7 +129,6 @@ build_ctdb_options () maybe_set "--no-lmaster" "$CTDB_CAPABILITY_LMASTER" "no" maybe_set "--lvs --single-public-ip" "$CTDB_LVS_PUBLIC_IP" maybe_set "--script-log-level" "$CTDB_SCRIPT_LOG_LEVEL" - maybe_set "--syslog" "$CTDB_SYSLOG" "yes" maybe_set "--max-persistent-check-errors" "$CTDB_MAX_PERSISTENT_CHECK_ERRORS" } @@ -187,9 +186,14 @@ start() ctdb_options="${ctdb_options} --valgrinding" fi - if [ "$CTDB_SYSLOG" != "yes" ] ; then - logger -t ctdbd "CTDB is being run without syslog enabled. Logs will be in ${CTDB_LOGFILE:-/var/log/log.ctdb}" - fi + case "$CTDB_LOGGING" in + syslog) : ;; + file:*) + logger -t ctdbd "CTDB is being run without syslog enabled. Logs will be in ${CTDB_LOGGING#file:}" + ;; + *) + logger -t ctdbd "CTDB is being run without syslog enabled. Logs will be in log.ctdb" + esac eval "$ctdbd" "$ctdb_options" || return 1 diff --git a/ctdb/config/functions b/ctdb/config/functions index 3f2ccee5ee..5c9497dc52 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -86,17 +86,25 @@ script_log () { _tag="$1" ; shift - if [ "$CTDB_SYSLOG" = "yes" ] ; then - logger -t "ctdbd: ${_tag}" $* - else - { - if [ -n "$*" ] ; then - echo "$*" + case "$CTDB_LOGGING" in + file:*|"") + if [ -n "$CTDB_LOGGING" ] ; then + _file="${CTDB_LOGGING#file:}" else - cat + _file="/var/log/log.ctdb" fi - } >>"${CTDB_LOGFILE:-/var/log/log.ctdb}" - fi + { + if [ -n "$*" ] ; then + echo "$*" + else + cat + fi + } >>"$_file" + ;; + *) + logger -t "ctdbd: ${_tag}" $* + ;; + esac } # When things are run in the background in an eventscript then logging |
