Detailed application event information from InRule can be logged to the Windows Application Event Log by configuring the following section in a client config file:
<configuration>
<configSections>
<section name="inrule.logging" type="InRule.Repository.Logging.Configuration.LoggingSectionHandler, InRule.Repository" />
...
</configSections>
...
<inrule.logging>
<group typeName="InRule.Repository.Logging.Loggers.LoggerGroup, InRule.Repository" level="Warn">
<logger (see below)/>
</group>
</inrule.logging>
Group level settings can be one of: Debug, Info, Warn, Error, Fatal
Logger level settings:
Group level settings for all loggers can be set with AppSettings:
<appSettings>
<add key="inrule:logging:level" value="Warn">
</appSettings>
Adding this setting will override all level settings for loggers.
Logger type settings:
- EventLogLogger - records to the InRule event log. If the eventSource value is not specified, it uses the InRule source.
<logger typeName="InRule.Repository.Logging.Loggers.EventLogLogger, InRule.Repository" >
<option name="eventSource" value="InRule" />
</logger> - FileLogger - records to a file. If "filename" option is not specified, it records to %TEMP%\InRuleFileLoggerLogs. FileLogger has the following parameters
<logger typeName="InRule.Repository.Logging.Loggers.FileLogger, InRule.Repository">
<option name="filename" value="%TEMP%\YourApp.log"/>
</logger>
- XmlLogger is also available as an alternative to FileLogger
- LibraryLogger - allows logging of application event information from InRule to 3rd party loggers including: Log4Net, Loupe, NLog and Serilog.
<inrule.logging>
<group typeName="InRule.Repository.Logging.Loggers.LoggerGroup, InRule.Repository" level="Warn">
<logger typeName="InRule.Repository.Logging.Loggers.LibraryLogger, InRule.Repository" />
</group>
</inrule.logging>
Notes
- For production SDK app deployments, an EventLogLogger is automatically created and used (if no inrule.logging config entries present) if the InRule event log source(s) are registered, otherwise a FileLogger is created and used to the default logfile location above.
- InRule event logging should not be confused with RuleExecutionLog which returns rule execution information in a rule session.
- A setting of Debug should only be used for true debugging scenarios as it can slow overall performance with the amount of information returned
Diagnostic settings for WCF Logging
If a WCF issue is suspected with an InRule service, WCF tracing is available to further diagnose communication issues. WCF tracing is built on top of System.Diagnostics, which provides classes that allow you to interact with system processes, event logs,and performance counters. WCF tracing can be configured using the following config file settings.
Note: This should only be used for debugging as it can significantly reduce performance.
Example:
<configuration>
...
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
...
</configuration>
irAuthor activity logging settings
An audit trail of user activities can be captured while authoring rules inside of irAuthor. This logging information can be used in order to provide information to InRule in the case of an error situation. The following settings can be used to configure how the logging will be managed. Log files are stored in the system defined temp directory on the author's machine.
Example:
<configuration>
<configSections>
<section name="inrule.authoring" type="InRule.Authoring.Configuration.AuthoringConfigSectionHandler, InRule.Authoring.UI" />
...
</configSections>
...
<inrule.authoring>
<tracing logFileCleanUpInterval="30.00:00:00" />
</inrule.authoring>
...
</configuration>
Info level logging SDK configuration
There are three types of Info level log messages that can be emitted from the RuleSession:
- CreateEntity
- CreateDecision
- ExecuteRules
These types can be configured at a granular level via the RuleSession.Settings.InfoLevelLogging property. This is a [Flags] enum type so multiple combinations may be applied as needed.
If Info level logging is enabled in the .config file, then all three will be applied by default. If a lower level logging is enabled (e.g. Warn, Error), then none of them will be applied by default.
The granular types may be added/removed regardless of the setting in the .config file.
Example showing how to remove CreateEntity logging and only include ExecuteRules logging if Info level logging is enabled in the .config:
(Note the ^= operator removes the proceeding enum value if it exists in the current property value)
using (var session = new RuleSession(ra))
{
session.Settings.InfoLevelLoggingTypes ^= InfoLevelLoggingTypes.CreateEntity;
var invoice = session.CreateEntity("Invoice");
session.ApplyRules();
}
Example showing how to add ExecuteRules logging if Info level logging is disabled in the .config:
(Note the |= operator adds the proceeding enum value if it does not exist in the current property value)
using (var session = new RuleSession(ra))
{
session.Settings.InfoLevelLoggingTypes |= InfoLevelLoggingTypes.ExecuteRules;
var invoice = session.CreateEntity("Invoice");
session.ApplyRules();
}
Comments
0 comments
Please sign in to leave a comment.