2017-02-21 11 views
1

ログバック設定でjanino条件文を使用しようとしていますが、 "if"と "else"でうまく動作しています。しかし、 "else if"と書くことが可能かどうか質問したいと思いますか?"else if" janinoログバック設定

私の場合 -

<if condition='p("log.environment").equals("prod")'> 
    <then> 
     <include file="${LOG_CONFIG_DIR}/logback-prod.xml" /> 
    </then> 
</if> 

<if condition='p("log.environment").equals("uat")'> 
    <then> 
     <include file="${LOG_CONFIG_DIR}/logback-uat.xml" /> 
    </then> 
</if> 

<if condition='p("log.environment").equals("dev")'> 
    <then> 
     <include file="${LOG_CONFIG_DIR}/logback-dev.xml" /> 
    </then> 
</if> 

答えて

1

あなたは、このように行うようにしてくださいマルチレベル

<if condition='p("log.environment").equals("prod")'> 
    <then> 
     <include file="${LOG_CONFIG_DIR}/logback-prod.xml" /> 
    </then> 
    <if condition='p("log.environment").equals("uat")'> 
     <then> 
      <include file="${LOG_CONFIG_DIR}/logback-uat.xml" /> 
     </then> 
     <else> 
      <include file="${LOG_CONFIG_DIR}/logback-dev.xml" /> 
     </else> 
    </if> 
</if> 
0

if-then-elseを使用することができます。

<if condition=''> 
    <then>..</then> 
    <else> 
    <if condition=''> 
     <then>..</then> 
     <else>..</else> 
    </if> 
    </else> 
</if>