I don't know what the old appender does, in part because I'm not a good
enough programmer to interpret it, and in part because the bulk of what it
does is contained in the source code of the classes that it subclasses, and
I don't have that v1 source code.

One thing I've figured out that it does is override the v1 FileAppender's
setFile() method.  I've also figured out that the v2 FileAppender doesn't
have that method.  So... I don't know what to do about that.

Joel

On Fri, Aug 12, 2022 at 7:18 PM Gary Gregory <garydgreg...@gmail.com> wrote:

> Joel,
>
> Is it possible to use Log4j 2's much richer feature set as is? Perhaps you
> could explain what is it your old appender does that requires custom code.
>
> Gary
>
> On Fri, Aug 12, 2022, 15:35 Joel Griffith <jgrif...@nd.edu> wrote:
>
> > I have a Java application containing a package written to use Log4j v1.
> I
> > am struggling to update this package to use Log4j v2 to remediate its
> > security vulnerabilities.
> >
> > The package contains a custom Appender that subclasses Log4j v1's
> > FileAppender.  I am stumped at how to convert this file to Log4j v2.  In
> > Log4j v2, the FileAppender class is 'final' and cannot be subclassed, so
> I
> > cannot create a new version of the custom Appender that mirrors the
> first.
> > More importantly, perhaps, is that the Log4j v2 FileAppender is a Plugin
> > and completely different in structure from the Log4j v1 FileAppender.
> >
> > I found this page that ostensibly explains how to extend Log4j:
> > https://logging.apache.org/log4j/2.x/manual/extending.html#Appenders
> > but it contains no information about actually extending Appenders or
> > procedures for accomplishing an equivalent goal.
> >
> > Is there any reasonable way of converting this custom Appender from Log4j
> > v1 to v2?
> >
> > Thanks,
> > Joel
> >
>

Reply via email to