That’s a good point. It is a programmatic interface so it should return an error. But generally we want logging to do something reasonable other than fail, so it should either use whatever configuration it finds or use the default.
Ralph > On Apr 11, 2017, at 8:42 PM, Remko Popma <remko.po...@gmail.com> wrote: > > I thought Gary needed a way to detect that the specified location didn't > work. But perhaps a warning message is sufficient. > > Sent from my iPhone > > On Apr 12, 2017, at 10:05, Ralph Goers <ralph.go...@dslextreme.com > <mailto:ralph.go...@dslextreme.com>> wrote: > >> I'd prefer an error message but then have it continue with the current >> behavior. >> >> Sent from my iPhone >> >> On Apr 11, 2017, at 5:47 PM, Remko Popma <remko.po...@gmail.com >> <mailto:remko.po...@gmail.com>> wrote: >> >>> I can see both sides of the argument. >>> >>> Rather than changing the semantics of the existing method, what about >>> adding a method `Configurator.initializeStrict(String, String)` which fails >>> if the specified file doesn't exist? Not sure what the best way to fail is: >>> return null or throw exception... >>> >>> Sent from my iPhone >>> >>> On Apr 12, 2017, at 9:13, Gary Gregory <garydgreg...@gmail.com >>> <mailto:garydgreg...@gmail.com>> wrote: >>> >>>> Hi All: >>>> >>>> Using 2.8.2, I call >>>> org.apache.logging.log4j.core.config.Configurator.initialize(String, >>>> String) with a non-exiting file location. >>>> >>>> The method does not return null because it found another log4j2.xml file >>>> on my classpath. So I get a LoggerContext but not what I expect... >>>> >>>> That does not sound right to me, it should return null, and then I can >>>> look in the status logger to see what went wrong (if I happen to have it >>>> set to DEBUG in the log4j2.xml file it did find.) >>>> >>>> Thoughts? >>>> >>>> Gary >>>> >>>> -- >>>> E-Mail: garydgreg...@gmail.com <mailto:garydgreg...@gmail.com> | >>>> ggreg...@apache.org <mailto:ggreg...@apache.org> >>>> Java Persistence with Hibernate, Second Edition >>>> <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8> >>>> >>>> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459> >>>> JUnit in Action, Second Edition >>>> <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22> >>>> >>>> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021> >>>> Spring Batch in Action >>>> <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action> >>>> >>>> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951> >>>> Blog: http://garygregory.wordpress.com <http://garygregory.wordpress.com/> >>>> Home: http://garygregory.com/ <http://garygregory.com/> >>>> Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>