If the log4j flume jar is in the class path it should automatically be included as it has its own Log4j2Plugin.dat file. However, you can always manually cause plugins to be located by specifying the packages attribute - see http://logging.apache.org/log4j/2.x/manual/configuration.html#XML.
Again though, if it is not automatically finding the Flume Appender then there is either something wrong in your configuration or the log4j-flume-ng jar is not in the classpath. I’m curious though - when you say “when I build” what exactly are you building? You cannot build a new jar that includes the contents of log4j-core.jar and the contents of other jars that also have plugins as each has their own Log4j2Plugin.dat and only one of them will wind up in your new jar. To do that, yes you would have to run the PluginManager against the contents of your new jar to generate your own custom Log4j2Plugin.dat. However, doing that is not recommended. We recommend that you leave the Log4j jars alone and include them in your classpath. Ralph On Mar 21, 2014, at 12:30 PM, Zabicki Roman (HERE/Chicago) <[email protected]> wrote: > Hi, > > I want to use a non-core appender with log4j2. In particular, I want to use > the apache flume appender. > (http://logging.apache.org/log4j/2.x/log4j-flume-ng/) > > When I build, I wind up with the Log4j2Plugins.dat from log4j, which doesn't > have support for the flume appender, so I can't register the flume appender > in my log4j2.xml. It seems that there's no way to register custom appender > classes just via log4j2.xml, and instead I have to use PluginManager to > register the \org\apache\logging\log4j\core\config\plugins\Log4j2Plugin.dat. > I can't find any examples of how to do this, let alone examples of how to > automate this in a build. > > Is it possible to register a custom appender class solely through log4j2.xml, > or do I need to go through the PluginManager? Whatever the answer, can > someone show me an example? I'm particularly interested in how to automate > this in a build. > > > Thanks, > Roman > >
