You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ts...@apache.org on 2020/08/07 15:13:43 UTC

[logging-log4cxx] branch logcxx_455_quiet_mode created (now 6384112)

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

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


      at 6384112  Changed the implementation to handle "quietMode" always. That has been the requested behaviour in LOGCXX-455 and it seems to simply make sense to handle that always at one place.

This branch includes the following new commits:

     new 7463aa4  Less warnings in Visual Studio 2015.
     new 4e14be7  Code style.
     new 6384112  Changed the implementation to handle "quietMode" always. That has been the requested behaviour in LOGCXX-455 and it seems to simply make sense to handle that always at one place.

The 3 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] 03/03: Changed the implementation to handle "quietMode" always. That has been the requested behaviour in LOGCXX-455 and it seems to simply make sense to handle that always at one place.

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

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

commit 6384112143046df0c6afc4815131d2c6311e2d47
Author: Thorsten Schöning <ts...@am-soft.de>
AuthorDate: Fri Aug 7 17:12:23 2020 +0200

    Changed the implementation to handle "quietMode" always. That has been the requested behaviour in LOGCXX-455 and it seems to simply make sense to handle that always at one place.
    
    https://issues.apache.org/jira/projects/LOGCXX/issues/LOGCXX-455
---
 src/changes/changes.xml |  1 +
 src/main/cpp/loglog.cpp | 39 +++++++++++++++++++++++++--------------
 2 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 314c671..937fc4a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -39,6 +39,7 @@
 			<action issue="LOGCXX-483" type="update">Not able to see hebrew values when logging in log4cxx</action>
 			<action issue="LOGCXX-482" type="fix">Build failure with GCC-6</action>
 			<action issue="LOGCXX-464" type="fix">TimeBasedRollingPolicy should append as configured on rollover</action>
+			<action issue="LOGCXX-455" type="fix">LogLog::setQuietMode(true) does not suppress exception reporting</action>
 			<action issue="LOGCXX-446" type="fix">make install fails, trying to overwrite header files</action>
 			<action issue="LOGCXX-443" type="fix">Return by const reference in Logger::getName()</action>
 			<action issue="LOGCXX-433" type="fix">Autoconf 2.69 needs 'ACLOCAL_AMFLAGS= -I .'</action>
diff --git a/src/main/cpp/loglog.cpp b/src/main/cpp/loglog.cpp
index faf21ef..7b1e867 100644
--- a/src/main/cpp/loglog.cpp
+++ b/src/main/cpp/loglog.cpp
@@ -34,8 +34,8 @@ LogLog::LogLog() : mutex(APRInitializer::getRootPool())
 {
 	synchronized sync(mutex);
 
-	debugEnabled    = false;
-	quietMode       = false;
+	debugEnabled	= false;
+	quietMode		= false;
 }
 
 LogLog& LogLog::getInstance()
@@ -54,16 +54,23 @@ void LogLog::setInternalDebugging(bool debugEnabled1)
 
 void LogLog::debug(const LogString& msg)
 {
-	synchronized sync(getInstance().mutex);
-
-	if (getInstance().debugEnabled && !getInstance().quietMode)
+	if (!getInstance().debugEnabled)
 	{
-		emit(msg);
+		return;
 	}
+
+	synchronized sync(getInstance().mutex);
+
+	emit(msg);
 }
 
 void LogLog::debug(const LogString& msg, const std::exception& e)
 {
+	if (!getInstance().debugEnabled)
+	{
+		return;
+	}
+
 	synchronized sync(getInstance().mutex);
 
 	debug(msg);
@@ -75,10 +82,7 @@ void LogLog::error(const LogString& msg)
 {
 	synchronized sync(getInstance().mutex);
 
-	if (!getInstance().quietMode)
-	{
-		emit(msg);
-	}
+	emit(msg);
 }
 
 void LogLog::error(const LogString& msg, const std::exception& e)
@@ -100,10 +104,7 @@ void LogLog::warn(const LogString& msg)
 {
 	synchronized sync(getInstance().mutex);
 
-	if (!getInstance().quietMode)
-	{
-		emit(msg);
-	}
+	emit(msg);
 }
 
 void LogLog::warn(const LogString& msg, const std::exception& e)
@@ -116,6 +117,11 @@ void LogLog::warn(const LogString& msg, const std::exception& e)
 
 void LogLog::emit(const LogString& msg)
 {
+	if (getInstance().quietMode)
+	{
+		return;
+	}
+
 	LogString out(LOG4CXX_STR("log4cxx: "));
 
 	out.append(msg);
@@ -126,6 +132,11 @@ void LogLog::emit(const LogString& msg)
 
 void LogLog::emit(const std::exception& ex)
 {
+	if (getInstance().quietMode)
+	{
+		return;
+	}
+
 	LogString out(LOG4CXX_STR("log4cxx: "));
 	const char* raw = ex.what();
 


[logging-log4cxx] 01/03: Less warnings in Visual Studio 2015.

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

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

commit 7463aa4687fb9d625d507166021dd0e294bf9d24
Author: Thorsten Schöning <ts...@am-soft.de>
AuthorDate: Fri Aug 7 16:16:10 2020 +0200

    Less warnings in Visual Studio 2015.
    
    https://issues.apache.org/jira/projects/LOGCXX/issues/LOGCXX-490
---
 src/changes/changes.xml           | 1 +
 src/main/include/log4cxx/logger.h | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 21d0691..314c671 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -33,6 +33,7 @@
 			<action issue="LOGCXX-500" type="update">Logging in Timing-Critical Applications</action>
 			<action issue="LOGCXX-494" type="fix">Provide a windows build environment for the project by replacing the ant build with a CMake build</action>
 			<action issue="LOGCXX-493" type="fix">Wrong usage of milli- vs. micro- and non- vs. milliseconds in some docs.</action>
+			<action issue="LOGCXX-490" type="fix">conditional expression is constant</action>
 			<action issue="LOGCXX-488" type="fix">Space after log level hides messages</action>
 			<action issue="LOGCXX-484" type="fix">Spelling error s/excute/execute</action>
 			<action issue="LOGCXX-483" type="update">Not able to see hebrew values when logging in log4cxx</action>
diff --git a/src/main/include/log4cxx/logger.h b/src/main/include/log4cxx/logger.h
index 2db5d9e..07a9047 100644
--- a/src/main/include/log4cxx/logger.h
+++ b/src/main/include/log4cxx/logger.h
@@ -18,6 +18,10 @@
 #ifndef _LOG4CXX_LOGGER_H
 #define _LOG4CXX_LOGGER_H
 
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+	#pragma warning ( push )
+	#pragma warning ( disable: 4127 )
+#endif
 #if defined(_MSC_VER)
 	#pragma warning ( push )
 	#pragma warning ( disable: 4231 4251 4275 4786 )


[logging-log4cxx] 02/03: Code style.

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

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

commit 4e14be7ab25307236d08d38e1b1d93d0bff41af7
Author: Thorsten Schöning <ts...@am-soft.de>
AuthorDate: Fri Aug 7 16:32:16 2020 +0200

    Code style.
---
 .astylerc                                   |  2 +-
 src/main/cpp/mapfilter.cpp                  |  4 ++--
 src/main/include/log4cxx/filter/mapfilter.h | 12 ++++++------
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/.astylerc b/.astylerc
index eee1b59..4d4ac99 100644
--- a/.astylerc
+++ b/.astylerc
@@ -20,13 +20,13 @@
 --break-one-line-headers
 --convert-tabs
 
+--indent=force-tab=4
 --indent-after-parens
 --indent-classes
 --indent-col1-comments
 --indent-preproc-block
 --indent-preproc-define
 --indent-switches
---indent=force-tab=4
 
 --lineend=linux
 --pad-comma
diff --git a/src/main/cpp/mapfilter.cpp b/src/main/cpp/mapfilter.cpp
index 09e38ca..b164ae7 100644
--- a/src/main/cpp/mapfilter.cpp
+++ b/src/main/cpp/mapfilter.cpp
@@ -33,8 +33,8 @@ MapFilter::MapFilter() : acceptOnMatch(true), mustMatchAll(false)
 
 }
 
-void MapFilter::setOption(	const LogString& option,
-							const LogString& value)
+void MapFilter::setOption(  const LogString& option,
+	const LogString& value)
 {
 	if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("ACCEPTONMATCH"), LOG4CXX_STR("acceptonmatch")))
 	{
diff --git a/src/main/include/log4cxx/filter/mapfilter.h b/src/main/include/log4cxx/filter/mapfilter.h
index 768fbd6..77305aa 100644
--- a/src/main/include/log4cxx/filter/mapfilter.h
+++ b/src/main/include/log4cxx/filter/mapfilter.h
@@ -42,12 +42,12 @@ namespace filter
  */
 class LOG4CXX_EXPORT MapFilter: public log4cxx::spi::Filter
 {
-	typedef std::map < LogString, LogString > KeyVals;
+		typedef std::map < LogString, LogString > KeyVals;
 
 	private:
-		bool	acceptOnMatch;
-		bool	mustMatchAll; // true = AND; false = OR
-		KeyVals	keyVals;
+		bool    acceptOnMatch;
+		bool    mustMatchAll; // true = AND; false = OR
+		KeyVals keyVals;
 
 	public:
 		DECLARE_LOG4CXX_OBJECT(MapFilter)
@@ -71,8 +71,8 @@ class LOG4CXX_EXPORT MapFilter: public log4cxx::spi::Filter
 
 		inline const LogString& getValue(const LogString& strKey) const
 		{
-			static	const LogString					empty;
-					const KeyVals::const_iterator	it(this->keyVals.find(strKey));
+			static  const LogString                 empty;
+			const KeyVals::const_iterator   it(this->keyVals.find(strKey));
 
 			return (it != keyVals.end() ? it->second : empty);
 		}