Using system environment variables in log4j xml configuration

前端 未结 5 1783
暖寄归人
暖寄归人 2020-11-30 00:59

Is it possible to reference system environment variables (as opposed to Java system properties) in a log4j xml configuration file?

I\'d like to be able to do somethi

5条回答
  •  暖寄归人
    2020-11-30 01:33

    I tried to do that recently and couldn't get it to work. What I ended up doing is sending a variable at startup. So say you have an environment variable called $LOG_LEVEL:

    
    

    and at startup...

    java -Dlog_level=$LOG_LEVEL your_app
    

提交回复
热议问题