]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3831] Fix log path in UTs
authorThomas Markwalder <tmark@isc.org>
Tue, 13 May 2025 14:55:51 +0000 (10:55 -0400)
committerAndrei Pavel <andrei@isc.org>
Fri, 16 May 2025 09:20:43 +0000 (12:20 +0300)
/doc/sphinx/arm/logging.rst
    Updated logging section

/src/bin/admin/tests/memfile_tests.sh.in
/src/bin/shell/tests/shell_dhcp4_process_tests.sh.in
/src/bin/shell/tests/shell_dhcp6_process_tests.sh.in
    export KEA_LOG_FILE_DIR

/src/lib/dhcpsrv/memfile_lease_mgr.cc
    Memfile_LeaseMgr::factory() - fix throw to preserve error txt

/src/lib/process/Makefile.am
    Define LOGFILE_DIR

doc/sphinx/arm/logging.rst
src/bin/admin/tests/memfile_tests.sh.in
src/bin/dhcp6/tests/hooks_unittest.cc
src/bin/shell/tests/shell_dhcp4_process_tests.sh.in
src/bin/shell/tests/shell_dhcp6_process_tests.sh.in
src/lib/dhcpsrv/memfile_lease_mgr.cc
src/lib/process/Makefile.am

index 3b9b9048b4256c1a3fb446280305a79dcfa6716e..38ccb3ba4583210214e49d0778480d4ca0e1ef83 100644 (file)
@@ -556,6 +556,17 @@ output), ``stderr`` (messages are printed on stderr), ``syslog``
 (messages are logged to syslog using a specified name). Any other value is
 interpreted as a filename to which messages should be written.
 
+.. note::
+
+    As of Kea 2.7.9, log files may only be written to the output directory
+    determined during compilation as: ``"[kea-install-dir]/var/log/kea"``. This
+    path may be overridden at startup by setting the environment variable
+    ``KEA_LOG_FILE_DIR`` to the desired path.  If a path other than
+    this value is used in ``output``, Kea will emit an error and refuse to start
+    or, if already running, log an unrecoverable error.  For ease of use simply 
+    omit the path component from ``output`` and specify only the file name.
+
+
 The ``flush`` (boolean) Option
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
index bd92ed672be4b657c6e9bffec782db08b71be04f..6cec3f129710161c38ee508b9383fa0c8a8935a4 100755 (executable)
@@ -15,6 +15,8 @@ set -eu
 . "@abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh"
 
 export KEA_DHCP_DATA_DIR="@abs_top_builddir@/src/bin/admin/tests"
+export KEA_LOG_FILE_DIR="@abs_top_builddir@/src/bin/admin/tests"
+
 
 # Locations of memfile tools
 kea_admin="@abs_top_builddir@/src/bin/admin/kea-admin"
index ba38c439bb007a7dbd207b3490c78b75235cd254..ba25b5e1bc6c7c8eff46fe7fa69910c95bc1a163 100644 (file)
@@ -1090,7 +1090,7 @@ bool HooksDhcpv6SrvTest::callback_rev_update_;
 DdnsParamsPtr HooksDhcpv6SrvTest::callback_ddns_params_;
 
 /// @brief Fixture class used to do basic library load/unload tests
-class LoadUnloadDhcpv6SrvTest : public BaseServerTest /*::testing::Test */ {
+class LoadUnloadDhcpv6SrvTest : public BaseServerTest {
 public:
     /// @brief Pointer to the tested server object
     boost::shared_ptr<NakedDhcpv6Srv> server_;
index 1b06ef1eb540dc1c48783497ff8199ef9932b0dd..db0b39d2c05315368a0d24cb9995fb42bdda3193 100755 (executable)
@@ -24,6 +24,7 @@ export KEA_DHCP_DATA_DIR="@abs_top_builddir@/src/bin/shell/tests"
 LEASE_FILE="@abs_top_builddir@/src/bin/shell/tests/test_leases.csv"
 
 # Path to the Dhcp4 Server log file.
+export KEA_LOG_FILE_DIR="@abs_top_builddir@/src/bin/shell/tests"
 LOG_FILE="@abs_top_builddir@/src/bin/shell/tests/test.log"
 
 # Dhcp4 Server configuration to be stored in the configuration file.
index 26e4711b63fa826189c6a6473f94659f575b6bd3..37339989dfd9c4a84c4f51016e7ca38ce76ddb04 100755 (executable)
@@ -24,6 +24,7 @@ export KEA_DHCP_DATA_DIR="@abs_top_builddir@/src/bin/shell/tests"
 LEASE_FILE="@abs_top_builddir@/src/bin/shell/tests/test_leases.csv"
 
 # Path to the Dhcp6 Server log file.
+export KEA_LOG_FILE_DIR="@abs_top_builddir@/src/bin/shell/tests"
 LOG_FILE="@abs_top_builddir@/src/bin/shell/tests/test.log"
 
 # Dhcp6 Server configuration to be stored in the configuration file.
index 54c79a1d6c6254b8eff102f19374dabe968aad0f..f706aa971062275771d5baaf0406b736c6b09c81 100644 (file)
@@ -3505,7 +3505,7 @@ Memfile_LeaseMgr::factory(const isc::db::DatabaseConnection::ParameterMap& param
     } catch (const std::exception& ex) {
         LOG_ERROR(dhcpsrv_logger, DHCPSRV_MEMFILE_FAILED_TO_OPEN)
             .arg(ex.what());
-        throw ex;
+        throw;
     }
 }
 
index 5f285efbf0e73a001363dd2435feace6880c87cf..9e711b2870773a6b9b486409f8a3f415c6b78f83 100644 (file)
@@ -2,6 +2,8 @@ SUBDIRS = cfgrpt . testutils tests
 dhcp_data_dir = @runstatedir@/@PACKAGE@
 AM_CPPFLAGS  = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
 AM_CPPFLAGS += -DPIDFILE_DIR="\"$(dhcp_data_dir)\""
+log_file_dir = @localstatedir@/log/@PACKAGE@
+AM_CPPFLAGS += -DLOGFILE_DIR="\"$(log_file_dir)\""
 
 AM_CPPFLAGS += $(BOOST_INCLUDES)
 AM_CXXFLAGS  = $(KEA_CXXFLAGS)