Type Bug
NLog.Web.AspNetCore version: 4.5.3
NLog.Extensions.Logging version: 1.0.1
Platform: .NET Core 2
Current NLog config (xml)
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Warn"
internalLogFile="nlog_internal.log">
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
<targets>
<target xsi:type="Console"
name="Console"
layout="${message}" />
<target name="Mail"
to="#{emailTo}"
from="#{emailFrom}"
html="false"
subject="Hercules Web Services Error - #{Octopus.Environment.Name} - ${logger}"
body="${message}"
smtpUsername="#{smtpUsername}"
smtpPassword="#{smtpPassword}"
Encoding="UTF-8"
smtpAuthentication="Basic"
enableSsl="#{enableSsl}"
smtpServer="#{smtpServer}"
smtpPort="#{smtpPort}" />
<target name="WebServicesLogFile"
xsi:type="File"
fileName="#{WebServices.Logging.Root}\WebServicesLogFile_${shortdate}.log"
layout="${longdate} ${level:uppercase=true} ${threadid} ${logger} - ${message}"
keepFileOpen="true"
encoding="utf-8"
maxArchiveFiles="4"
archiveAboveSize="10240"
archiveEvery="Day"/>
<target name="OrderServiceLogFile"
xsi:type="File"
fileName="#{WebServices.Logging.Root}\OrderServiceLogFile_${shortdate}.log"
layout="${longdate}|${logger}|${uppercase:${level}}|${message} ${exception}"
keepFileOpen="true"
encoding="utf-8"
maxArchiveFiles="4"
archiveAboveSize="10240"
archiveEvery="Day"/>
</targets>
<rules>
<logger name="WebServicesLog" minlevel="Info" writeTo="WebServicesLogFile" />
<logger name="OrderServiceLog" minlevel="Info" writeTo="OrderServiceLogFile" />
<logger name="*" minlevel="Error" writeTo="Mail" />
<logger name="*" minlevel="Info" writeTo="Console" />
</rules>
</nlog>
#{WebServices.Logging.Root} are replaced by Octopus with a valid path.
Current result, target filename for log files when containing braces in the path causes a log file name to be written incorrectly. So a filename of C:\Logs\UAT (Testing)\Debuglog.log will be written as C:\Logs\UAT (Testing).
Expected result, target filename should accept valid filename characters in the path so that a filename of C:\Logs\UAT (Testing)\Debuglog.log will be written as C:\Logs\UAT (Testing)\Debuglog.log.
Changing the path in the config to C:\Logs\Debuglog.log allows the correect log file to be written.
Type Bug
NLog.Web.AspNetCore version: 4.5.3
NLog.Extensions.Logging version: 1.0.1
Platform: .NET Core 2
Current NLog config (xml)
#{WebServices.Logging.Root}are replaced by Octopus with a valid path.Current result, target filename for log files when containing braces in the path causes a log file name to be written incorrectly. So a filename of C:\Logs\UAT (Testing)\Debuglog.log will be written as C:\Logs\UAT (Testing).
Expected result, target filename should accept valid filename characters in the path so that a filename of C:\Logs\UAT (Testing)\Debuglog.log will be written as C:\Logs\UAT (Testing)\Debuglog.log.
Changing the path in the config to C:\Logs\Debuglog.log allows the correect log file to be written.