From 3114cfffa6004e411bcdc3722aa1867701e5a31c Mon Sep 17 00:00:00 2001 From: Johannes Helmold Date: Mon, 21 Oct 2024 15:28:01 +0200 Subject: [PATCH 1/2] Change: Log to stderr, new log file build option. Now the log messages are logged to stderr by default. The log file for the generated gsad_log.conf can now be set by a new build option GSAD_LOG_FILE. --- CMakeLists.txt | 15 ++++++++++----- src/gsad_log_conf.cmake_in | 12 ++++++------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea3924ab1..b6094853f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,11 +117,16 @@ else (NOT GVM_STATE_DIR) set (GVM_STATE_DIR "${GVM_STATE_DIR}") endif (NOT GVM_STATE_DIR) -if (NOT GVM_LOG_DIR) - set (GVM_LOG_DIR "${LOCALSTATEDIR}/log/gvm") -else (NOT GVM_LOG_DIR) - set (GVM_LOG_DIR "${GVM_LOG_DIR}") -endif (NOT GVM_LOG_DIR) +if (NOT GSAD_LOG_FILE) + if (GVM_LOG_DIR) + set (GSAD_LOG_FILE "${GVM_LOG_DIR}/gsad.log") + else (GVM_LOG_DIR) + set (GSAD_LOG_FILE "-") + endif (GVM_LOG_DIR) +else (NOT GSAD_LOG_FILE) + set (GSAD_LOG_FILE "${GSAD_LOG_FILE}") +endif (NOT GSAD_LOG_FILE) +message ("-- Log file: ${GSAD_LOG_FILE}") if (NOT GVM_SERVER_CERTIFICATE) set (GVM_SERVER_CERTIFICATE "${GVM_STATE_DIR}/CA/servercert.pem") diff --git a/src/gsad_log_conf.cmake_in b/src/gsad_log_conf.cmake_in index 3e1f5c5fd..b79fce145 100644 --- a/src/gsad_log_conf.cmake_in +++ b/src/gsad_log_conf.cmake_in @@ -7,40 +7,40 @@ prepend=%t %s %p separator=: prepend_time_format=%Y-%m-%d %Hh%M.%S %Z -file=${GVM_LOG_DIR}/gsad.log +file=${GSAD_LOG_FILE} level=127 [gsad gmp] prepend=%t %s %p separator=: prepend_time_format=%Y-%m-%d %Hh%M.%S %Z -file=${GVM_LOG_DIR}/gsad.log +file=${GSAD_LOG_FILE} level=127 [gsad i18n] prepend=%t %s %p separator=: prepend_time_format=%Y-%m-%d %Hh%M.%S %Z -file=${GVM_LOG_DIR}/gsad.log +file=${GSAD_LOG_FILE} level=127 [gsad http] prepend=%t %s %p separator=: prepend_time_format=%Y-%m-%d %Hh%M.%S %Z -file=${GVM_LOG_DIR}/gsad.log +file=${GSAD_LOG_FILE} level=127 [gsad vali] prepend=%t %s %p separator=: prepend_time_format=%Y-%m-%d %Hh%M.%S %Z -file=${GVM_LOG_DIR}/gsad.log +file=${GSAD_LOG_FILE} level=127 [*] prepend=%t %s %p separator=: prepend_time_format=%Y-%m-%d %Hh%M.%S %Z -file=${GVM_LOG_DIR}/gsad.log +file=${GSAD_LOG_FILE} level=0 From 637127281f3db98913a456b57de71c849c449a0c Mon Sep 17 00:00:00 2001 From: Johannes Helmold Date: Tue, 5 Nov 2024 15:15:44 +0100 Subject: [PATCH 2/2] Small optimization of setting the log file. --- CMakeLists.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6094853f..ccd1585a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,14 +119,11 @@ endif (NOT GVM_STATE_DIR) if (NOT GSAD_LOG_FILE) if (GVM_LOG_DIR) - set (GSAD_LOG_FILE "${GVM_LOG_DIR}/gsad.log") + set (GSAD_LOG_FILE "${GVM_LOG_DIR}/gsad.log") else (GVM_LOG_DIR) - set (GSAD_LOG_FILE "-") + set (GSAD_LOG_FILE "-") endif (GVM_LOG_DIR) -else (NOT GSAD_LOG_FILE) - set (GSAD_LOG_FILE "${GSAD_LOG_FILE}") endif (NOT GSAD_LOG_FILE) -message ("-- Log file: ${GSAD_LOG_FILE}") if (NOT GVM_SERVER_CERTIFICATE) set (GVM_SERVER_CERTIFICATE "${GVM_STATE_DIR}/CA/servercert.pem")