- Debug – Used for the developer him-/herself during development
- Info – Used to leave an execution trail of the code. Useful for orientation after an error has occurred run time, in particular where the stack-trace does not capture the complete history of the operation
- Warning – Used to flag a problem that is external to the code in question, e.g. related to incorrect calling parameters. It is not perceived that the next call will generate an error.
- Error – Used to flag an internal error, when a unperceived problem occurs within the code, the operation fails
- Fatal Error – Used to flag an error that makes it impossible for the component to continue operation. This typically happens at startup when the component is not able to initialize correctly, e.g. because there is no connection to the database which contains the component’s configuration
Showing posts with label log4net. Show all posts
Showing posts with label log4net. Show all posts
Tuesday, May 15, 2007
logging/tracing guidelines
I use log4net for logging/tracing, this is the current guideline:
Monday, February 19, 2007
Seeing the log4net output when testing under TestDriven.NET
[Update 22.02.] It is also possible to use the log4net configuration for the service or executable that will be calling the dll under test. To to this three things have to be done:
I found a nice way to be able to see the log4net output when unit testing under TestDriven.NET:
- Link the App.config file of the service or executable to the UnitTests project
- Include a
ILog sLogger = LogManager.GetLogger(typeof(IsmClientWatchdog));
in the test class, even thought sLogger is never used therein. - Add
[assembly: log4net.Config.XmlConfigurator(Watch=true)]
to the UnitTests project's AssemblyInfo.cs
XmlConfigurator.Configure()[Original post]
I found a nice way to be able to see the log4net output when unit testing under TestDriven.NET:
log4net.Appender.ConsoleAppender app;
[TestFixtureSetUp]
public void Init()
{
app = new log4net.Appender.ConsoleAppender();
app.Layout = new log4net.Layout.PatternLayout("%d %C{1} [%-5p] : %m%n");
app.Threshold = log4net.Core.Level.All;
log4net.Config.BasicConfigurator.Configure(app);
}
[TestFixtureTearDown]
public void Dispose()
{
app.Threshold = log4net.Core.Level.Off;
}
Subscribe to:
Posts (Atom)