Re: Minimum requirements for changing log4j.properties -> log4j2.properties

Christopher Schultz <[email protected]>
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <[email protected]>
Matt,

On 12/17/21 09:32, Christopher Schultz wrote:
> On 12/16/21 15:47, Matt Sicker wrote:
>> If you're trying to reuse config files from v1, we have an
>> experimental feature to support those directly in v2 documented here:
>> https://logging.apache.org/log4j/2.x/manual/compatibility.html

[snip]

 > WARN StatusLogger Unable to create File Appender, no file name provided

This is fixed by changing log4j.appender.A1.file to 
log4j.appender.A1.File (change letter-case of the "F").

> INFO StatusLogger No pattern provided for pattern layout, using default 
> pattern

Same here. Change ".pattern" to ".Pattern" and it works as expected.

> Is my configuration missing something or badly-formatted? I'm happy to 
> provide a patch for the component which loads old configuration files to 
> make it work with this kind of configuration, if you can point me in the 
> right direction and I can figure out what's missing.

I'm assuming that reflection is being used, here, for configuration. 
It's strange that the reflection works for some things and not others. 
For example, "log4j.appender.A1.layout.ConversionPattern" requires a 
capital "C" in ConversionPattern, but not in "layout".

I have other configs for the A1 appender that are harder to determine if 
they have taken effect, such as:

log4j.appender.A1.encoding=UTF-8
log4j.appender.A1.append = true

The log4j debug log doesn't say one way or the other which encoding or 
appendability I'm getting on my file.

Quick testing shows that "append=true" is not being respected, so I 
suspect that I will need to UpperCase all of my config settings. If 
log4j 2's compatibility classes could do that automatically, it would be 
a great improvement and help lots of lazy users upgrade more easily.

Thanks!

-chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.