gpt4 book ai didi

java - &&(逻辑与)和|| Logback 配置(if 语句)中的(逻辑或)运算符

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:20:08 32 4
gpt4 key购买 nike

我在将 IF 语句中的多个条件写入 logback-spring.xml 配置文件时遇到问题。

我有一个条件,例如 condition='isDefined("SOME_PROP_1")' 和另一个 condition='isDefined("SOME_PROP_2")'

所以你们现在都可以假设我想在一个 if 语句中使用这两个条件,如下所示:

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

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

现在 logical or 有效,但 logical and 无效,因为 & 符号被保留。有人知道 logical and 运算符在 logback 配置中的样子吗?

最佳答案

那么你需要将 && 更改为 &&
因为:

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;

希望对你有帮助

关于java - &&(逻辑与)和|| Logback 配置(if 语句)中的(逻辑或)运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41939861/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com