/// <summary> /// Executes a logging. /// </summary> /// <param name="level">The <see cref="Level"/> of the logging.</param> /// <param name="exception">Optionally an <see cref="Exception"/> object to accompany the logging.</param> /// <param name="message">The log message.</param> /// <param name="args">Any formatting arguments for the log message.</param> public void Log(Level level, Exception exception, string message, params object[] args) { var l4nLevel = Log4NetLoggerFactory.ToLog4NetLevel(level); if (_logger.Logger.IsEnabledFor(l4nLevel)) { _logger.Logger.Log(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, l4nLevel, String.Format(message, args), exception); } }
/// <summary> /// Called when a logging was directed to this appender. /// </summary> /// <param name="loggingEvent">The <see cref="LoggingEvent"/> describing the logging.</param> protected override void Append(LoggingEvent loggingEvent) { Log4NetLoggerFactory.Factory.RaiseEvent(new LogEvent { LogLevel = Log4NetLoggerFactory.ToLevel(loggingEvent.Level), Exception = loggingEvent.ExceptionObject, RenderedMessage = RenderLoggingEvent(loggingEvent), Stamp = loggingEvent.TimeStamp }); }