You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by ni...@apache.org on 2004/09/13 09:01:48 UTC
cvs commit: logging-log4net/src/Util OnlyOnceErrorHandler.cs
nicko 2004/09/13 00:01:48
Modified: src/Util OnlyOnceErrorHandler.cs
Log:
Updated OnlyOnceErrorHandler to continue logging if InternalDebug is enabled
Revision Changes Path
1.4 +26 -6 logging-log4net/src/Util/OnlyOnceErrorHandler.cs
Index: OnlyOnceErrorHandler.cs
===================================================================
RCS file: /home/cvs/logging-log4net/src/Util/OnlyOnceErrorHandler.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- OnlyOnceErrorHandler.cs 23 Feb 2004 03:18:04 -0000 1.3
+++ OnlyOnceErrorHandler.cs 13 Sep 2004 07:01:48 -0000 1.4
@@ -73,9 +73,8 @@
/// <param name="errorCode">The internal error code.</param>
public void Error(string message, Exception e, ErrorCode errorCode)
{
- if (m_firstTime)
+ if (IsEnabled)
{
- m_firstTime = false;
LogLog.Error("[" + m_prefix + "] " + message, e);
}
}
@@ -88,9 +87,8 @@
/// <param name="e">The exception.</param>
public void Error(string message, Exception e)
{
- if (m_firstTime)
+ if (IsEnabled)
{
- m_firstTime = false;
LogLog.Error("[" + m_prefix + "] " + message, e);
}
}
@@ -102,14 +100,36 @@
/// <param name="message">The error message.</param>
public void Error(string message)
{
- if (m_firstTime)
+ if (IsEnabled)
{
- m_firstTime = false;
LogLog.Error("[" + m_prefix + "] " + message);
}
}
#endregion Implementation of IErrorHandler
+
+ /// <summary>
+ /// Is error logging enabled
+ /// </summary>
+ private bool IsEnabled
+ {
+ get
+ {
+ // Allow first error message to be logged
+ if (m_firstTime)
+ {
+ m_firstTime = false;
+ return true;
+ }
+
+ // Check if InternalDebugging is enabled
+ if (LogLog.InternalDebugging && !LogLog.QuietMode)
+ {
+ return true;
+ }
+ return false;
+ }
+ }
#region Private Instance Fields