Logging in NetServer
NetServer has switched from using a baked-into-the-code logger to using an extensible plugin system of ILogger based loggers.
The old logger now lives in SuperOffice.Logging.dll but you can remove it, replace it, or add more loggers alongside it.
All the logger plugins are used - there is no preferential treatment among the ILoggers.
For web applications, ASP.NET will load all the DLLs in the bin folder automatically.
For console applications, you will need to add the plugins to the <DynamicLoad>
section or add explicit references to
make sure the DLLs are loaded and found by the class factory.
<Factory>
<DynamicLoad>
<add key="Logging" value="SuperOffice.Logging.dll" />
</DynamicLoad>
</Factory>
Configuration
NetServer uses its own Diagnostics config section to determine what information to send to the ILoggers.
<Diagnostics>
<add key="LogWarning" value="false" />
</Diagnostics>
With the above section, your logger plugin will not see any warnings, no matter what you specify in the logger's configuration.
Log levels
The NetServer config supports the following log levels, in descending order:
- Error
- Warning
- Information
- Debug
- Trace
These can be turned on or off individually:
<Diagnostics>
<add key="LogError" value="true" />
<add key="LogWarning" value="false" />
<add key="LogInformation" value="false" />
<add key="LogDebug" value="true" />
<add key="LogTrace" value="false" />
</Diagnostics>
This will log Error and Debug messages, but not Warning, Information, or Trace messages.
Tip
You can also filter the logs.