summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2010-11-17 13:58:13 +0000
committerChris Wilson <chris+github@qwirx.com>2010-11-17 13:58:13 +0000
commit169f3849448b5122ec9fb665298e7c51ce314c53 (patch)
tree13c2907662cf281aac79b9187fd2f60dce151998
parentf3107d15eb003df842858d83da85130da8641220 (diff)
Avoid fatal error caused by recursive logging if we fail to open the
file we're supposed to log to.
-rw-r--r--lib/common/Logging.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/common/Logging.cpp b/lib/common/Logging.cpp
index 296443ea..d0e05394 100644
--- a/lib/common/Logging.cpp
+++ b/lib/common/Logging.cpp
@@ -446,6 +446,13 @@ int Syslog::GetNamedFacility(const std::string& rFacility)
bool FileLogger::Log(Log::Level Level, const std::string& rFile,
int line, std::string& rMessage)
{
+ if (mLogFile.StreamClosed())
+ {
+ /* skip this logger to allow logging failure to open
+ the log file, without causing an infinite loop */
+ return true;
+ }
+
if (Level > GetLevel())
{
return true;