Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

&& (logical and) and || (logical or) operators in Logback configuration (if statement)

I am having trouble with multiples condition in IF statement into logback-spring.xml configuration file.

I have a condition for example condition='isDefined("SOME_PROP_1")' and another one condition='isDefined("SOME_PROP_2")'.

So as you can all asume by now I want to use those two condition in ONE if statement like this:

<if condition='isDefined("SOME_PROP_1") && isDefined("SOME_PROP_2")'>
   ...
</if>

OR

<if condition='isDefined("SOME_PROP_1") || isDefined("SOME_PROP_2")'>
   ...
</if>

Now the logical or works but the logical and does not because the & symbol is preserved. Does someone is aware how the logical and operator looks like in logback configuration ?

like image 705
Lazar Lazarov Avatar asked Jan 30 '17 15:01

Lazar Lazarov


1 Answers

Well you need to change your && to &amp;&amp;
Because:

In HTML, the ampersand character (“&”) declares the beginning of an entity reference (a special character). If you want one to appear in text on a web page you should use the encoded named entity &amp;

Hope it helped you

like image 57
Gatusko Avatar answered Nov 03 '22 09:11

Gatusko