This is an automated email from the ASF dual-hosted git repository.
rmiddleton pushed a commit to branch LOGCXX-518
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/LOGCXX-518 by this push:
new 4c3bef4d Optionally compile multiprocess stuff. Added basic
documentation on multiprocess
4c3bef4d is described below
commit 4c3bef4d40fa141306507612e76c0659dc9ba458
Author: Robert Middleton <[email protected]>
AuthorDate: Sun Oct 23 13:24:38 2022 -0400
Optionally compile multiprocess stuff. Added basic documentation on
multiprocess
---
src/main/cpp/timebasedrollingpolicy.cpp | 9 ++++++++-
src/site/markdown/1-usage.md | 1 +
src/site/markdown/{1-usage.md => multiprocess.md} | 23 +++++++++++++----------
3 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/src/main/cpp/timebasedrollingpolicy.cpp
b/src/main/cpp/timebasedrollingpolicy.cpp
index 1d13d93b..bb78514a 100644
--- a/src/main/cpp/timebasedrollingpolicy.cpp
+++ b/src/main/cpp/timebasedrollingpolicy.cpp
@@ -300,6 +300,7 @@ void
TimeBasedRollingPolicy::activateOptions(log4cxx::helpers::Pool& pool)
m_priv->lastFileName = buf;
if( m_priv->multiprocess ){
+#if LOG4CXX_HAS_MULTIPROCESS_ROLLING_FILE_APPENDER
if (getPatternConverterList().size())
{
(*(getPatternConverterList().begin()))->format(obj,
m_priv->_fileNamePattern, pool);
@@ -321,6 +322,7 @@ void
TimeBasedRollingPolicy::activateOptions(log4cxx::helpers::Pool& pool)
}
initMMapFile(m_priv->lastFileName, m_priv->_mmapPool);
+#endif
}
m_priv->suffixLength = 0;
@@ -401,6 +403,7 @@ RolloverDescriptionPtr TimeBasedRollingPolicy::rollover(
LogString newFileName(buf);
if( m_priv->multiprocess ){
+#if LOG4CXX_HAS_MULTIPROCESS_ROLLING_FILE_APPENDER
m_priv->bAlreadyInitialized = true;
if (m_priv->_mmap && !isMapFileEmpty(m_priv->_mmapPool))
@@ -415,6 +418,7 @@ RolloverDescriptionPtr TimeBasedRollingPolicy::rollover(
m_priv->_mmap = NULL;
initMMapFile(m_priv->lastFileName, m_priv->_mmapPool);
}
+#endif
}
//
@@ -463,6 +467,7 @@ RolloverDescriptionPtr TimeBasedRollingPolicy::rollover(
}
if( m_priv->multiprocess ){
+#if LOG4CXX_HAS_MULTIPROCESS_ROLLING_FILE_APPENDER
if (m_priv->_mmap && !isMapFileEmpty(m_priv->_mmapPool))
{
lockMMapFile(APR_FLOCK_EXCLUSIVE);
@@ -475,6 +480,7 @@ RolloverDescriptionPtr TimeBasedRollingPolicy::rollover(
m_priv->_mmap = NULL;
initMMapFile(newFileName, m_priv->_mmapPool);
}
+#endif
}else{
m_priv->lastFileName = newFileName;
}
@@ -489,7 +495,7 @@ bool TimeBasedRollingPolicy::isTriggeringEvent(
size_t /* fileLength */)
{
if( m_priv->multiprocess ){
-
+#if LOG4CXX_HAS_MULTIPROCESS_ROLLING_FILE_APPENDER
if (m_priv->bRefreshCurFile && m_priv->_mmap &&
!isMapFileEmpty(m_priv->_mmapPool))
{
lockMMapFile(APR_FLOCK_SHARED);
@@ -507,6 +513,7 @@ bool TimeBasedRollingPolicy::isTriggeringEvent(
}
return ( Date::currentTime() > m_priv->nextCheck) ||
(!m_priv->bAlreadyInitialized);
+#endif
}
return Date::currentTime() > m_priv->nextCheck;
diff --git a/src/site/markdown/1-usage.md b/src/site/markdown/1-usage.md
index 120b0b95..8d3d5a28 100644
--- a/src/site/markdown/1-usage.md
+++ b/src/site/markdown/1-usage.md
@@ -31,3 +31,4 @@ See the following pages for usage information:
* @subpage qt-support
* @subpage performance
* @subpage map-filter
+* @subpage multiprocess-logging
diff --git a/src/site/markdown/1-usage.md b/src/site/markdown/multiprocess.md
similarity index 57%
copy from src/site/markdown/1-usage.md
copy to src/site/markdown/multiprocess.md
index 120b0b95..5c7e7100 100644
--- a/src/site/markdown/1-usage.md
+++ b/src/site/markdown/multiprocess.md
@@ -1,4 +1,4 @@
-Usage {#usage-overview}
+Multiprocess Logging {#multiprocess-logging}
===
<!--
Note: License header cannot be first, as doxygen does not generate
@@ -21,13 +21,16 @@ Usage {#usage-overview}
limitations under the License.
-->
-See the following pages for usage information:
+# Logging With Multiple Processes
+
+If you have multiple applications that all log to the same file, it is often
+desirable that the file that these applications write to will roll over when
+required. In order for that to happen, Log4cxx supplies a
+`MultiprocessRollingFileAppender` that will check the size of the file when
+writing to the file and roll it over appropriately.
+
+This is an optional feature, and thus must be explicitly enabled when building
+Log4cxx. This feature is also only supported on Linux at the moment.
+Because this feature is non-standard, it may not work properly in all
+circumstances.
-* @subpage usage
-* @subpage threading
-* @subpage extending-log4cxx
-* @subpage faq
-* @subpage configuration-samples
-* @subpage qt-support
-* @subpage performance
-* @subpage map-filter