Sure. If you look at JSONConfiguration you will see that it has a constructor that starts the process of reading the input file (which is captured in the root JsonNode). After the constructor BaseConfiguration calls JSONConfiguration's setup method. When that method completes the configuration data will have been converted into a tree of Node objects. Each node represents a configuration element and contains its attributes. Each of the Nodes is also associated with a PluginType object. You can see that in the constructNode method.
XMLConfiguration works exactly the same way. As long as the end result of the setup method is a tree of nodes it really doesn't matter what you use as the "directions" for how to create them. XML and JSON are particularly nice in that they map nicely to the tree structure. However, it certainly would be possible to read several XML files and merge them together into the tree. The Factory for each type of Configuration takes on a few responsibilities: 1. It specifies the file extensions that are supported by this Configuration processor. 2. In JSON's case it checks for the Jackson dependencies being present - if they are not then the configuration is marked as inactive and JSON will not be supported. 3. It specifies the precedence of the Configuration. This would allow you to replace the standard XMLConfiguration with your own. 4. It creates the actual Configuration object. FWIW, when I attended ApacheCon last year someone suggested that Log4j 2 should support JSON. I had already implemented the XML support with the idea for extension. It took me more time to find a nice JSON processor and how to use it then it did to implement the feature. Ralph On Aug 8, 2012, at 3:35 PM, Tushar Kapila wrote: > Ralph you described a factory for config in another mail. Using that > and some custom format to describe that a config file is an add on; > one could make such a configurator? > > On 8/8/12, Ralph Goers <[email protected]> wrote: >> No. Currently it doesn't support that. >> >> On Aug 8, 2012, at 3:27 AM, Christian Grobmeier wrote: >> >>> Somebody asked me on G+ if log4j 2.x does support config cascading. I >>> think it is an interesting feature, but currently have no clue if it >>> already works... any ideas? >>> >>> Here is the original question: >>> >>> "Does anyone know if they allow "cascading" or overridable property >>> files? >>> >>> We have an issue providing libraries with default logging properties, >>> b/c in log4j 1.x, the first property file on the classpath wins." >>> >>> Cheers >>> Christain >>> >>> -- >>> http://www.grobmeier.de >>> https://www.timeandbill.de >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > -- > Sent from my mobile device > > Regards > Tushar Kapila > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
