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 <CAL5OxRuHPTOaRw3RrNfdnjCaZVyeEJ9G9J2GCo-sMzv-3DJ+PQ@mail.gmail.com>
Ralph, thank you for your reply.

> To be usable in your configuration a Log4j 1.2 Appender cannot be a Log4j2 plugin.
Ok. It is not, as my CustomAppender extends RollingFileAppender (from
Log4j v 1.2.x)

> You would configure it exactly as you do in log4j 1.x, via its class name.
Ok. I think it's what I'm doing.
This is the properties I'm using to configure my app logging:
log4j.appender.MYAPPLOGFILE=com.mycompany.log4j.CustomAppender
log4j.appender.MYAPPLOGFILE.Append=false
log4j.appender.MYAPPLOGFILE.SpecialValue=ABC
log4j.appender.MYAPPLOGFILE.HeaderVersion=1
log4j.appender.MYAPPLOGFILE.File=logs/MyApp.log
log4j.appender.MYAPPLOGFILE.MaxBackupIndex=19
log4j.appender.MYAPPLOGFILE.MaxFileSize=2000KB
log4j.appender.MYAPPLOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.MYAPPLOGFILE.layout.ConversionPattern=%d{[dd MMM yyyy
HH\:mm\:ss,SSS]}[%t]\:%-5p\:%l -->%m%n
log4j.rootLogger=INFO, MYAPPLOGFILE

> That said, Do you really need your custom RollingFileAppender? The RollingFileAppender
> in Log4j 2 has many more options than Log4j 1 did.

Well, I also have a CustomAppender for Log4j 2 that resembles a
RollingFileAppender, defined like this:

@Plugin(name = CustomAppender.PLUGIN_NAME, category =
Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE, printObject =
true)
public final class CustomAppender extends
AbstractOutputStreamAppender<RollingFileManager> {
...

however I also got the "Unable to load plugin class name ..." issue if
using the CustomAppender v2.
And I also find difficult to configure it via Properties using the
Log4j 1.2 Bridge

Regards. Pablo
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.