Hi Gary,

On 19.11.2024 17:50, Gary D. Gregory wrote:
It seems odd to have a logger name not supported in a configuration file but 
then support it programmatically. Did I misread your suggestion? If that's the 
case, then issuing a warning makes even more sense.

The `error` alias works perfectly in a configuration file. Try replacing your `<Root>` configuration element with something like this:

<Logger name="root" level="INFO">
  <AppenderRef ref="CONSOLE"/>
</Logger>

I don't want to not loose support for "root" (lower-case) in the Log4j 1 
configuration properties bridge since that's a documented feature in 1.x. I still have a 
product that uses 1.x style properties files, and converting converting our installed 
user's product files is not a task anyone wants to do (same for the files in our test 
suites).

I don't seem to understand, what does the Log4j 1 "root" logger have to do with the Log4j Core 2 "root" logger configuration? Isn't the v1 configuration factory supposed to map the "root" logger to the "" logger?

Anyway, your problems should be soon over, since I am actively working on a tool to automatically convert logging configuration files. The first part, which includes a basic API and read-write support for the Log4j Core 2 XML, JSON, YAML and Log4j Core 3 Properties format is already available in apache/logging-log4j-transform#142[1]. It also provides read-only support for the Log4j Core 2 Properties format, but I am not to eager to allow users to convert nice configuration files into a bunch of properties.

My next step will be to add read-only support for the Log4j 1 Properties and XML formats. I will probably start by copy-pasting your excellent `o.a.l.builders` package from the Log4j 1 bridge[2] and adapt it to the task at hand.

Piotr

[1] https://github.com/apache/logging-log4j-transform/pull/142

[2] https://github.com/apache/logging-log4j2/tree/2.x/log4j-1.2-api/src/main/java/org/apache/log4j/builders

Reply via email to