NLog FileTarget Example
NLog FileTarget Example
How can i do to use a NLOG FileTarget instead of native FileLogger of library? The example in demo.zip shows only consolelog.
Re: NLog FileTarget Example
Please have a look at the sample project https://gitlab.com/inetlab/smpp-samples ... ngWithNLog
Re: NLog FileTarget Example
I tryed to convert that sample with consolelog demo to work with filetarget but it does not workalt wrote: Tue Oct 20, 2020 8:31 pm Please have a look at the sample project https://gitlab.com/inetlab/smpp-samples ... ngWithNLog
when i start the server that call the public class NLogLoggerFactory with loggerName "SmppServer1" instead of "logSMPP"
========= My Code =========
Dim configuration As New LoggingConfiguration()
Dim fileTarget As Target = NLog.LogManager.Configuration.FindTargetByName("logSMPP")
configuration.AddTarget(fileTarget)
NLog.LogManager.Configuration = configuration
LogManager.SetLoggerFactory(New NLogLoggerFactory())
========= My Nlog.config ===========
<rules>
<logger name="logSMPP" minlevel="Trace" writeTo="logSMPP" />
</rules>
<targets async="true" >
<target xsi:type="File" name="logSMPP" fileName="C:\LOG\${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
</targets>
Re: NLog FileTarget Example
I think you can tell NLog to write all log events for SmppServer this way:
<logger name="SmppServer*" minlevel="Trace" writeTo="logSMPP" />
The logger name for the library instances you can change with properties SmppServer.Name or SmppClient.Name
<logger name="SmppServer*" minlevel="Trace" writeTo="logSMPP" />
The logger name for the library instances you can change with properties SmppServer.Name or SmppClient.Name