Yes, I can make it work by looking for "log4j.rootLogger" for example, and I guess if the v2 format changes we can add a property _then_ that says 2.6 or 3.0 or whatever.
Gary On Tue, Mar 8, 2016 at 11:39 AM, Matt Sicker <boa...@gmail.com> wrote: > Well, if the new config format doesn't prefix anything with log4j., then > that sounds like a safe way to check the version. Adding a version wouldn't > work with previously-written formats, so we'd still have to guess. > > On 8 March 2016 at 13:28, Gary Gregory <garydgreg...@gmail.com> wrote: > >> I initially thought of adding a >> >> version=2 >> >> to our Log4j 2 properties file format. >> >> I am experimenting with code to read in 1.2 properties files to configure >> Log4j 2, and I'd like an easy way to tell if I'm dealing with a version 2 >> properly file. I thought that would be cleaner that looking for >> "log4j.rootLogger" and deciding that means 1.2. >> >> I was thinking of putting a new ConfigurationFactory in log4j-api which >> means it would kick in automatically if on the CP. It could look for a >> log4j.rootLogger and do nothing if it does not find one. >> >> But would Log4j 2 then init itself correctly? >> >> I'm only thinking simple cases at first, you gotta start somewhere: >> Console. >> >> Gary >> >> -- >> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org >> Java Persistence with Hibernate, Second Edition >> <http://www.manning.com/bauer3/> >> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> >> Spring Batch in Action <http://www.manning.com/templier/> >> Blog: http://garygregory.wordpress.com >> Home: http://garygregory.com/ >> Tweet! http://twitter.com/GaryGregory >> > > > > -- > Matt Sicker <boa...@gmail.com> > -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org Java Persistence with Hibernate, Second Edition <http://www.manning.com/bauer3/> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> Spring Batch in Action <http://www.manning.com/templier/> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory