Getting Started
Architecture
NServiceBus
Transports
Persistence
ServiceInsight
ServicePulse
ServiceControl
Monitoring
Modernization
Samples

Default Logging

Component: NServiceBus
NuGet Package: NServiceBus (10-pre)
This page targets a pre-release version. Pre-releases are subject to change and samples are not guaranteed to be fully functional.

Introduction

This sample shows the default logging functionality in NServiceBus.

Verifying that the sample works correctly

Inside the [path_to_the_sample]\bin\[Debug/Release] directory should be created a log file called nsb_log_[current_date]_0.

Enabling Logging

var defaultFactory = NServiceBus.Logging.LogManager.Use<NServiceBus.Logging.DefaultFactory>();

// Log directory - current folder for this example
defaultFactory.Directory(".");

// Default log level is Info
defaultFactory.Level(NServiceBus.Logging.LogLevel.Debug);

Related Articles