Hi,
I have a Class Library project in VB.NET but I can't get NLog writting logs to a file. Same configuration works ok for a Console application. Additional config for Class Library is required?
The NLog config file is:
<?xml version="1.0" encoding="utf-8" ?>
<!--
This file needs to be put in the application directory. Make sure to set
'Copy to Output Directory' option in Visual Studio.
-->
<nlog xmlns="
http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="file" xsi:type="File" fileName="${basedir}/log.txt"
layout="${longdate}|${level:uppercase=true}|${logger}|${message}" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="file" />
</rules>
</nlog>
The file has the option "Copy to output directory" with "Copy always" value.
The use of the library is as:
Private Shared logger As Logger = LogManager.GetCurrentClassLogger()
...
Public Sub ExecuteAction()
logger.Debug("ExecuteAction")
...
End Sub
Thanks in advance,
Jose