You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Benjamin Jaton <be...@gmail.com> on 2016/06/29 22:00:20 UTC

Sharing common log4j2 configuration

Hello again,

Is there a way to define a set appenders/logger/props and use them in
several log4j2 configuration files?

Like:
I define sub-conf C
Then I create conf A that "imports" C,
and conf B that "imports" C as well.

I know about x:include (https://issues.apache.org/jira/browse/LOG4J2-341),
I was wondering if there were anything like it for JSON?

If not, would that be something that can be done programmatically?

Thanks,
Ben

Re: Sharing common log4j2 configuration

Posted by Benjamin Jaton <be...@gmail.com>.
That is great!
I had to update my custom ConfigurationFactory to create those
CompositeConfiguration but once I did it seems to work well, thanks!

On Wed, Jun 29, 2016 at 4:01 PM, Ralph Goers <ra...@dslextreme.com>
wrote:

> Log4j 2.6.1 supports composite configurations.  See
> http://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration
> .
>
> Ralph
>
> > On Jun 29, 2016, at 3:00 PM, Benjamin Jaton <be...@gmail.com>
> wrote:
> >
> > Hello again,
> >
> > Is there a way to define a set appenders/logger/props and use them in
> > several log4j2 configuration files?
> >
> > Like:
> > I define sub-conf C
> > Then I create conf A that "imports" C,
> > and conf B that "imports" C as well.
> >
> > I know about x:include (https://issues.apache.org/jira/browse/LOG4J2-341
> ),
> > I was wondering if there were anything like it for JSON?
> >
> > If not, would that be something that can be done programmatically?
> >
> > Thanks,
> > Ben
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

Re: Sharing common log4j2 configuration

Posted by Ralph Goers <ra...@dslextreme.com>.
Log4j 2.6.1 supports composite configurations.  See http://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration.

Ralph

> On Jun 29, 2016, at 3:00 PM, Benjamin Jaton <be...@gmail.com> wrote:
> 
> Hello again,
> 
> Is there a way to define a set appenders/logger/props and use them in
> several log4j2 configuration files?
> 
> Like:
> I define sub-conf C
> Then I create conf A that "imports" C,
> and conf B that "imports" C as well.
> 
> I know about x:include (https://issues.apache.org/jira/browse/LOG4J2-341),
> I was wondering if there were anything like it for JSON?
> 
> If not, would that be something that can be done programmatically?
> 
> Thanks,
> Ben



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