You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rm...@apache.org on 2021/12/26 16:56:03 UTC

[logging-log4cxx] branch next_stable updated (c7a145f -> 11b8ace)

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

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


    from c7a145f  Updated documentation slightly
     add 4f5f4b2  Use packaged liblog4j-1.2 (#80)
     add 67baf99  LOGCXX-536 Use CMAKE_INSTALL_LIBDIR instead CMAKE_INSTALL_DATAROOTDIR for cmake/pkgconfig target (#77)
     add 7005609  Update log4cxx.h.in (#76)
     add 4db6209  Fix constructions of SED filter in corner cases (#83)
     add 37f3241  Fix parallel execution of the testsuite (#79)
     add fa0e2e4  Ignore some additional dirs of my Visual Studio setup. the former "src/.vs|out" was a mistake most likely, resulting from running Visual Studio in the wrong dir level of the project.
     add 9c455fc  LOGCXX-540 Updated test to explicitly check all line endings (#85)
     add b213a62  LOGCXX-537 avoid deadlock if socket fails (#82)
     add ad4371c  Added a page on performance
     new 342afee  Merge branch 'master' into next_stable
     add acafaba  Imported and slightly cleaned up throughput tests (#87)
     new 11b8ace  Merge branch 'master' into next_stable

The 2 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.


Summary of changes:
 .gitattributes                                     |   6 +
 .gitignore                                         |   7 +-
 CMakeLists.txt                                     |  12 +-
 src/main/cpp/appenderskeleton.cpp                  |  10 +-
 src/main/cpp/asyncappender.cpp                     |   2 +-
 src/main/cpp/fileappender.cpp                      |  18 +-
 src/main/cpp/rollingfileappender.cpp               |   4 +-
 src/main/cpp/socketappenderskeleton.cpp            |  17 +-
 src/main/cpp/sockethubappender.cpp                 |   6 +-
 src/main/cpp/telnetappender.cpp                    |  10 +-
 src/main/cpp/writerappender.cpp                    |   4 +-
 src/main/cpp/xmlsocketappender.cpp                 |   4 +-
 src/main/include/log4cxx/log4cxx.h.in              |  11 ++
 .../log4cxx/private/appenderskeleton_priv.h        |   2 +-
 src/site/markdown/1-usage.md                       |   1 +
 src/site/markdown/performance.md                   |  67 +++++++
 src/test/cpp/CMakeLists.txt                        |   1 +
 src/test/cpp/customlogger/xloggertestcase.cpp      |   2 +-
 src/test/cpp/helpers/propertiestestcase.cpp        |  61 ++++--
 src/test/cpp/hierarchythresholdtestcase.cpp        |   2 +-
 src/test/cpp/l7dtestcase.cpp                       |   2 +-
 src/test/cpp/minimumtestcase.cpp                   |   2 +-
 src/test/cpp/ndctestcase.cpp                       |   2 +-
 src/test/cpp/net/socketappendertestcase.cpp        |  46 +++++
 src/test/cpp/patternlayouttest.cpp                 |   4 +-
 src/test/cpp/throughput/CMakeLists.txt             |  40 ++++
 src/test/cpp/throughput/log4cxxbenchmarker.cpp     | 220 +++++++++++++++++++++
 src/test/cpp/throughput/log4cxxbenchmarker.h       | 107 ++++++++++
 src/test/cpp/throughput/throughput-main.cpp        | 194 ++++++++++++++++++
 src/test/cpp/util/transformer.cpp                  |  19 +-
 src/test/cpp/varia/errorhandlertestcase.cpp        |   4 +-
 src/test/java/CMakeLists.txt                       |  21 +-
 .../resources/input/hierarchyThreshold1.properties |   2 +-
 .../resources/input/hierarchyThreshold2.properties |   2 +-
 .../resources/input/hierarchyThreshold3.properties |   2 +-
 .../resources/input/hierarchyThreshold4.properties |   2 +-
 .../resources/input/hierarchyThreshold5.properties |   2 +-
 .../resources/input/hierarchyThreshold6.properties |   2 +-
 .../resources/input/hierarchyThreshold7.properties |   2 +-
 .../resources/input/hierarchyThreshold8.properties |   2 +-
 src/test/resources/input/l7d1.properties           |   2 +-
 src/test/resources/input/ndc/NDC1.properties       |   2 +-
 .../resources/input/patternLayout.mdc.1.properties |   2 +-
 src/test/resources/input/patternLayout1.properties |   6 +-
 .../resources/input/patternLayout10.properties     |   2 +-
 .../resources/input/patternLayout11.properties     |   2 +-
 .../resources/input/patternLayout12.properties     |   2 +-
 .../resources/input/patternLayout13.properties     |   4 +-
 src/test/resources/input/patternLayout2.properties |   2 +-
 src/test/resources/input/patternLayout4.properties |   2 +-
 src/test/resources/input/patternLayout5.properties |   2 +-
 src/test/resources/input/patternLayout6.properties |   2 +-
 src/test/resources/input/patternLayout7.properties |   2 +-
 src/test/resources/input/patternLayout8.properties |   2 +-
 src/test/resources/input/patternLayout9.properties |   2 +-
 .../propertiestestcase-crlf.properties}            |   7 +-
 .../propertiestestcase-lf.properties}              |   7 +-
 .../propertiestestcase-mixed.properties}           |   6 +-
 .../resources/input/propertiestestcase.properties  |   2 +-
 src/test/resources/input/xml/customLogger1.xml     |   2 +-
 src/test/resources/input/xml/customLogger2.xml     |   2 +-
 src/test/resources/input/xml/fallback1.xml         |   2 +-
 62 files changed, 870 insertions(+), 118 deletions(-)
 create mode 100644 src/site/markdown/performance.md
 create mode 100644 src/test/cpp/throughput/CMakeLists.txt
 create mode 100644 src/test/cpp/throughput/log4cxxbenchmarker.cpp
 create mode 100644 src/test/cpp/throughput/log4cxxbenchmarker.h
 create mode 100644 src/test/cpp/throughput/throughput-main.cpp
 copy src/test/resources/{L7D_en_US.properties => input/propertiestestcase-crlf.properties} (86%)
 copy src/test/resources/{L7D_en_US.properties => input/propertiestestcase-lf.properties} (86%)
 copy src/test/resources/{L7D_en_US.properties => input/propertiestestcase-mixed.properties} (86%)

[logging-log4cxx] 01/02: Merge branch 'master' into next_stable

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

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

commit 342afee2df773da628c94f3e2b194f322cc24bad
Merge: c7a145f ad4371c
Author: Robert Middleton <ro...@rm5248.com>
AuthorDate: Sun Dec 26 11:26:08 2021 -0500

    Merge branch 'master' into next_stable

 .gitattributes                                     |  6 ++
 .gitignore                                         |  7 ++-
 CMakeLists.txt                                     | 12 ++--
 src/main/cpp/appenderskeleton.cpp                  | 10 ++--
 src/main/cpp/asyncappender.cpp                     |  2 +-
 src/main/cpp/fileappender.cpp                      | 18 +++---
 src/main/cpp/rollingfileappender.cpp               |  4 +-
 src/main/cpp/socketappenderskeleton.cpp            | 17 +++---
 src/main/cpp/sockethubappender.cpp                 |  6 +-
 src/main/cpp/telnetappender.cpp                    | 10 ++--
 src/main/cpp/writerappender.cpp                    |  4 +-
 src/main/cpp/xmlsocketappender.cpp                 |  4 +-
 src/main/include/log4cxx/log4cxx.h.in              | 11 ++++
 .../log4cxx/private/appenderskeleton_priv.h        |  2 +-
 src/site/markdown/1-usage.md                       |  1 +
 src/site/markdown/performance.md                   | 67 ++++++++++++++++++++++
 src/test/cpp/customlogger/xloggertestcase.cpp      |  2 +-
 src/test/cpp/helpers/propertiestestcase.cpp        | 61 +++++++++++++++-----
 src/test/cpp/hierarchythresholdtestcase.cpp        |  2 +-
 src/test/cpp/l7dtestcase.cpp                       |  2 +-
 src/test/cpp/minimumtestcase.cpp                   |  2 +-
 src/test/cpp/ndctestcase.cpp                       |  2 +-
 src/test/cpp/net/socketappendertestcase.cpp        | 46 +++++++++++++++
 src/test/cpp/patternlayouttest.cpp                 |  4 +-
 src/test/cpp/util/transformer.cpp                  | 19 +++++-
 src/test/cpp/varia/errorhandlertestcase.cpp        |  4 +-
 src/test/java/CMakeLists.txt                       | 21 +++++--
 .../resources/input/hierarchyThreshold1.properties |  2 +-
 .../resources/input/hierarchyThreshold2.properties |  2 +-
 .../resources/input/hierarchyThreshold3.properties |  2 +-
 .../resources/input/hierarchyThreshold4.properties |  2 +-
 .../resources/input/hierarchyThreshold5.properties |  2 +-
 .../resources/input/hierarchyThreshold6.properties |  2 +-
 .../resources/input/hierarchyThreshold7.properties |  2 +-
 .../resources/input/hierarchyThreshold8.properties |  2 +-
 src/test/resources/input/l7d1.properties           |  2 +-
 src/test/resources/input/ndc/NDC1.properties       |  2 +-
 .../resources/input/patternLayout.mdc.1.properties |  2 +-
 src/test/resources/input/patternLayout1.properties |  6 +-
 .../resources/input/patternLayout10.properties     |  2 +-
 .../resources/input/patternLayout11.properties     |  2 +-
 .../resources/input/patternLayout12.properties     |  2 +-
 .../resources/input/patternLayout13.properties     |  4 +-
 src/test/resources/input/patternLayout2.properties |  2 +-
 src/test/resources/input/patternLayout4.properties |  2 +-
 src/test/resources/input/patternLayout5.properties |  2 +-
 src/test/resources/input/patternLayout6.properties |  2 +-
 src/test/resources/input/patternLayout7.properties |  2 +-
 src/test/resources/input/patternLayout8.properties |  2 +-
 src/test/resources/input/patternLayout9.properties |  2 +-
 ...operties => propertiestestcase-crlf.properties} | 11 ++--
 ...properties => propertiestestcase-lf.properties} | 11 ++--
 ...perties => propertiestestcase-mixed.properties} | 10 +---
 .../resources/input/propertiestestcase.properties  |  2 +-
 src/test/resources/input/xml/customLogger1.xml     |  2 +-
 src/test/resources/input/xml/customLogger2.xml     |  2 +-
 src/test/resources/input/xml/fallback1.xml         |  2 +-
 57 files changed, 308 insertions(+), 130 deletions(-)

diff --cc src/main/cpp/appenderskeleton.cpp
index b881d52,0705c6e..fdc489c
--- a/src/main/cpp/appenderskeleton.cpp
+++ b/src/main/cpp/appenderskeleton.cpp
@@@ -62,13 -68,13 +62,13 @@@ void AppenderSkeleton::finalize(
  	close();
  }
  
 -void AppenderSkeleton::addFilter(const spi::FilterPtr& newFilter)
 +void AppenderSkeleton::addFilter(const spi::FilterPtr newFilter)
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(m_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
++	std::lock_guard<std::recursive_mutex> lock(m_priv->mutex);
  
 -	if (headFilter == 0)
 +	if (m_priv->headFilter == nullptr)
  	{
 -		headFilter = tailFilter = newFilter;
 +		m_priv->headFilter = m_priv->tailFilter = newFilter;
  	}
  	else
  	{
@@@ -79,8 -85,8 +79,8 @@@
  
  void AppenderSkeleton::clearFilters()
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(m_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
 -	headFilter = tailFilter = 0;
++	std::lock_guard<std::recursive_mutex> lock(m_priv->mutex);
 +	m_priv->headFilter = m_priv->tailFilter = nullptr;
  }
  
  bool AppenderSkeleton::isAsSevereAsThreshold(const LevelPtr& level) const
@@@ -90,7 -96,7 +90,7 @@@
  
  void AppenderSkeleton::doAppend(const spi::LoggingEventPtr& event, Pool& pool1)
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(m_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
++	std::lock_guard<std::recursive_mutex> lock(m_priv->mutex);
  
  	doAppendImpl(event, pool1);
  }
@@@ -133,9 -139,9 +133,9 @@@ void AppenderSkeleton::doAppendImpl(con
  
  void AppenderSkeleton::setErrorHandler(const spi::ErrorHandlerPtr errorHandler1)
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(m_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
++	std::lock_guard<std::recursive_mutex> lock(m_priv->mutex);
  
 -	if (errorHandler1 == 0)
 +	if (errorHandler1 == nullptr)
  	{
  		// We do not throw exception here since the cause is probably a
  		// bad config file.
@@@ -149,8 -155,8 +149,8 @@@
  
  void AppenderSkeleton::setThreshold(const LevelPtr& threshold1)
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(m_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
 -	this->threshold = threshold1;
++	std::lock_guard<std::recursive_mutex> lock(m_priv->mutex);
 +	m_priv->threshold = threshold1;
  }
  
  void AppenderSkeleton::setOption(const LogString& option,
diff --cc src/main/cpp/asyncappender.cpp
index 2b97487,876c257..2310083
--- a/src/main/cpp/asyncappender.cpp
+++ b/src/main/cpp/asyncappender.cpp
@@@ -201,7 -92,7 +201,7 @@@ void AsyncAppender::setOption(const Log
  
  void AsyncAppender::doAppend(const spi::LoggingEventPtr& event, Pool& pool1)
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
++	std::lock_guard<std::recursive_mutex> lock(priv->mutex);
  
  	doAppendImpl(event, pool1);
  }
diff --cc src/main/cpp/fileappender.cpp
index 774b19e,e04d730..59073e4
--- a/src/main/cpp/fileappender.cpp
+++ b/src/main/cpp/fileappender.cpp
@@@ -95,13 -93,13 +95,13 @@@ FileAppender::~FileAppender(
  
  void FileAppender::setAppend(bool fileAppend1)
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
 -	this->fileAppend = fileAppend1;
++	std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
 +	_priv->fileAppend = fileAppend1;
  }
  
  void FileAppender::setFile(const LogString& file)
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
++	std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
  	setFileInternal(file);
  }
  
@@@ -112,8 -110,8 +112,8 @@@ void FileAppender::setFileInternal(cons
  
  void FileAppender::setBufferedIO(bool bufferedIO1)
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
 -	this->bufferedIO = bufferedIO1;
++	std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
 +	_priv->bufferedIO = bufferedIO1;
  
  	if (bufferedIO1)
  	{
@@@ -127,28 -125,28 +127,28 @@@ void FileAppender::setOption(const LogS
  	if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FILE"), LOG4CXX_STR("file"))
  		|| StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FILENAME"), LOG4CXX_STR("filename")))
  	{
- 		std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -		std::lock_guard<std::recursive_mutex> lock(mutex);
 -		fileName = stripDuplicateBackslashes(value);
++		std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
 +		_priv->fileName = stripDuplicateBackslashes(value);
  	}
  	else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("APPEND"), LOG4CXX_STR("append")))
  	{
- 		std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -		std::lock_guard<std::recursive_mutex> lock(mutex);
 -		fileAppend = OptionConverter::toBoolean(value, true);
++		std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
 +		_priv->fileAppend = OptionConverter::toBoolean(value, true);
  	}
  	else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFEREDIO"), LOG4CXX_STR("bufferedio")))
  	{
- 		std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -		std::lock_guard<std::recursive_mutex> lock(mutex);
 -		bufferedIO = OptionConverter::toBoolean(value, true);
++		std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
 +		_priv->bufferedIO = OptionConverter::toBoolean(value, true);
  	}
  	else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("IMMEDIATEFLUSH"), LOG4CXX_STR("immediateflush")))
  	{
- 		std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -		std::lock_guard<std::recursive_mutex> lock(mutex);
 -		bufferedIO = !OptionConverter::toBoolean(value, false);
++		std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
 +		_priv->bufferedIO = !OptionConverter::toBoolean(value, false);
  	}
  	else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("BUFFERSIZE"), LOG4CXX_STR("buffersize")))
  	{
- 		std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -		std::lock_guard<std::recursive_mutex> lock(mutex);
 -		bufferSize = OptionConverter::toFileSize(value, 8 * 1024);
++		std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
 +		_priv->bufferSize = OptionConverter::toFileSize(value, 8 * 1024);
  	}
  	else
  	{
@@@ -158,7 -156,7 +158,7 @@@
  
  void FileAppender::activateOptions(Pool& p)
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
++	std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
  	activateOptionsInternal(p);
  }
  
diff --cc src/main/cpp/rollingfileappender.cpp
index dece266,48aad5f..838938d
--- a/src/main/cpp/rollingfileappender.cpp
+++ b/src/main/cpp/rollingfileappender.cpp
@@@ -119,9 -94,9 +119,9 @@@ void RollingFileAppender::activateOptio
  	}
  
  	{
- 		std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -		std::lock_guard<std::recursive_mutex> lock(mutex);
 -		triggeringPolicy->activateOptions(p);
 -		rollingPolicy->activateOptions(p);
++		std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
 +		_priv->triggeringPolicy->activateOptions(p);
 +		_priv->rollingPolicy->activateOptions(p);
  
  		try
  		{
@@@ -206,9 -181,9 +206,9 @@@ void RollingFileAppenderSkeleton::relea
  
   * @return true if rollover performed.
   */
 -bool RollingFileAppenderSkeleton::rollover(Pool& p)
 +bool RollingFileAppender::rollover(Pool& p)
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
++	std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
  	return rolloverInternal(p);
  }
  
diff --cc src/main/cpp/socketappenderskeleton.cpp
index 676cf58,b0b73b4..de79bd8
--- a/src/main/cpp/socketappenderskeleton.cpp
+++ b/src/main/cpp/socketappenderskeleton.cpp
@@@ -55,9 -78,9 +55,9 @@@ void SocketAppenderSkeleton::activateOp
  
  void SocketAppenderSkeleton::close()
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
++	std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
  
 -	if (closed)
 +	if (_priv->closed)
  	{
  		return;
  	}
@@@ -134,9 -157,16 +134,9 @@@ void SocketAppenderSkeleton::setOption(
  
  void SocketAppenderSkeleton::fireConnector()
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
 -
 -	if( thread.joinable() ){
 -		// This should only get called if the thread has already exited.
 -		// We could have a potential bug if fireConnector is called while
 -		// the thread is waiting for a connection
 -		thread.join();
 -	}
++	std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
  
 -	if ( !thread.joinable() )
 +	if ( !_priv->thread.joinable() )
  	{
  		LogLog::debug(LOG4CXX_STR("Connector thread not alive: starting monitor."));
  
@@@ -153,17 -183,11 +153,11 @@@ void SocketAppenderSkeleton::monitor(
  	{
  		try
  		{
- 			std::this_thread::sleep_for( std::chrono::milliseconds( _priv->reconnectionDelay ) );
- 
- 			std::unique_lock<std::mutex> lock( _priv->interrupt_mutex );
- 			_priv->interrupt.wait_for( lock, std::chrono::milliseconds( _priv->reconnectionDelay ),
- 				std::bind(&SocketAppenderSkeleton::is_closed, this) );
- 
 -			if (!closed)
 +			if (!_priv->closed)
  			{
  				LogLog::debug(LogString(LOG4CXX_STR("Attempting connection to "))
 -					+ address->getHostName());
 -				socket = SocketPtr(new Socket(address, port));
 +					+ _priv->address->getHostName());
 +				socket = SocketPtr(new Socket(_priv->address, _priv->port));
  				Pool p;
  				setSocket(socket, p);
  				LogLog::debug(LOG4CXX_STR("Connection established. Exiting connector thread."));
@@@ -193,7 -216,11 +186,11 @@@
  				+ exmsg);
  		}
  
 -		std::unique_lock<std::mutex> lock( interrupt_mutex );
 -		interrupt.wait_for( lock, std::chrono::milliseconds( reconnectionDelay ),
++		std::unique_lock<std::mutex> lock( _priv->interrupt_mutex );
++		_priv->interrupt.wait_for( lock, std::chrono::milliseconds( _priv->reconnectionDelay ),
+ 			std::bind(&SocketAppenderSkeleton::is_closed, this) );
+ 
 -		isClosed = closed;
 +		isClosed = _priv->closed;
  	}
  
  	LogLog::debug(LOG4CXX_STR("Exiting Connector.run() method."));
diff --cc src/main/cpp/sockethubappender.cpp
index fae4fdf,6a8a0aa..86613bb
--- a/src/main/cpp/sockethubappender.cpp
+++ b/src/main/cpp/sockethubappender.cpp
@@@ -102,9 -84,9 +102,9 @@@ void SocketHubAppender::setOption(cons
  void SocketHubAppender::close()
  {
  	{
- 		std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -		std::lock_guard<std::recursive_mutex> lock(mutex);
++		std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
  
 -		if (closed)
 +		if (_priv->closed)
  		{
  			return;
  		}
@@@ -117,12 -99,12 +117,12 @@@
  	//
  	//  wait until the server thread completes
  	//
 -	if ( thread.joinable() )
 +	if ( _priv->thread.joinable() )
  	{
 -		thread.join();
 +		_priv->thread.join();
  	}
  
- 	std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
++	std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
  	// close all of the connections
  	LogLog::debug(LOG4CXX_STR("closing client connections"));
  
@@@ -252,7 -234,7 +252,7 @@@ void SocketHubAppender::monitor(
  					+ LOG4CXX_STR(")"));
  
  				// add it to the oosList.
- 				std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -				std::lock_guard<std::recursive_mutex> lock(mutex);
++				std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
  				OutputStreamPtr os(new SocketOutputStream(socket));
  				Pool p;
  				ObjectOutputStreamPtr oos(new ObjectOutputStream(os, p));
diff --cc src/main/cpp/telnetappender.cpp
index 4c095bd,2a880ee..9a2e8ee
--- a/src/main/cpp/telnetappender.cpp
+++ b/src/main/cpp/telnetappender.cpp
@@@ -101,23 -84,23 +101,23 @@@ void TelnetAppender::setOption(const Lo
  
  LogString TelnetAppender::getEncoding() const
  {
- 	log4cxx::shared_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
 -	return encoding;
++	std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
 +	return _priv->encoding;
  }
  
  void TelnetAppender::setEncoding(const LogString& value)
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
 -	encoder = CharsetEncoder::getEncoder(value);
 -	encoding = value;
++	std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
 +	_priv->encoder = CharsetEncoder::getEncoder(value);
 +	_priv->encoding = value;
  }
  
  
  void TelnetAppender::close()
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
++	std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
  
 -	if (closed)
 +	if (_priv->closed)
  	{
  		return;
  	}
@@@ -212,7 -195,7 +212,7 @@@ void TelnetAppender::append(const spi::
  		LogString::const_iterator msgIter(msg.begin());
  		ByteBuffer buf(bytes, bytesSize);
  
- 		log4cxx::shared_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -		std::lock_guard<std::recursive_mutex> lock(mutex);
++		std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
  
  		while (msgIter != msg.end())
  		{
@@@ -268,10 -251,10 +268,10 @@@ void TelnetAppender::acceptConnections(
  				//
  				//   find unoccupied connection
  				//
- 				std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -				std::lock_guard<std::recursive_mutex> lock(mutex);
++				std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
  
 -				for (ConnectionList::iterator iter = connections.begin();
 -					iter != connections.end();
 +				for (ConnectionList::iterator iter = _priv->connections.begin();
 +					iter != _priv->connections.end();
  					iter++)
  				{
  					if (*iter == NULL)
diff --cc src/main/cpp/writerappender.cpp
index afe61cf,1d4303d..02fe154
--- a/src/main/cpp/writerappender.cpp
+++ b/src/main/cpp/writerappender.cpp
@@@ -158,9 -151,9 +158,9 @@@ bool WriterAppender::checkEntryConditio
     */
  void WriterAppender::close()
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
++	std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
  
 -	if (closed)
 +	if (_priv->closed)
  	{
  		return;
  	}
@@@ -285,7 -278,7 +285,7 @@@ void WriterAppender::writeHeader(Pool& 
  
  void WriterAppender::setWriter(const WriterPtr& newWriter)
  {
- 	std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
++	std::unique_lock<std::recursive_mutex> lock(_priv->mutex);
  	setWriterInternal(newWriter);
  }
  
diff --cc src/main/cpp/xmlsocketappender.cpp
index 78b0a0c,36fdfce..39134ad
--- a/src/main/cpp/xmlsocketappender.cpp
+++ b/src/main/cpp/xmlsocketappender.cpp
@@@ -102,8 -84,8 +102,8 @@@ void XMLSocketAppender::setSocket(log4c
  {
  	OutputStreamPtr os(new SocketOutputStream(socket));
  	CharsetEncoderPtr charset(CharsetEncoder::getUTF8Encoder());
- 	std::unique_lock<log4cxx::shared_mutex> lock(_priv->mutex);
- 	_priv->writer = std::make_shared<OutputStreamWriter>(os, charset);
 -	std::lock_guard<std::recursive_mutex> lock(mutex);
 -	writer = OutputStreamWriterPtr(new OutputStreamWriter(os, charset));
++	std::lock_guard<std::recursive_mutex> lock(_priv->mutex);
++	_priv->writer = OutputStreamWriterPtr(new OutputStreamWriter(os, charset));
  }
  
  void XMLSocketAppender::cleanUp(Pool& p)
diff --cc src/main/include/log4cxx/private/appenderskeleton_priv.h
index 07a7457,0000000..4a6b831
mode 100644,000000..100644
--- a/src/main/include/log4cxx/private/appenderskeleton_priv.h
+++ b/src/main/include/log4cxx/private/appenderskeleton_priv.h
@@@ -1,75 -1,0 +1,75 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one or more
 + * contributor license agreements.  See the NOTICE file distributed with
 + * this work for additional information regarding copyright ownership.
 + * The ASF licenses this file to You under the Apache License, Version 2.0
 + * (the "License"); you may not use this file except in compliance with
 + * the License.  You may obtain a copy of the License at
 + *
 + *      http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +
 +#ifndef _LOG4CXX_APPENDERSKELETON_PRIV
 +#define _LOG4CXX_APPENDERSKELETON_PRIV
 +
 +#include <log4cxx/appenderskeleton.h>
 +#include <log4cxx/helpers/onlyonceerrorhandler.h>
 +#include <memory>
 +
 +namespace log4cxx
 +{
 +
 +struct AppenderSkeleton::AppenderSkeletonPrivate
 +{
 +	AppenderSkeletonPrivate() :
 +		threshold(Level::getAll()),
 +		errorHandler(std::make_shared<log4cxx::helpers::OnlyOnceErrorHandler>()),
 +		closed(false) {}
 +
 +	AppenderSkeletonPrivate( LayoutPtr lay ) :
 +		layout( lay ),
 +		threshold(Level::getAll()),
 +		errorHandler(std::make_shared<log4cxx::helpers::OnlyOnceErrorHandler>()),
 +		closed(false) {}
 +
 +	/** The layout variable does not need to be set if the appender
 +	implementation has its own layout. */
 +	LayoutPtr layout;
 +
 +	/** Appenders are named. */
 +	LogString name;
 +
 +	/**
 +	There is no level threshold filtering by default.  */
 +	LevelPtr threshold;
 +
 +	/**
 +	It is assumed and enforced that errorHandler is never null.
 +	*/
 +	spi::ErrorHandlerPtr errorHandler;
 +
 +	/** The first filter in the filter chain. Set to <code>null</code>
 +	initially. */
 +	spi::FilterPtr headFilter;
 +
 +	/** The last filter in the filter chain. */
 +	spi::FilterPtr tailFilter;
 +
 +	/**
 +	Is this appender closed?
 +	*/
 +	bool closed;
 +
 +	log4cxx::helpers::Pool pool;
- 	mutable log4cxx::shared_mutex mutex;
++	mutable std::recursive_mutex mutex;
 +};
 +
 +}
 +
 +#endif /* _LOG4CXX_APPENDERSKELETON_PRIV */

[logging-log4cxx] 02/02: Merge branch 'master' into next_stable

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

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

commit 11b8ace75e1d6d9df37c81e695f6ee15372dc808
Merge: 342afee acafaba
Author: Robert Middleton <ro...@rm5248.com>
AuthorDate: Sun Dec 26 11:34:00 2021 -0500

    Merge branch 'master' into next_stable

 src/test/cpp/CMakeLists.txt                    |   1 +
 src/test/cpp/throughput/CMakeLists.txt         |  40 +++++
 src/test/cpp/throughput/log4cxxbenchmarker.cpp | 220 +++++++++++++++++++++++++
 src/test/cpp/throughput/log4cxxbenchmarker.h   | 107 ++++++++++++
 src/test/cpp/throughput/throughput-main.cpp    | 194 ++++++++++++++++++++++
 5 files changed, 562 insertions(+)

diff --cc src/test/cpp/CMakeLists.txt
index 71f95be,d7ddaa2..eb981b9
--- a/src/test/cpp/CMakeLists.txt
+++ b/src/test/cpp/CMakeLists.txt
@@@ -57,8 -57,10 +57,9 @@@ if(WIN32
  endif()
  add_subdirectory(pattern)
  add_subdirectory(rolling)
 -add_subdirectory(spi)
  add_subdirectory(varia)
  add_subdirectory(xml)
+ add_subdirectory(throughput)
  
  # Note: we need to include the APR DLLs on our path so that the tests will run.
  # The way that CMake sets the environment is that it actually generates a secondary file,