Add generic listener for TraceSources without config file
I want to redirect registration from System.Net to NLog:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<sources>
<source name="System.Net" switchValue="All">
<listeners>
<add name="nlog" />
</listeners>
</source>
<source name="System.Net.Sockets" switchValue="All">
<listeners>
<add name="nlog" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="nlog" type="NLog.NLogTraceListener, NLog" />
</sharedListeners>
</system.diagnostics>
</configuration>
How can I get it to work with code without app.config / web.config files? I cannot use them in Unity3D.
+3
source to share
No one has answered this question yet
See similar questions:
or similar: