문제

I would like to use Postsharp and I'm trying to figure out if it is possible to disable/enable logging with PostSharp at run-time?

In my case, I apply the aspect in the assembly of the project, and compile my project with "Disable PostSharp for this configuration" in PostSharp tab equal to No.

Thanks, Lev

도움이 되었습니까?

해결책

PostSharp weaves in the logging aspects during build-time and you cannot remove this logging code during run-time.

The aspects usually send logging messages to the logging library of your choice (e.g. log4net, nlog). What you can do is to disable the output in that logging library during run-time.

You can find more info in the documentation of the particular logging library, for example:

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top