In the following example, we have also set the app.config
file to use NLog. NServiceBus will support the common logging frameworks, common logging, NLog, Log4Net, and Serilog. Please see http://docs.particular.net/NServiceBus/logging-in-nservicebus for more information.
For NLog, we need to add the Nlog NuGet reference to the project:
We need to set the logging levels and the location of where the logs are being sent to in the app.config
file:
The app.config
file is set in a way similar to most applications, using Nlog.
For a tutorial on NLog, please check out https://github.com/nlog/nlog/wiki/Tutorial. The difference is that there needs to be a section name for NServiceBus to use Nlog, <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
. We also set the local configuration by using SetLoggingLibrary.NLog();
.
From the app.config
file, we are saving a lot of the trace information in the C:\logs\
directory while creating a new file daily with a filename of the current...