Re: Log4j 1.2.x Customer Appender not used as "Plugin" by Log4j 1.2 Bridge

Pablo Rogina <[email protected]>
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <CAL5OxRtdkxgcz_uitrTzUAgO5ump9cQ65uWAVwqWrAyW3vOi-g@mail.gmail.com>
Hi Piotr,

your suggestion did the trick.

I added a CustomAppenderBuilder into the same package of my
CustomAppender based on Log4j2.
So this new CustomAppenderBuilder can parse a Properties object in
Log4j1 syntax and creates CustomAppender v2 via AppenderWrapper (from
the Log4j 1.2 Bridge).

In summary, no changes to the application: it continues using loggers
from v1, keeps using a Properties object with Log4j1 syntax for
configuration, while the actual management of log files is carried on
by Log4j2-based CustomAppender.

Thank you for the assistance!

Regards. Pablo

On Wed, Mar 30, 2022 at 5:44 AM Piotr P. Karwasz
<[email protected]> wrote:
>
> Hello Pablo,
>
> On Tue, 29 Mar 2022 at 19:58, Pablo Rogina <[email protected]> wrote:
> > However this warning appears (application launched with -Dlog4j2.debug=true):
> > WARN StatusLogger Unable to load plugin class name
> > com.mycompany.log4j.CustomAppender with key
> > com.mycompany.log4j.customappender
>
> This is an expected behavior. Most common Log4j 1.x components are
> actually translated into their Log4j 2.x equivalents using
> configuration builder plugins. See [1] for example. If you were using
> "standard" Log4j 1.x components (e.g. org.apache.log4j.FileAppender),
> this warning means that the system is using the real
> org.apache.log4jFileAppender class instead of its Log4j 2.x
> equivalent, which might result in poor performance.
>
> You can actually also write such a builder plugin yourself, if you
> wish to use a Log4j 1.x configuration to start your custom Log4j 2.x
> appender.
>
> Piotr
>
> [1] https://github.com/apache/logging-log4j2/blob/release-2.x/log4j-1.2-api/src/main/java/org/apache/log4j/builders/appender/RollingFileAppenderBuilder.java
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
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.