ppkarwasz commented on issue #3927:
URL:
https://github.com/apache/logging-log4j2/issues/3927#issuecomment-3285236973
Hi @blacklong,
This doesn’t look like a bug. `${web:rootDir}` expands to itself **by
design** if:
* The **`web` lookup** isn’t available (make sure
`log4j-jakarta-web/log4j-web` is on the classpath).
* The lookup returns `null` (e.g. Log4j initializes before the servlet
container, or you’re outside a Servlet environment).
If you want a safe fallback, you can define a default:
```xml
<Properties>
<Property name="rootDir" value="."/>
<Property name="logPath">${web:rootDir}/../data/log</Property>
</Properties>
```
That way, if `web:rootDir` returns `null`, `${rootDir}` is used instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]