That is interesting. We had an email earlier this week from someone who had a 
log4j2.xml in a jar they couldn’t modify. He called that “EVIL.jar”. That said, 
I could understand including a log4j2-mycomponent.xml that gets merged with the 
application’s logging configuration. If you do that you just then need to know 
the names of the various logging configuration files you want to include.

Note that Log4j allows you to configure the
 to determine whether an Appender should be configured or not.


> On Feb 14, 2018, at 2:49 PM, Benjamin Jaton <> wrote:
> Yes I have been using the composite config feature, it does help.
> It would be nice to be able to configure the logging of a component in the
> component itself, instead of having to add it in the initial logging
> configuration of all the potential applications that might use it.
> In particular if some components are loaded dynamically, we might not know
> in advance what will be used/necessary.
> Also defining appenders "just in case" they might be used is sometimes not
> ideal, as some appenders issue connections requests or create resources on
> creation.
> Benjamin
> On Wed, Feb 7, 2018 at 8:53 PM, Ralph Goers <>
> wrote:
>> Are you saying you want to merge a new configuration with the existing
>> one? Log4j supports a composite configuration but the files that make up
>> the composite have to be known from the beginning.
>> Ralph
>>> On Feb 7, 2018, at 6:22 PM, Benjamin Jaton <>
>> wrote:
>>> I am specifically asking about how to feed that conf in the log4j2
>> engine,
>>> are there methods to enrich the existing log4j2 appenders/loggers?
>>> On Wed, Feb 7, 2018 at 4:37 PM, Matt Sicker <> wrote:
>>>> You could potentially use JNDI to load and store your configuration if
>>>> using Java EE. Otherwise, you could also set the config file name system
>>>> property to locate a common config file (at least through the local file
>>>> system or class path).
>>>> On Wed, Feb 7, 2018 at 18:01, Benjamin Jaton <>
>>>> wrote:
>>>>> Hello,
>>>>> I would like to have a piece of code use Log4J2 to log events in a CSV
>>>>> format. So the appender and logger configuration are specific to this
>>>> task.
>>>>> The problem is that there are several JVMs that might invoke this task
>>>> (not
>>>>> at the same time though). Therefore I would think that each of those
>> JVMs
>>>>> need to have the same definition of logger+appender in their log4j2
>> conf.
>>>>> Is there a way to load a log4j2 file on demand that would make the
>>>>> appenders/loggers in it available? (without breaking the existing ones)
>>>>> Or maybe you will think of a better way to do this?
>>>>> Note: I am using JSON to configure log4j2.
>>>>> Thanks,
>>>>> Benjamin
>>>> --
>>>> Matt Sicker <>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

Reply via email to