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

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

Reply via email to