Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1741

scala: add support for creating custom plugins

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • Plugins

    Description

      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.

      Attachments

        1. log4j2-sample.zip
          3 kB
          PJ Fanning

        Issue Links

          Activity

            People

              mikaelstaldal Mikael Ståldal
              pj.fanning PJ Fanning
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: