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.

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);

Verifying that the sample works correctly

A log file called nsb_log_[current_date]_0 is created inside the [path_to_the_sample]\bin\[Debug/Release] directory.

Related Articles