7.2 Log4Net
You can use the Log4Net method of configuring logging for the following components:
-
Notifications.Net
-
MyIDMailer
When you switch on logging, it generates log information for all of the above components. You cannot decide to log individual components.
To set up logging for these components, copy the following into a text file called Log.Config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="MyIdLogFile" type="log4net.Appender.RollingFileAppender">
<file value="c:\Logs\log.txt" />
<appendToFile value="true" />
<lockingModel type ="log4net.Appender.FileAppender+MinimalLock" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="32Mb" />
<rollingStyle value="Size" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<header value="[Header] "/>
<footer value="[Footer] "/>
<conversionPattern value="%date [%thread] %-5level %logger - %message %newline" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="MyIdLogFile" />
</root>
</log4net>
</configuration>
Copy the file to the Windows System32 folder on the MyID application server.
To change the path of the log file, edit the Log.Config file in an text editor and update the following line:
<file value="c:\Logs\log.txt" />
Note: You must ensure that the MyID named COM user has the necessary permissions to create and write to the log file. You can create a file then give the user write permissions if you prefer not to give the user create permissions.
To disable logging, delete the Log.Config file from your Windows System32 folder.
Note: Switch off logging when it is no longer needed, or you could end up with a large amount of files. The maximumFileSize option determines the maximum file size, but the logging will create additional files when this limit is reached.
It is important to note that this logging generates entries from all MyID components that use this form of logging.