The syntax for patterns accepted by [`PatternLayoutEncoder`](http://logback.qos.ch/apidocs/ch/qos/logback/classic/encoder/PatternLayoutEncoder.html) is partially specified in [the "layouts documentation](http://logback.qos.ch/manual/layouts.html), where it says
> In PatternLayout, parenthesis can be used to group conversion patterns. It follows that the '(' and ')' carry special meaning and need to be escaped if intended to be used as literals.
> ...
> % character has special meaning ... in order to include it as a literal, it needs to be escaped with a backslash, e.g. "%d %p % %m%n".
However, it says nothing about the characters `
{` and `}
`. I wish to write a pattern which will output a literal open brace character. To this end I have tried, in my `logback.xml`:
<encoder>
<pattern>{</pattern>
</encoder>
This causes Logback to fail with a `NullPointerException` when parsing the configuration file.
Then, by analogy with the escape character for the literal characters `%`, `(`, and `)`, I have tried:
<encoder>
<pattern>{</pattern>
</encoder>
This causes Logback to fail in the same way.
Presumably the `NullPointerException` is a bug in Logback. How do I work around it and output a literal brace character?
|