- log4netwebserviceappender_demo.zip
- Log4NetWebServiceAppender.sln
- Log4NetWebServiceAppender.suo
- References
- ClickOnceButton.dll
- de
- ZetaLib.Core.resources.dll
- ZetaLib.Web.resources.dll
- ZetaLib.Windows.resources.dll
- ICSharpCode.SharpZipLib.dll
- Interop.ADODB.dll
- Interop.JRO.dll
- log4net.dll
- ZetaLib.Core.dll
- ZetaLib.Web.dll
- ZetaLib.Windows.dll
- Runtime
- TestClient
- Web
- App_Code
- Bin
- ClickOnceButton.dll
- de
- ZetaLib.Core.resources.dll
- ZetaLib.Web.resources.dll
- ICSharpCode.SharpZipLib.dll
- Interop.ADODB.dll
- Interop.JRO.dll
- log4net.dll
- ZetaLib.Core.dll
- ZetaLib.Core.dll.refresh
- ZetaLib.Web.dll
- ZetaLib.Web.dll.refresh
- Global.asax
- LoggingService.asmx
- Web.Config
|
#region Using directives.
// ----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using log4net.Core;
using log4net.Appender;
using log4net.Util;
using ZetaLib.Core.Common;
using System.ComponentModel;
using log4net.Layout;
using System.Net;
using log4net.Filter;
using System.Diagnostics;
using ZetaLib.Core.Logging;
// ----------------------------------------------------------------------
#endregion
/// <summary>
/// Helper class for centralizing the code executed on the web server.
/// </summary>
public class WebServiceAppenderServerHandler
{
#region Public methods.
// ------------------------------------------------------------------
/// <summary>
/// Called from the web service only.
/// </summary>
public static void HandleLogOnServer(
WebServiceCommunicationInformation info )
{
Exception exception =
StringHelper.DeserializeFromString(
info.ExceptionSerializedAsString ) as Exception;
Logger logger =
LogCentral.Current.GetLoggerByName( @"LoggingService" );
// --
logger.LogInfo(
@"Received logging request from a WebServiceAppender. " +
@"Context information is following (if available), " +
@"then the actual logging message." );
if ( !string.IsNullOrEmpty( info.ContextInformation ) )
{
logger.LogInfo( info.ContextInformation );
}
// --
switch ( info.Level.ToUpperInvariant() )
{
case @"WARN":
logger.LogWarn( info.Message, exception );
break;
case @"DEBUG":
logger.LogDebug( info.Message, exception );
break;
case @"INFO":
logger.LogInfo( info.Message, exception );
break;
case @"ERROR":
logger.LogError( info.Message, exception );
break;
case @"FATAL":
logger.LogFatal( info.Message, exception );
break;
default:
Debug.Assert(
false,
string.Format(
@"Unknown log level '{0}'.",
info.Level ) );
logger.LogInfo( info.Message, exception );
break;
}
}
// ------------------------------------------------------------------
#endregion
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.