Skip to content

Commit

Permalink
Restore support for MultiprocessRollingFileAppender (#441)
Browse files Browse the repository at this point in the history
* Allow MultiprocessRollingFileAppender in a configuration when log4cxx is statically linked

* Restore MultiprocessRollingFileAppender functionality

* Enable runtime configuration of MultiprocessRollingFileAppender

* Add unit test

* Send rename failures to error handler

* Use a simpler (not per uid) lock file name

* Activate multiprocess behaviour in TimeBasedRollingPolicy

* Prevent failure on Windows (due to apr_trunc_file semantic differences)

* Add MultiprocessRollingFileAppender test to Windows (LOG4CXX_CHAR=utf-8)

* Support for system testing using the command 'multiprocessrollingtest test3&'

* The uid provided by the Windows version of apr_uid_current is not a constant value
  • Loading branch information
swebb2066 authored Dec 13, 2024
1 parent d5d646c commit accf293
Show file tree
Hide file tree
Showing 15 changed files with 498 additions and 449 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/log4cxx-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
fmt: OFF
qt: ON
odbc: OFF
multiprocess: ON
multithread: OFF
exitevents: OFF
fuzzers: OFF
Expand All @@ -41,6 +42,7 @@ jobs:
fmt: ON
qt: OFF
odbc: ON
multiprocess: OFF
multithread: OFF
exitevents: OFF
fuzzers: ON
Expand All @@ -50,6 +52,7 @@ jobs:
fmt: OFF
qt: OFF
odbc: OFF
multiprocess: OFF
multithread: ON
exitevents: ON
fuzzers: OFF
Expand All @@ -59,6 +62,7 @@ jobs:
fmt: ON
qt: OFF
odbc: OFF
multiprocess: OFF
multithread: ON
exitevents: OFF
fuzzers: ON
Expand Down Expand Up @@ -96,6 +100,7 @@ jobs:
-DLOG4CXX_ENABLE_ODBC=${{ matrix.odbc }} \
-DLOG4CXX_QT_SUPPORT=${{ matrix.qt }} \
-DENABLE_MULTITHREAD_TEST=${{ matrix.multithread }} \
-DLOG4CXX_MULTIPROCESS_ROLLING_FILE_APPENDER=${{ matrix.multiprocess }} \
-DLOG4CXX_EVENTS_AT_EXIT=${{ matrix.exitevents }} \
-DBUILD_FUZZERS=${{ matrix.fuzzers }} \
..
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/log4cxx-windows-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
cd main
mkdir build
cd build
cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DBUILD_SHARED_LIBS=off -DLOG4CXX_TEST_PROGRAM_PATH=C:\msys64\usr\bin "-DCMAKE_TOOLCHAIN_FILE=$THISDIR/vcpkg/scripts/buildsystems/vcpkg.cmake" ..
cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DBUILD_SHARED_LIBS=off -DLOG4CXX_MULTIPROCESS_ROLLING_FILE_APPENDER=on -DLOG4CXX_TEST_PROGRAM_PATH=C:\msys64\usr\bin "-DCMAKE_TOOLCHAIN_FILE=$THISDIR/vcpkg/scripts/buildsystems/vcpkg.cmake" ..
cmake --build .
- name: run unit tests
Expand Down
6 changes: 6 additions & 0 deletions src/main/cpp/class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
#include <log4cxx/nt/outputdebugstringappender.h>
#endif
#include <log4cxx/net/smtpappender.h>
#if LOG4CXX_HAS_MULTIPROCESS_ROLLING_FILE_APPENDER
#include <log4cxx/rolling/multiprocessrollingfileappender.h>
#endif
#include <log4cxx/helpers/datagramsocket.h>
#include <log4cxx/net/syslogappender.h>
#include <log4cxx/net/telnetappender.h>
Expand Down Expand Up @@ -199,6 +202,9 @@ void Class::registerClasses()
StringMatchFilter::registerClass();
LocationInfoFilter::registerClass();
LOG4CXX_NS::rolling::RollingFileAppender::registerClass();
#if LOG4CXX_HAS_MULTIPROCESS_ROLLING_FILE_APPENDER
LOG4CXX_NS::rolling::MultiprocessRollingFileAppender::registerClass();
#endif
LOG4CXX_NS::rolling::SizeBasedTriggeringPolicy::registerClass();
LOG4CXX_NS::rolling::TimeBasedRollingPolicy::registerClass();
LOG4CXX_NS::rolling::ManualTriggeringPolicy::registerClass();
Expand Down
Loading

0 comments on commit accf293

Please sign in to comment.