blog
twitter
Termite Logging Framework for .NET termite VS Tool online logging
 
tweet tweet tweet tweet tweet

How to Use the Built-in Configuration

First, you must setup your machine and project as explained here. Don't read this page further until you've done that.

As mentioned on the setup page, unlike some other logging frameworks, you won't have to break out the Excedrin when configuring Termite's loggers. It's about as painless as possible. However, it would be enormously helpful if you already had some basic understanding of logging in general, and this logging framework in particular.

Overview

Remember, intellisense is your friend. The XSD provided with the framework will make things easy.


<BitFactory.Logging name="global" xmlns="http://BitFactory.Logging">
</BitFactory.Logging>

The outer node of the logging configuration--the "BitFactory.Logging" section--may contain certain global properties that will apply to the CompositeLogger you access in your code.

The attributes "name" and "xmlns" are required. You may name the logger anything you wish, but in order for intellisense to work properly, the namespace must be the same as specified above.

Take a look here at some example config sections. Once you understand the basics, continue reading this for option parameter information.

Here are some of the common parameters:


machine

This is the name of a machine (or a comma-separated list of names) on which the logger will be created. It allows you to configure loggers for only specific machines, if you wish. If the attribute is not present, or if it is empty, then the logger will be created on any machine on which the application is running. Look here for more information.


isEnabled

This is true if the logger is enabled. To turn off logging for a particular logger, set it to false.


severity

This is the SeverityThreshold of a logger. Any attempts to log with a lower severity will not be logged. For example, if the severity is set to Error, then any Debug log attempts will be filtered out.


formatString

You can customize the output by setting this value. Take a look at this for some more information.

The default format string looks something like: "[{application}] - [{severity}] - [{timestamp}] - {message}".


formattedFileName

This only applies to RollingDateFileLogger.

Be careful when using a format string for the formattedFileName of the RollingDateFileLogger. You must make sure that timestamp is formatted properly so that it is a valid filename. For example, slashes are illegal and would cause the logger to not log any items to the file. This is a bad formattedFileName: "c:\myLog_{timestamp}.log". This is also bad: "c:\myLog_{timestamp:MM/dd/yy}.log". This one is good: "c:\myLog_{timestamp:MM-dd-yyyy}.log".


isAsynchronous

Turn any logger into any asynchronous logger. Sweet!


isInsistent

This causes any logger to re-attempt logging after a timeout period, if for whatever reason, the logger fails to log the item.


includeCategories

This will filter a logger so that only the categories listed will be logged.


excludeCategories

This will filter a logger so that any attempted log entries with the listed categories will not be logged.