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 2020/08/07 22:08:48 UTC
[logging-log4cxx] branch master updated: 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. (#33)
This is an automated email from the ASF dual-hosted git repository.
rmiddleton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/master by this push:
new e27b494 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. (#33)
e27b494 is described below
commit e27b494cd5ac09afa8cf97548c52f2e7017d2b22
Author: Thorsten Schöning <62...@users.noreply.github.com>
AuthorDate: Sat Aug 8 00:06:42 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. (#33)
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();