title: Log4j configuration: how to use environment variable in yaml configuration file log4j2.yaml
body: <p>I'm trying to configure the log system of an application running on Tomcat, and I would like it to log under $CATALINA_HOME/logs without hardcoding the path.
  In doing so I created this configuration file log4j2.yaml:</p>
  
  <pre><code>Configuration:
    name: Default
    Properties:
      Property:
        name: log-path
        value: "/opt/apache-tomcat-8.5.15/logs"
    Appenders:
      Console:
        name: Console_Appender
        target: SYSTEM_OUT
        PatternLayout:
          pattern: "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"
      File:
        name: File_Appender
        fileName: ${log-path}/logfile.log
        PatternLayout:
          pattern: "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"
    Loggers:
      Root:
        level: error
        AppenderRef:
          - ref: Console_Appender
      Logger:
        - name: myname
          level: debug
          AppenderRef:
            - ref: File_Appender
  </code></pre>
  
  <p>and this actually works. I would like to substitute /opt/apache-tomcat-8.5.15 with the environment variable CATALINA_HOME. What is the syntax to achieve this?</p>