Logging

ImageVault logging can be configured to use different logging mechanisms. It is abstracted in a separate logging framework that can be configured using the config file. Normally this isn't necessary since every part in ImageVault that utilizes logging, uses the most suitable logger in it's environment.

Configuring

If you need to configure it, this is done using the meriworks.logging section.

Example:

<configSections>
<section name="meriworks.logging" type="ImageVault.Common.Lib.Logging.LogManagerConfigurationSection,ImageVault.Common"/>
</configSections>
<meriworks.logging logManager="MyLogManager.LogManager,MyLogManager">
    <appSettings>
        <add key="ThresholdLevel" value="Debug"/>
    </appSettings>
</meriworks.logging>

logManager

This should point to an implementation of the ILogManager that you would like to use using the "Type,Assembly" syntax.

The following managers exists

Note: There are other specialized implementations available and you can implement your own if need be.

ThresholdValue

This setting controls the level of log messages that are passed to the underlying logManager. The following cumulative (lower levels contains the levels above) levels are supported

  • Critical - errors that will terminate the applicataion
  • Error - Errors and unhandled exceptions.
  • Warn - events that might need some attention.
  • Info - Extra information regarding actions in the system.
  • Debug - Debugging information, can be useful for troubleshooting.
  • Verbose - Extra debugging information, can be useful for troubleshooting (also known as All).

FileLogManager

Defines a simple file log manager that can be configured as below. The only setting is the fileLogPath that points to the file to write the log entries to.

Example:

<configSections>
    <section name="meriworks.logging" type="ImageVault.Common.Lib.Logging.LogManagerConfigurationSection,ImageVault.Common"/>
</configSections>
<meriworks.logging logManager="ImageVault.Common.Lib.Logging.FileLogManager,ImageVault.Common">
    <appSettings>
        <add key="ThresholdLevel" value="Debug"/>
        <add key="fileLogPath" value="c:\temp\mylog.txt"/>
    </appSettings>
</meriworks.logging>
comments powered by Disqus