Hi all,

I have some concerns at the naming strategy of per-context properties
files documented in:

https://logging.apache.org/log4j/3.x/manual/systemproperties

The naming of the properties files seems dangerously close to that of
configuration files:

* configuration files are named `log4j2<context-name>.json` (no
separator between 'log4j2' and the context name),
* property files are named `META-INF/log4j2.<context-name>.json`.

Another problem I find with this convention is that the
`<context-name>` has no restriction on the characters used. In a
Servlet environment the context name is often the same as the context
path[1] and therefore starts with a `/`, so we end up with:

 * log4j2/my-app.json for the configuration,
 * META-INF/log4j2./my-app.json

Correct me if I am wrong, but folder names ending with a dot '.' are
not allowed on Windows.

How could we correct that?

## Draft proposal

We could place:

* the default configuration file in `META-INF/log4j/Configuration.<extension>`,
* the default properties file in `META-INF/log4j/properties.<extension>`,
* the context-specific configuration file in
`META-INF/log4j/Configuration/<context-name>.<extension> and modify
`log4j-jakarta-web` to user Tomcat's naming convention[2]. A logger
context for an application with context path `/my/context/path` would
be named `my#context#path`, while a logger context for the root
application `ROOT`.
* the context-specific properties file in
`META-INF/log4j/properties/<context-name>.<extension>`.

Piotr

[1] 
https://jakarta.ee/specifications/servlet/6.0/apidocs/jakarta.servlet/jakarta/servlet/servletcontext#getContextPath()
[2] https://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Naming

Reply via email to