C# Class SampleApplication.Log4NetConfiguration

Afficher le fichier Open project: ChrisEdwards/Fluency

Méthodes publiques

Méthode 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 méthode

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

Configure() public static méthode

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
Résultat void

CreateFileAppender() public static méthode

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

FindAppender() public static méthode

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

SetLevel() public static méthode

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.
Résultat void