C# Class SampleApplication.Log4NetConfiguration

Show file Open project: ChrisEdwards/Fluency

Public Methods

Method Description
AddAppender ( string loggerName, IAppender appender ) : void

Add an appender to a logger.

Configure ( ) : void

Configures Log4Net to write to the file C:\Application.log After configuring, for each class you want to log from, add the following property to it: private static readonly ILog log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType ); Then to call the log, you can use: log.Debug( "your message to log" ); There are messages other than debug that you can use. Debug should only be used for debugging info. Use the correct message level for each log message.

CreateFileAppender ( string name, string fileName ) : IAppender

Create a new file appender.

FindAppender ( string appenderName ) : IAppender

Find a named appender already attached to a logger.

SetLevel ( string loggerName, string levelName ) : void

Set the level for a named logger.

Method Details

AddAppender() public static method

Add an appender to a logger.
public static AddAppender ( string loggerName, IAppender appender ) : void
loggerName string Name of the logger.
appender IAppender The appender.
return void

Configure() public static method

Configures Log4Net to write to the file C:\Application.log After configuring, for each class you want to log from, add the following property to it: private static readonly ILog log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType ); Then to call the log, you can use: log.Debug( "your message to log" ); There are messages other than debug that you can use. Debug should only be used for debugging info. Use the correct message level for each log message.
public static Configure ( ) : void
return void

CreateFileAppender() public static method

Create a new file appender.
public static CreateFileAppender ( string name, string fileName ) : IAppender
name string The name.
fileName string Name of the file.
return IAppender

FindAppender() public static method

Find a named appender already attached to a logger.
public static FindAppender ( string appenderName ) : IAppender
appenderName string Name of the appender.
return IAppender

SetLevel() public static method

Set the level for a named logger.
public static SetLevel ( string loggerName, string levelName ) : void
loggerName string Name of the logger.
levelName string Name of the level.
return void