2017-07-26 27 views

答えて

1

はこれを試してみてください:${type:key:-defaultValue}

<Root level="${jndi:yourJndiVariableName:-DEFAULT}"> 

一般的に、すべてのLog4j2ルックアップは、このパターンに従ってください。

0

はい:これはデフォルトのプロパティマップを使用して行うことができます。

<Configuration status="DEBUG" name="Example"> 
    <Properties> 
     <Property name="yourJndiVariableName"> 
      the value used if the JNDI variable cannot be found 
     </Property> 
    </Properties> 

    ... more configuration ... 

    <Loggers> 
     <Root level="${jndi:yourJndiVariableName}"> 
      <AppenderRef ref="console"/> 
     </Root> 
    </Loggers> 

    ... more configuration ... 
</Configuration> 

According to the Log4J 2 configuration documentation for property substitution、これはまた、(例えばなどの環境変数、システムプロパティ、など)その他の財産上の起源のために動作します。

関連する問題