You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2023/08/02 07:45:12 UTC

[logging-log4cxx] branch multiprocess_appender created (now 7e2f607d)

This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a change to branch multiprocess_appender
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


      at 7e2f607d Include multiprocessrollingfileappender when the cmake var LOG4CXX_MULTIPROCESS_ROLLING_FILE_APPENDER is ON

This branch includes the following new commits:

     new 7e2f607d Include multiprocessrollingfileappender when the cmake var LOG4CXX_MULTIPROCESS_ROLLING_FILE_APPENDER is ON

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[logging-log4cxx] 01/01: Include multiprocessrollingfileappender when the cmake var LOG4CXX_MULTIPROCESS_ROLLING_FILE_APPENDER is ON

Posted by sw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a commit to branch multiprocess_appender
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit 7e2f607d1246cd9495581f9c56afd4c579539f11
Author: Stephen Webb <sw...@gmail.com>
AuthorDate: Wed Aug 2 17:44:43 2023 +1000

    Include multiprocessrollingfileappender when the cmake var LOG4CXX_MULTIPROCESS_ROLLING_FILE_APPENDER is ON
---
 src/main/cpp/CMakeLists.txt                                    |  8 ++++----
 src/main/cpp/multiprocessrollingfileappender.cpp               | 10 +++++++---
 .../include/log4cxx/rolling/multiprocessrollingfileappender.h  |  2 +-
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/main/cpp/CMakeLists.txt b/src/main/cpp/CMakeLists.txt
index be187a7b..c67c9dda 100644
--- a/src/main/cpp/CMakeLists.txt
+++ b/src/main/cpp/CMakeLists.txt
@@ -30,7 +30,7 @@ add_dependencies(log4cxx configure_log4cxx)
 set(extra_classes "")
 
 if(LOG4CXX_NETWORKING_SUPPORT)
-    set(extra_classes ${extra_classes}
+    list(APPEND extra_classes
 	datagrampacket.cpp
 	datagramsocket.cpp
 	aprdatagramsocket.cpp
@@ -47,14 +47,14 @@ if(LOG4CXX_NETWORKING_SUPPORT)
 	)
 endif()
 
-if()
-    set(extra_classes ${extra_classes}
+if(LOG4CXX_MULTIPROCESS_ROLLING_FILE_APPENDER)
+    list(APPEND extra_classes
 	multiprocessrollingfileappender.cpp
 	)
 endif()
 
 if(${ENABLE_FMT_LAYOUT})
-    set(extra_classes ${extra_classes}
+    list(APPEND extra_classes
 	fmtlayout.cpp
 	)
 endif()
diff --git a/src/main/cpp/multiprocessrollingfileappender.cpp b/src/main/cpp/multiprocessrollingfileappender.cpp
index 29b02592..c6ee5004 100644
--- a/src/main/cpp/multiprocessrollingfileappender.cpp
+++ b/src/main/cpp/multiprocessrollingfileappender.cpp
@@ -242,13 +242,17 @@ bool MultiprocessRollingFileAppender::rolloverInternal(Pool& p)
 
 			if (stat == APR_SUCCESS)
 			{
-				snprintf(szUid, MAX_FILE_LEN, "%u", uid);
+#ifdef WIN32
+				snprintf(szUid, MAX_FILE_LEN, "%p", uid);
+#else
+				snprintf(szUid, MAX_FILE_LEN, "%u", (unsigned int)uid);
+#endif
 			}
 
 			log4cxx::filesystem::path path = szDirName;
-			const LogString lockname = path.parent_path() / (path.filename().string() + szUid + ".lock");
+			const auto lockname = path.parent_path() / (path.filename().string() + szUid + ".lock");
 			apr_file_t* lock_file;
-			stat = apr_file_open(&lock_file, lockname.c_str(), APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT, p.getAPRPool());
+			stat = apr_file_open(&lock_file, lockname.string().c_str(), APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT, p.getAPRPool());
 
 			if (stat != APR_SUCCESS)
 			{
diff --git a/src/main/include/log4cxx/rolling/multiprocessrollingfileappender.h b/src/main/include/log4cxx/rolling/multiprocessrollingfileappender.h
index 1d79385b..a37c895a 100644
--- a/src/main/include/log4cxx/rolling/multiprocessrollingfileappender.h
+++ b/src/main/include/log4cxx/rolling/multiprocessrollingfileappender.h
@@ -71,7 +71,7 @@ class LOG4CXX_EXPORT MultiprocessRollingFileAppender : public FileAppender
 		   <code>File</code> is truncated with no backup files created.
 
 		 */
-		bool rollover(helpers::Pool& p) override;
+		bool rollover(helpers::Pool& p);
 
 	protected: