How to make log4j2 configurable by environment using spring boot 1.3.6.RELEASE

The properties lookup element allows to refer properties from an external properties file in the log4j configuration. For your example it should be something like this:

  1. A file env.properties contains the following properties:

    log.file.path=/opt/tomcat/logs
    log.file.name=dummydummy
    log.file.size=100 MB
    log.level=DEBUG
    

The properties lookup should be defined as properties of the log4j2.xml:

<Configuration>  
  <Properties>  
      <property name="log.file.path">${bundle:env:log.file.path}</property>  
      <property name="log.file.name">${bundle:env:log.file.name}</property>  
      <property name="log.file.size">${bundle:env:log.file.size}</property>  
      <property name="log.level">${bundle:env:log.level}</property>   
  </Properties>  

Now the properties may be referred in appenders with ${property_name} notation. Each property reference will be interpolated with the real value from the env.properties.

You can find another example of properties lookup here.