-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Milestone
Description
Hi! Thanks for reporting this bug!
Please keep / fill in the relevant info from this template so that we can help you as best as possible.
**NLog version 6.0
Platform: .NET8
Current NLog config (xml or C#, if relevant)
<wrapper-target name="buffer" xsi:type="BufferingWrapper" bufferSize="50" overflowAction="Flush" flushTimeout="1000">
<wrapper-target xsi:type="PostFilteringWrapper">
<defaultFilter>level >= LogLevel.Warn</defaultFilter>
<when exists="level >= LogLevel.Warn" filter="level >= LogLevel.Trace" />
<target xsi:type="File" fileName="${var:logDirectory}/${var:LogFileName}Exception.log"
layout="${longdate}|${threadid}|${myuniqueId}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}"
archiveFileName="${var:logDirectory}/${var:LogFileName}Exception.{########}.log"
archiveEvery="Day"
archiveNumbering="Date"
archiveDateFormat="yyyyMMdd"
maxArchiveFiles="3"
concurrentWrites="true"
keepFileOpen="false"
/>
</wrapper-target>
</wrapper-target>The configuration shown above parses just fine under 5.4. When I moved to 6.0, I started receiving the following message in the internal log file.
2025-06-27 11:14:52.7056 Error Error when including 'NLogCommon.config'. Exception: NLog.Config.XmlParserException: Invalid XML document. Cannot parse value with '>' - Start-tag: defaultFilter - Line: 31
at NLog.Internal.XmlParser.LoadDocument(IList`1& processingInstructions)
at NLog.Config.XmlLoggingConfiguration.IncludeNewConfigFile(String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.ParseIncludeElement(ILoggingConfigurationElement includeElement, String baseDirectory, Boolean autoReloadDefault)
2025-06-27 11:14:52.7990 Error Exception when loading configuration D:\src\...\bin\Debug\net8.0\NLog.config Exception: NLog.NLogConfigurationException: Error when including 'NLogCommon.config'.
---> NLog.Config.XmlParserException: Invalid XML document. Cannot parse value with '>' - Start-tag: defaultFilter - Line: 31
at NLog.Internal.XmlParser.LoadDocument(IList`1& processingInstructions)
at NLog.Config.XmlLoggingConfiguration.IncludeNewConfigFile(String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.ParseIncludeElement(ILoggingConfigurationElement includeElement, String baseDirectory, Boolean autoReloadDefault)
--- End of inner exception stack trace ---
at NLog.Config.XmlLoggingConfiguration.ParseIncludeElement(ILoggingConfigurationElement includeElement, String baseDirectory, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.ParseNLogSection(ILoggingConfigurationElement configSection)
at NLog.Config.LoggingConfigurationParser.LoadConfig(ILoggingConfigurationElement nlogConfig, String basePath)
at NLog.Config.XmlLoggingConfiguration.ParseNLogElement(ILoggingConfigurationElement nlogElement, String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.ParseTopLevel(ILoggingConfigurationElement content, String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.ParseFromTextReader(TextReader textReader, String filePath)
2025-06-27 11:14:52.7990 Warn Error has been raised. Exception: NLog.NLogConfigurationException: Exception when loading configuration D:\src\...\bin\Debug\net8.0\NLog.config
---> NLog.NLogConfigurationException: Error when including 'NLogCommon.config'.
---> NLog.Config.XmlParserException: Invalid XML document. Cannot parse value with '>' - Start-tag: defaultFilter - Line: 31
at NLog.Internal.XmlParser.LoadDocument(IList`1& processingInstructions)
at NLog.Config.XmlLoggingConfiguration.IncludeNewConfigFile(String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.ParseIncludeElement(ILoggingConfigurationElement includeElement, String baseDirectory, Boolean autoReloadDefault)
--- End of inner exception stack trace ---
at NLog.Config.XmlLoggingConfiguration.ParseIncludeElement(ILoggingConfigurationElement includeElement, String baseDirectory, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.ParseNLogSection(ILoggingConfigurationElement configSection)
at NLog.Config.LoggingConfigurationParser.LoadConfig(ILoggingConfigurationElement nlogConfig, String basePath)
at NLog.Config.XmlLoggingConfiguration.ParseNLogElement(ILoggingConfigurationElement nlogElement, String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.ParseTopLevel(ILoggingConfigurationElement content, String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.ParseFromTextReader(TextReader textReader, String filePath)
--- End of inner exception stack trace ---
at NLog.Config.XmlLoggingConfiguration.ParseFromTextReader(TextReader textReader, String filePath)
at NLog.Config.XmlLoggingConfiguration..ctor(TextReader xmlSource, String filePath, LogFactory logFactory)
at NLog.Config.LoggingConfigurationFileLoader.LoadXmlLoggingConfigurationFile(LogFactory logFactory, String configFile)
Note: I edited the path from the exception.
This is the line that the parse fails on.
<defaultFilter>level >= LogLevel.Warn</defaultFilter>I expected everything to work the same since this config has not changed.
I was unable to find a work around.
Thanks