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 <boa...@gmail.com> 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 <sc1...@att.com> 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 <boa...@gmail.com>
>



-- 
[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.

Reply via email to