I have a configuration below and a relational operator '<' seems to be not escaped because it outputs error XML element is not closed
. In documentation they have an example with '<=', which doesn't work too. What's interesting, '>' works fine. Am I missing something?
<logger name="*" minlevel="Trace" writeTo="logFile">
<filters>
<when condition="contains('${logger}','Domain.Messaging.') and level < LogLevel.Warn" action="Ignore" />
</filters>
</logger>
Am I missing something?
Yup, you're not taking into account that this is XML, where <
needs to be escaped. You want:
<logger name="*" minlevel="Trace" writeTo="logFile">
<filters>
<when condition="contains('${logger}','Domain.Messaging.') and level < LogLevel.Warn" action="Ignore" />
</filters>
</logger>
From section 2.4 of the XML 1.0 specification:
The ampersand character (
&
) and the left angle bracket (<
) must not appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they must be escaped using either numeric character references or the strings&
and<
respectively.
See more on this question at Stackoverflow