You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Pablo Rogina <pa...@gmail.com> on 2022/04/09 21:39:34 UTC

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

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
<pi...@gmail.com> wrote:
>
> Hello Pablo,
>
> On Tue, 29 Mar 2022 at 19:58, Pablo Rogina <pa...@gmail.com> 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: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org