Re: Minimum requirements for changing log4j.properties -> log4j2.properties
Gary Gregory <[email protected]>
| Newsgroups | gmane.comp.jakarta.log4j.user |
|---|---|
| Message-ID | <CACZkXPyS9mXc0uBwPtbnoEC9sMPZv5bDQDqecnSmeZqfKKE=mQ@mail.gmail.com> |
Looking briefly at the Log4j 1 source code, it looks like the names of
properties are case-insensitive (".file" is the same as ".File") but
in Log4j 2 we might not be as lenient in the compatibility layer.
Gary
On Fri, Dec 17, 2021 at 11:37 AM Matt Sicker <[email protected]> wrote:
>
> This sounds like a bug to me. Plugin names are supposed to be case-insensitive as they already are in the other log4j2 config file formats. Can you file a Jira for this?
> --
> Matt Sicker
>
> > On Dec 17, 2021, at 09:18, Christopher Schultz <[email protected]> wrote:
> >
> > 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
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>