Logging Extension Messages
One common debugging technique is to log information in a file. Writing to a log file is most useful when real-time data is not needed or when many iterations are expected. The Microsoft Identity Integration Server 2003 includes a file, logging.xml, and one class, Logging, that control logging information.
Using the Logging Definition File
The logging.xml file contains entries that you can use to specify how logging works:
- <use-single-log> specifies whether to use one log file, or a separate log file for each management agent. The default value is false, which means each management agent gets its own log file, Galsync.log, in the MaData\MA_NAME directory, where MA_NAME is the name of the management agent. If this value is true, every management agent shares a log file, Galsync.log, in the MaData directory.
- <file-name> specifies the name of the logging file, overriding the default name, Galsync.log.
- <logging-level> specifies the level at which logging messages are posted to the log file. Only messages tagged with logging levels equal to or higher than this value are logged to the log file.
Using the Logging Class
The Logging class contains a number of static methods that you can use to log messages:
- Log logs a message with an optional timestamp at a given logging level.
- LogException (Exception, String, CSEntry, Boolean) logs an exception with information about the calling method, entry in the connector space, and whether the exception was caught and handled.
- LogException (Exception, String, String, Boolean) logs an exception with information about the calling method, when the exception occurred, and whether the exception was caught and handled.
- SetupLogFile overrides the <file-name> and <logging-level> entries in logging.xml.
Creating a Reference to the Logging Assembly
Before you can use the Logging class you must create a reference to the assembly containing the code. The assembly is Logging.dll, which is located in the Extensions directory. If you want to avoid the fully qualified class name, you should put an import statement in your source file. For Visual Basic .NET, use imports Microsoft.MetadirectoryServices.Logging. For Visual C# .NET, use using Microsoft.MetadirectoryServices.Logging.
Send comments about this topic to Microsoft
Build date: 2/16/2009