Now i am doing like this
LogManager.DisableLogging();
But this need to deploy my code again, how can I disable loggin from nlog configuration file.
Now i am doing like this
LogManager.DisableLogging();
But this need to deploy my code again, how can I disable loggin from nlog configuration file.
This may help - In the csproj file, you need to add Condition="'$(Configuration)' == 'Debug'"
where you include NLog.config
Example:
<Project>
...
<ItemGroup>
<Content Include="NLog.config" Condition="'$(Configuration)' == 'Debug'">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
...
</Project>
This way, in release mode it should not log anything because the NLog.config is not included.