Prabhakaran Rajagopal
Prabhakaran Rajagopal

Reputation: 703

Disable nlog logging in PostSharp 5.x

Logging in NLog can be disabled with LogManager.DisableLogging();

With PostSharp+NLog combination how do I do it?

Upvotes: 2

Views: 176

Answers (1)

Enabling and disabling PostSharp logging is described in detail at http://doc.postsharp.net/log-enabling.

In short, you have two options:

1) Disable logging via the PostSharp API for a specific logging role and namespace, for example

LoggingServices.DefaultBackend.GetSource(LoggingRoles.Tracing, MyCompany.BusinessLayer").SetLevel(LogLevel.Debug);

2) Use the logging back-end API.

You may need to do some set-up before using this approach as described in the doc.

However, the LogManager.DisableLogging(); of NLog is recognized by PostSharp out of the box, so you can use this one to disable the logging completely including PostSharp logging.

Upvotes: 1

Related Questions