[ 
https://issues.apache.org/jira/browse/LOG4J2-1741?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

PJ Fanning updated LOG4J2-1741:
-------------------------------
    Attachment: log4j2-sample.zip

Attaching log4j2-sample.zip. I'm probably missing something in the custom 
appender but I am getting this exception:

2016-12-19 11:56:54,608 run-main-0 ERROR Unable to invoke factory method in 
class class logtest.KafkaLog4jAppender for element CustomKafka. 
java.lang.IllegalStateException: No factory method found for class 
logtest.KafkaLog4jAppender
        at 
org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:224)


> scala: add support for creating custom plugins
> ----------------------------------------------
>
>                 Key: LOG4J2-1741
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1741
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Plugins
>            Reporter: PJ Fanning
>            Assignee: Mikael Ståldal
>              Labels: scala
>         Attachments: log4j2-sample.zip
>
>
> I tried to add a custom appender using Scala but the pattern of having a 
> class with an Plugin annotation and a static method on that class with a 
> PluginFactory or PluginBuilderFactory annotation doesn't seem to work in 
> Scala.
> In Scala, you can create a companion object to a class where you can 
> implement the equivalent of static methods but these are not the same class 
> under the hood. The Scala compiler builds 2 or more classes, the companion 
> object gets a class name with a $ appended to it. I think this is affecting 
> the lookup for the method with the Factory annotation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to