NLog breaks when using operator '<'

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>
Jon Skeet
people
quotationmark

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 &lt; 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 &amp; and &lt; respectively.

people

See more on this question at Stackoverflow