I have a situation in which I want **Log4J 2** to determine which directory to use for logging. The pseudocode is as follows:

```
property LOG_DIR = "./logs" // default
if (isDIR(${env:LOG_DIR}) {
  LOG_DIR = "${env:LOG_DIR}"
} else if (isDir(${sys:catalina.base}) {
  LOG_DIR = "${sys:catalina.base}/logs"
}

```

The configuration I have for properties (in `log4j2.xml`) is as follows:

```xml
<Configuration status="DEBUG">
  <Properties>
    <Property name="LOG_DIR">${sys:catalina.base}/logs:-logs</Property>
    <Property name="LOG_PATTERN">%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] %t/%c:%L | %m%n</Property>
    <Property name="JAVA_HEADER">${java:version} - ${java:os}</Property>
  </Properties>
  <!-- Other configuration here -->
</configuration>

```

What I think it should look like:

```xml
<!-- Is this permitted? What happens if there's no Catalina Base AND no LOG_DIR env var? -->
<Property name="LOG_DIR">${env:LOG_DIR}:${sys:catalina.base}/logs:-logs</Property>

```

What I'm not sure on is how to get *both* `${env:LOG_DIR}` and `${sys:catalina.base}` options in the `LOG_DIR` property in configuration (before the default of `logs`). Is this even possible without a programmatic solution? (I'd like to avoid a programmatic solution as this config will be a template for multiple projects, some of which are libraries in SE applications. I'd like to avoid including a library that is only for configuring `Log4J`.) As far as I know, there can be only one lookup before the default. I don't know if nesting or chaining is permitted.