2017-02-21 41 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-then-else в многоуровневом

<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 condition=''> 
    <then>..</then> 
    <else> 
    <if condition=''> 
     <then>..</then> 
     <else>..</else> 
    </if> 
    </else> 
</if>