RE: Copying appenders and loggers from a confgiruation to a builder

2016-11-17 Thread COHEN, STEVEN M
https://issues.apache.org/jira/browse/LOG4J2-1713

Thanks Gary

-Original Message-
From: Gary Gregory [mailto:garydgreg...@gmail.com] 
Sent: Thursday, November 17, 2016 12:49 PM
To: Log4J Users List 
Subject: Re: Copying appenders and loggers from a confgiruation to a builder

You need to click the red text in the "Create" button, not the drop down arrow.

From a high level you want to do something like this:

c1 = load config from XML file 1 (but do not apply the c1 configuration)
c2 = load config from XML file 2 (but do not apply the c2 configuration)
c3 = c1 + c2 (but do not apply the c3 configuration) write c3 to disk

right? sounds reasonable.

Dare I mention... XSL? [Ducks under flying tomatoes.]

Gary

On Thu, Nov 17, 2016 at 9:41 AM, COHEN, STEVEN M  wrote:

> I don't think I'm able to do so.  Although I set up an account on the 
> JIRA and have logged in, the only thing I'm allowed to "Create" is a 
> "Service Desk Request".  There is nothing there about reporting a bug, 
> requesting a feature, etc.
>
> CompositeConfiguration does not help either.  My use case doesn't seem 
> to be supported.  I don't want to programmatically create a 
> configuration.  I want to combine configurations and output the combined 
> config to disk.
> Then that can be passed in as the new configuration.
>
> The only thing that can generate XML is a ConfigurationBuilder.  But 
> there is no way to transfer loaded Configurtations to a Builder nor as 
> there a way to generate XML from a built configuration.
>
> -Original Message-
> From: Gary Gregory [mailto:garydgreg...@gmail.com]
> Sent: Thursday, November 17, 2016 9:52 AM
> To: Log4J Users List 
> Subject: Re: Copying appenders and loggers from a confgiruation to a 
> builder
>
> Please feel free to record your feature request in JIRA:
> https://issues.apache.org/jira/browse/LOG4J2
>
> Gary
>
> On Thu, Nov 17, 2016 at 7:47 AM, COHEN, STEVEN M  wrote:
>
> > Thanks, that almost works for me, and will have to do, I suppose.  
> > The problem is that I was hoping to be able to load each subconfig 
> > in first, filtering in any property definitions, which would then 
> > lead to writable output that would not contain properties, but their 
> > expanded values.  It would seem that with this approach, it would 
> > almost be better to not use properties at all in the subconfigs.
> >
> > I guess this would have to be a feature request, but in the meantime 
> > I might give CompositeConfiguration a try.
> >
> > -Original Message-
> > From: Matt Sicker [mailto:boa...@gmail.com]
> > Sent: Thursday, November 17, 2016 9:34 AM
> > To: Log4J Users List 
> > Subject: Re: Copying appenders and loggers from a confgiruation to a 
> > builder
> >
> > I don't believe there is an API in ConfigurationBuilder that uses 
> > actual plugin objects. That would certainly be a new feature. 
> > However, you did mention combining configuration files which is 
> > already implemented through composite configuration:
> > http://logging.apache.org/log4j/2.x/manual/configuration.html#
> > CompositeConfiguration
> >
> > On 17 November 2016 at 09:29, COHEN, STEVEN M  wrote:
> >
> > > I am trying to construct a program that basically reads a bunch of
> > > log4j2 configuration files and combines them into one, writing 
> > > this back to disk using the new
> > > ConfigurationBuilder.writeXmlConfiguration(OutputStream)
> > > method.
> > >
> > > But I run up against what seems to me to be a gap in the API 
> > > unless I am missing something:
> > > Having created a ConfigurationBuilder for the destination file and 
> > > having read one of the to-be-combined configuration files into a 
> > > Configuration object, there appears to be nothing in the 
> > > ConfigurationBuilder interface that would allow, say, one of the 
> > > appenders from the read-in configuration to be copied, as a whole 
> > > object,into the builder, short of deconstructing it down to its
> > constituent elements and adding them one by one.
> > >
> > > Is there a way to copy an appender from one configuration to 
> > > another without drilling down into all its constituent parts?  And 
> > > similarly, a way to copy a logger from one configuration to 
> > > another without drilling down to its constituent parts?  Or must I 
> > > write all this code
> > myself?
> > >
> > >
> > >
> > > --
> > > --
> > > - To unsubscribe, e-mail: 
> > > log4j-user-unsubscr...@logging.apache.org
> > > For additional commands, e-mail: 
> > > log4j-user-h...@logging.apache.org
> > >
> > >
> >
> >
> > --
> > Matt Sicker 
> >
>
>
>
> --
> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org Java Persistence 
> with Hibernate, Second Edition  

RE: Copying appenders and loggers from a confgiruation to a builder

2016-11-17 Thread COHEN, STEVEN M
Duh!  How did I miss that?

-Original Message-
From: Gary Gregory [mailto:garydgreg...@gmail.com] 
Sent: Thursday, November 17, 2016 12:49 PM
To: Log4J Users List 
Subject: Re: Copying appenders and loggers from a confgiruation to a builder

You need to click the red text in the "Create" button, not the drop down arrow.

From a high level you want to do something like this:

c1 = load config from XML file 1 (but do not apply the c1 configuration)
c2 = load config from XML file 2 (but do not apply the c2 configuration)
c3 = c1 + c2 (but do not apply the c3 configuration) write c3 to disk

right? sounds reasonable.

Dare I mention... XSL? [Ducks under flying tomatoes.]

Gary

On Thu, Nov 17, 2016 at 9:41 AM, COHEN, STEVEN M  wrote:

> I don't think I'm able to do so.  Although I set up an account on the 
> JIRA and have logged in, the only thing I'm allowed to "Create" is a 
> "Service Desk Request".  There is nothing there about reporting a bug, 
> requesting a feature, etc.
>
> CompositeConfiguration does not help either.  My use case doesn't seem 
> to be supported.  I don't want to programmatically create a 
> configuration.  I want to combine configurations and output the combined 
> config to disk.
> Then that can be passed in as the new configuration.
>
> The only thing that can generate XML is a ConfigurationBuilder.  But 
> there is no way to transfer loaded Configurtations to a Builder nor as 
> there a way to generate XML from a built configuration.
>
> -Original Message-
> From: Gary Gregory [mailto:garydgreg...@gmail.com]
> Sent: Thursday, November 17, 2016 9:52 AM
> To: Log4J Users List 
> Subject: Re: Copying appenders and loggers from a confgiruation to a 
> builder
>
> Please feel free to record your feature request in JIRA:
> https://issues.apache.org/jira/browse/LOG4J2
>
> Gary
>
> On Thu, Nov 17, 2016 at 7:47 AM, COHEN, STEVEN M  wrote:
>
> > Thanks, that almost works for me, and will have to do, I suppose.  
> > The problem is that I was hoping to be able to load each subconfig 
> > in first, filtering in any property definitions, which would then 
> > lead to writable output that would not contain properties, but their 
> > expanded values.  It would seem that with this approach, it would 
> > almost be better to not use properties at all in the subconfigs.
> >
> > I guess this would have to be a feature request, but in the meantime 
> > I might give CompositeConfiguration a try.
> >
> > -Original Message-
> > From: Matt Sicker [mailto:boa...@gmail.com]
> > Sent: Thursday, November 17, 2016 9:34 AM
> > To: Log4J Users List 
> > Subject: Re: Copying appenders and loggers from a confgiruation to a 
> > builder
> >
> > I don't believe there is an API in ConfigurationBuilder that uses 
> > actual plugin objects. That would certainly be a new feature. 
> > However, you did mention combining configuration files which is 
> > already implemented through composite configuration:
> > http://logging.apache.org/log4j/2.x/manual/configuration.html#
> > CompositeConfiguration
> >
> > On 17 November 2016 at 09:29, COHEN, STEVEN M  wrote:
> >
> > > I am trying to construct a program that basically reads a bunch of
> > > log4j2 configuration files and combines them into one, writing 
> > > this back to disk using the new
> > > ConfigurationBuilder.writeXmlConfiguration(OutputStream)
> > > method.
> > >
> > > But I run up against what seems to me to be a gap in the API 
> > > unless I am missing something:
> > > Having created a ConfigurationBuilder for the destination file and 
> > > having read one of the to-be-combined configuration files into a 
> > > Configuration object, there appears to be nothing in the 
> > > ConfigurationBuilder interface that would allow, say, one of the 
> > > appenders from the read-in configuration to be copied, as a whole 
> > > object,into the builder, short of deconstructing it down to its
> > constituent elements and adding them one by one.
> > >
> > > Is there a way to copy an appender from one configuration to 
> > > another without drilling down into all its constituent parts?  And 
> > > similarly, a way to copy a logger from one configuration to 
> > > another without drilling down to its constituent parts?  Or must I 
> > > write all this code
> > myself?
> > >
> > >
> > >
> > > --
> > > --
> > > - To unsubscribe, e-mail: 
> > > log4j-user-unsubscr...@logging.apache.org
> > > For additional commands, e-mail: 
> > > log4j-user-h...@logging.apache.org
> > >
> > >
> >
> >
> > --
> > Matt Sicker 
> >
>
>
>
> --
> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org Java Persistence 
> with Hibernate, Second Edition  product/1617290459/ref=as_li_tl?ie=UTF8=1789=
> 

Re: Copying appenders and loggers from a confgiruation to a builder

2016-11-17 Thread Gary Gregory
You need to click the red text in the "Create" button, not the drop down
arrow.

>From a high level you want to do something like this:

c1 = load config from XML file 1 (but do not apply the c1 configuration)
c2 = load config from XML file 2 (but do not apply the c2 configuration)
c3 = c1 + c2 (but do not apply the c3 configuration)
write c3 to disk

right? sounds reasonable.

Dare I mention... XSL? [Ducks under flying tomatoes.]

Gary

On Thu, Nov 17, 2016 at 9:41 AM, COHEN, STEVEN M  wrote:

> I don't think I'm able to do so.  Although I set up an account on the JIRA
> and have logged in, the only thing I'm allowed to "Create" is a "Service
> Desk Request".  There is nothing there about reporting a bug, requesting a
> feature, etc.
>
> CompositeConfiguration does not help either.  My use case doesn't seem to
> be supported.  I don't want to programmatically create a configuration.  I
> want to combine configurations and output the combined config to disk.
> Then that can be passed in as the new configuration.
>
> The only thing that can generate XML is a ConfigurationBuilder.  But there
> is no way to transfer loaded Configurtations to a Builder nor as there a
> way to generate XML from a built configuration.
>
> -Original Message-
> From: Gary Gregory [mailto:garydgreg...@gmail.com]
> Sent: Thursday, November 17, 2016 9:52 AM
> To: Log4J Users List 
> Subject: Re: Copying appenders and loggers from a confgiruation to a
> builder
>
> Please feel free to record your feature request in JIRA:
> https://issues.apache.org/jira/browse/LOG4J2
>
> Gary
>
> On Thu, Nov 17, 2016 at 7:47 AM, COHEN, STEVEN M  wrote:
>
> > Thanks, that almost works for me, and will have to do, I suppose.  The
> > problem is that I was hoping to be able to load each subconfig in
> > first, filtering in any property definitions, which would then lead to
> > writable output that would not contain properties, but their expanded
> > values.  It would seem that with this approach, it would almost be
> > better to not use properties at all in the subconfigs.
> >
> > I guess this would have to be a feature request, but in the meantime I
> > might give CompositeConfiguration a try.
> >
> > -Original Message-
> > From: Matt Sicker [mailto:boa...@gmail.com]
> > Sent: Thursday, November 17, 2016 9:34 AM
> > To: Log4J Users List 
> > Subject: Re: Copying appenders and loggers from a confgiruation to a
> > builder
> >
> > I don't believe there is an API in ConfigurationBuilder that uses
> > actual plugin objects. That would certainly be a new feature. However,
> > you did mention combining configuration files which is already
> > implemented through composite configuration:
> > http://logging.apache.org/log4j/2.x/manual/configuration.html#
> > CompositeConfiguration
> >
> > On 17 November 2016 at 09:29, COHEN, STEVEN M  wrote:
> >
> > > I am trying to construct a program that basically reads a bunch of
> > > log4j2 configuration files and combines them into one, writing this
> > > back to disk using the new
> > > ConfigurationBuilder.writeXmlConfiguration(OutputStream)
> > > method.
> > >
> > > But I run up against what seems to me to be a gap in the API unless
> > > I am missing something:
> > > Having created a ConfigurationBuilder for the destination file and
> > > having read one of the to-be-combined configuration files into a
> > > Configuration object, there appears to be nothing in the
> > > ConfigurationBuilder interface that would allow, say, one of the
> > > appenders from the read-in configuration to be copied, as a whole
> > > object,into the builder, short of deconstructing it down to its
> > constituent elements and adding them one by one.
> > >
> > > Is there a way to copy an appender from one configuration to another
> > > without drilling down into all its constituent parts?  And
> > > similarly, a way to copy a logger from one configuration to another
> > > without drilling down to its constituent parts?  Or must I write all
> > > this code
> > myself?
> > >
> > >
> > >
> > > 
> > > - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> > > For additional commands, e-mail: log4j-user-h...@logging.apache.org
> > >
> > >
> >
> >
> > --
> > Matt Sicker 
> >
>
>
>
> --
> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org Java Persistence
> with Hibernate, Second Edition  product/1617290459/ref=as_li_tl?ie=UTF8=1789=
> 9325=1617290459=as2=garygregory-20=
> cadb800f39946ec62ea2b1af9fe6a2b8>
>
>  1617290459>
> JUnit in Action, Second Edition
>  tl?ie=UTF8=1789=9325=1935182021&
> linkCode=as2=garygregory-20=31ecd1f6b6d1eaf8886ac902a24de418%22
> >
>
> 

RE: Copying appenders and loggers from a confgiruation to a builder

2016-11-17 Thread COHEN, STEVEN M
I don't think I'm able to do so.  Although I set up an account on the JIRA and 
have logged in, the only thing I'm allowed to "Create" is a "Service Desk 
Request".  There is nothing there about reporting a bug, requesting a feature, 
etc.

CompositeConfiguration does not help either.  My use case doesn't seem to be 
supported.  I don't want to programmatically create a configuration.  I want to 
combine configurations and output the combined config to disk.  Then that can 
be passed in as the new configuration.

The only thing that can generate XML is a ConfigurationBuilder.  But there is 
no way to transfer loaded Configurtations to a Builder nor as there a way to 
generate XML from a built configuration.

-Original Message-
From: Gary Gregory [mailto:garydgreg...@gmail.com] 
Sent: Thursday, November 17, 2016 9:52 AM
To: Log4J Users List 
Subject: Re: Copying appenders and loggers from a confgiruation to a builder

Please feel free to record your feature request in JIRA:
https://issues.apache.org/jira/browse/LOG4J2

Gary

On Thu, Nov 17, 2016 at 7:47 AM, COHEN, STEVEN M  wrote:

> Thanks, that almost works for me, and will have to do, I suppose.  The 
> problem is that I was hoping to be able to load each subconfig in 
> first, filtering in any property definitions, which would then lead to 
> writable output that would not contain properties, but their expanded 
> values.  It would seem that with this approach, it would almost be 
> better to not use properties at all in the subconfigs.
>
> I guess this would have to be a feature request, but in the meantime I 
> might give CompositeConfiguration a try.
>
> -Original Message-
> From: Matt Sicker [mailto:boa...@gmail.com]
> Sent: Thursday, November 17, 2016 9:34 AM
> To: Log4J Users List 
> Subject: Re: Copying appenders and loggers from a confgiruation to a 
> builder
>
> I don't believe there is an API in ConfigurationBuilder that uses 
> actual plugin objects. That would certainly be a new feature. However, 
> you did mention combining configuration files which is already 
> implemented through composite configuration:
> http://logging.apache.org/log4j/2.x/manual/configuration.html#
> CompositeConfiguration
>
> On 17 November 2016 at 09:29, COHEN, STEVEN M  wrote:
>
> > I am trying to construct a program that basically reads a bunch of
> > log4j2 configuration files and combines them into one, writing this 
> > back to disk using the new
> > ConfigurationBuilder.writeXmlConfiguration(OutputStream)
> > method.
> >
> > But I run up against what seems to me to be a gap in the API unless 
> > I am missing something:
> > Having created a ConfigurationBuilder for the destination file and 
> > having read one of the to-be-combined configuration files into a 
> > Configuration object, there appears to be nothing in the 
> > ConfigurationBuilder interface that would allow, say, one of the 
> > appenders from the read-in configuration to be copied, as a whole 
> > object,into the builder, short of deconstructing it down to its
> constituent elements and adding them one by one.
> >
> > Is there a way to copy an appender from one configuration to another 
> > without drilling down into all its constituent parts?  And 
> > similarly, a way to copy a logger from one configuration to another 
> > without drilling down to its constituent parts?  Or must I write all 
> > this code
> myself?
> >
> >
> >
> > 
> > - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> > For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >
> >
>
>
> --
> Matt Sicker 
>



--
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org Java Persistence with 
Hibernate, Second Edition 



JUnit in Action, Second Edition



Spring Batch in Action


Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


RE: Copying appenders and loggers from a confgiruation to a builder

2016-11-17 Thread COHEN, STEVEN M
Looking at the MergeStrategy source code, it seems a bit confusing.  The method 
mergeRootProperties() seems to apply not to  elements but to root 
element attributes such as "monitorInterval", "status", etc.  The method might 
be better named mergeRootAttributes.

I think, I will have to adhere to the following rules in order to use 
CompositeConfiguration:
1.  No  definitions.  Or possibly require system-wide unique names.
2.  Only the master config defines root attributes.

-Original Message-
From: Gary Gregory [mailto:garydgreg...@gmail.com] 
Sent: Thursday, November 17, 2016 9:52 AM
To: Log4J Users List 
Subject: Re: Copying appenders and loggers from a confgiruation to a builder

Please feel free to record your feature request in JIRA:
https://issues.apache.org/jira/browse/LOG4J2

Gary

On Thu, Nov 17, 2016 at 7:47 AM, COHEN, STEVEN M  wrote:

> Thanks, that almost works for me, and will have to do, I suppose.  The 
> problem is that I was hoping to be able to load each subconfig in 
> first, filtering in any property definitions, which would then lead to 
> writable output that would not contain properties, but their expanded 
> values.  It would seem that with this approach, it would almost be 
> better to not use properties at all in the subconfigs.
>
> I guess this would have to be a feature request, but in the meantime I 
> might give CompositeConfiguration a try.
>
> -Original Message-
> From: Matt Sicker [mailto:boa...@gmail.com]
> Sent: Thursday, November 17, 2016 9:34 AM
> To: Log4J Users List 
> Subject: Re: Copying appenders and loggers from a confgiruation to a 
> builder
>
> I don't believe there is an API in ConfigurationBuilder that uses 
> actual plugin objects. That would certainly be a new feature. However, 
> you did mention combining configuration files which is already 
> implemented through composite configuration:
> http://logging.apache.org/log4j/2.x/manual/configuration.html#
> CompositeConfiguration
>
> On 17 November 2016 at 09:29, COHEN, STEVEN M  wrote:
>
> > I am trying to construct a program that basically reads a bunch of
> > log4j2 configuration files and combines them into one, writing this 
> > back to disk using the new
> > ConfigurationBuilder.writeXmlConfiguration(OutputStream)
> > method.
> >
> > But I run up against what seems to me to be a gap in the API unless 
> > I am missing something:
> > Having created a ConfigurationBuilder for the destination file and 
> > having read one of the to-be-combined configuration files into a 
> > Configuration object, there appears to be nothing in the 
> > ConfigurationBuilder interface that would allow, say, one of the 
> > appenders from the read-in configuration to be copied, as a whole 
> > object,into the builder, short of deconstructing it down to its
> constituent elements and adding them one by one.
> >
> > Is there a way to copy an appender from one configuration to another 
> > without drilling down into all its constituent parts?  And 
> > similarly, a way to copy a logger from one configuration to another 
> > without drilling down to its constituent parts?  Or must I write all 
> > this code
> myself?
> >
> >
> >
> > 
> > - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> > For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >
> >
>
>
> --
> Matt Sicker 
>



--
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org Java Persistence with 
Hibernate, Second Edition 



JUnit in Action, Second Edition



Spring Batch in Action


Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


Re: Copying appenders and loggers from a confgiruation to a builder

2016-11-17 Thread Mikael Ståldal
ConfigurationBuilder.writeXmlConfiguration(OutputStream) only works if you
have an ConfigurationBuilder that is populated somehow, you cannot use it
on an arbitrary Configuration object. I tried to support that, but it
turned out to be to difficult.

The built-in parsers for XML, JSON and YAML configurations are not
based on ConfigurationBuilder
(XML and JSON configuration parsers are older than ConfigurationBuilder,
and YAML configuration parser is based on the JSON configuration parser).

The properties configuration parser is newer and based on ConfigurationBuilder.
(But I guess that will not help you.)

Parsing an XML config file, transfer it to an ConfigurationBuilder and
write out to another XML config file will not be easy since the XML config
parser discards some information that is needed to reconstruct the config
file.

On Thu, Nov 17, 2016 at 4:33 PM, Matt Sicker  wrote:

> I don't believe there is an API in ConfigurationBuilder that uses actual
> plugin objects. That would certainly be a new feature. However, you did
> mention combining configuration files which is already implemented through
> composite configuration:
> http://logging.apache.org/log4j/2.x/manual/configuration.html#
> CompositeConfiguration
>
> On 17 November 2016 at 09:29, COHEN, STEVEN M  wrote:
>
> > I am trying to construct a program that basically reads a bunch of log4j2
> > configuration files and combines them into one, writing this back to disk
> > using the new ConfigurationBuilder.writeXmlConfiguration(OutputStream)
> > method.
> >
> > But I run up against what seems to me to be a gap in the API unless I am
> > missing something:
> > Having created a ConfigurationBuilder for the destination file and having
> > read one of the to-be-combined configuration files into a Configuration
> > object, there appears to be nothing in the ConfigurationBuilder interface
> > that would allow, say, one of the appenders from the read-in
> configuration
> > to be copied, as a whole object,into the builder, short of deconstructing
> > it down to its constituent elements and adding them one by one.
> >
> > Is there a way to copy an appender from one configuration to another
> > without drilling down into all its constituent parts?  And similarly, a
> way
> > to copy a logger from one configuration to another without drilling down
> to
> > its constituent parts?  Or must I write all this code myself?
> >
> >
> >
> > -
> > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> > For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >
> >
>
>
> --
> Matt Sicker 
>



-- 
[image: MagineTV]

*Mikael Ståldal*
Senior software developer

*Magine TV*
mikael.stal...@magine.com
Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com

Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.


Re: Copying appenders and loggers from a confgiruation to a builder

2016-11-17 Thread Gary Gregory
Please feel free to record your feature request in JIRA:
https://issues.apache.org/jira/browse/LOG4J2

Gary

On Thu, Nov 17, 2016 at 7:47 AM, COHEN, STEVEN M  wrote:

> Thanks, that almost works for me, and will have to do, I suppose.  The
> problem is that I was hoping to be able to load each subconfig in first,
> filtering in any property definitions, which would then lead to writable
> output that would not contain properties, but their expanded values.  It
> would seem that with this approach, it would almost be better to not use
> properties at all in the subconfigs.
>
> I guess this would have to be a feature request, but in the meantime I
> might give CompositeConfiguration a try.
>
> -Original Message-
> From: Matt Sicker [mailto:boa...@gmail.com]
> Sent: Thursday, November 17, 2016 9:34 AM
> To: Log4J Users List 
> Subject: Re: Copying appenders and loggers from a confgiruation to a
> builder
>
> I don't believe there is an API in ConfigurationBuilder that uses actual
> plugin objects. That would certainly be a new feature. However, you did
> mention combining configuration files which is already implemented through
> composite configuration:
> http://logging.apache.org/log4j/2.x/manual/configuration.html#
> CompositeConfiguration
>
> On 17 November 2016 at 09:29, COHEN, STEVEN M  wrote:
>
> > I am trying to construct a program that basically reads a bunch of
> > log4j2 configuration files and combines them into one, writing this
> > back to disk using the new
> > ConfigurationBuilder.writeXmlConfiguration(OutputStream)
> > method.
> >
> > But I run up against what seems to me to be a gap in the API unless I
> > am missing something:
> > Having created a ConfigurationBuilder for the destination file and
> > having read one of the to-be-combined configuration files into a
> > Configuration object, there appears to be nothing in the
> > ConfigurationBuilder interface that would allow, say, one of the
> > appenders from the read-in configuration to be copied, as a whole
> > object,into the builder, short of deconstructing it down to its
> constituent elements and adding them one by one.
> >
> > Is there a way to copy an appender from one configuration to another
> > without drilling down into all its constituent parts?  And similarly,
> > a way to copy a logger from one configuration to another without
> > drilling down to its constituent parts?  Or must I write all this code
> myself?
> >
> >
> >
> > -
> > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> > For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >
> >
>
>
> --
> Matt Sicker 
>



-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition



JUnit in Action, Second Edition



Spring Batch in Action


Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


RE: Copying appenders and loggers from a confgiruation to a builder

2016-11-17 Thread COHEN, STEVEN M
Thanks, that almost works for me, and will have to do, I suppose.  The problem 
is that I was hoping to be able to load each subconfig in first, filtering in 
any property definitions, which would then lead to writable output that would 
not contain properties, but their expanded values.  It would seem that with 
this approach, it would almost be better to not use properties at all in the 
subconfigs.

I guess this would have to be a feature request, but in the meantime I might 
give CompositeConfiguration a try.

-Original Message-
From: Matt Sicker [mailto:boa...@gmail.com] 
Sent: Thursday, November 17, 2016 9:34 AM
To: Log4J Users List 
Subject: Re: Copying appenders and loggers from a confgiruation to a builder

I don't believe there is an API in ConfigurationBuilder that uses actual plugin 
objects. That would certainly be a new feature. However, you did mention 
combining configuration files which is already implemented through composite 
configuration:
http://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration

On 17 November 2016 at 09:29, COHEN, STEVEN M  wrote:

> I am trying to construct a program that basically reads a bunch of 
> log4j2 configuration files and combines them into one, writing this 
> back to disk using the new 
> ConfigurationBuilder.writeXmlConfiguration(OutputStream)
> method.
>
> But I run up against what seems to me to be a gap in the API unless I 
> am missing something:
> Having created a ConfigurationBuilder for the destination file and 
> having read one of the to-be-combined configuration files into a 
> Configuration object, there appears to be nothing in the 
> ConfigurationBuilder interface that would allow, say, one of the 
> appenders from the read-in configuration to be copied, as a whole 
> object,into the builder, short of deconstructing it down to its constituent 
> elements and adding them one by one.
>
> Is there a way to copy an appender from one configuration to another 
> without drilling down into all its constituent parts?  And similarly, 
> a way to copy a logger from one configuration to another without 
> drilling down to its constituent parts?  Or must I write all this code myself?
>
>
>
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


--
Matt Sicker 


Re: Copying appenders and loggers from a confgiruation to a builder

2016-11-17 Thread Matt Sicker
I don't believe there is an API in ConfigurationBuilder that uses actual
plugin objects. That would certainly be a new feature. However, you did
mention combining configuration files which is already implemented through
composite configuration:
http://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration

On 17 November 2016 at 09:29, COHEN, STEVEN M  wrote:

> I am trying to construct a program that basically reads a bunch of log4j2
> configuration files and combines them into one, writing this back to disk
> using the new ConfigurationBuilder.writeXmlConfiguration(OutputStream)
> method.
>
> But I run up against what seems to me to be a gap in the API unless I am
> missing something:
> Having created a ConfigurationBuilder for the destination file and having
> read one of the to-be-combined configuration files into a Configuration
> object, there appears to be nothing in the ConfigurationBuilder interface
> that would allow, say, one of the appenders from the read-in configuration
> to be copied, as a whole object,into the builder, short of deconstructing
> it down to its constituent elements and adding them one by one.
>
> Is there a way to copy an appender from one configuration to another
> without drilling down into all its constituent parts?  And similarly, a way
> to copy a logger from one configuration to another without drilling down to
> its constituent parts?  Or must I write all this code myself?
>
>
>
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


-- 
Matt Sicker 


Copying appenders and loggers from a confgiruation to a builder

2016-11-17 Thread COHEN, STEVEN M
I am trying to construct a program that basically reads a bunch of log4j2 
configuration files and combines them into one, writing this back to disk using 
the new ConfigurationBuilder.writeXmlConfiguration(OutputStream) method.  

But I run up against what seems to me to be a gap in the API unless I am 
missing something:
Having created a ConfigurationBuilder for the destination file and having read 
one of the to-be-combined configuration files into a Configuration object, 
there appears to be nothing in the ConfigurationBuilder interface that would 
allow, say, one of the appenders from the read-in configuration to be copied, 
as a whole object,into the builder, short of deconstructing it down to its 
constituent elements and adding them one by one.

Is there a way to copy an appender from one configuration to another without 
drilling down into all its constituent parts?  And similarly, a way to copy a 
logger from one configuration to another without drilling down to its 
constituent parts?  Or must I write all this code myself?



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