Andy Kriger wrote:
> [...]
> What I want is a way to check if PropertyConfigurator is able to find
> log4j.properties and if not, then and only then call
> BasicConfigurator.configure() as a backup.
> 
> Is this possible?

You can check whether at least one Category has been added to the
default hierarchy or whether an appender has been added to the root
category:

  public static boolean isLog4jConfigured() {
    Enumeration cats = Category.getCurrentCategories();
    Enumeration rootApps = Category.getRoot().getAllAppenders();
    return cats.hasMoreElements() || rootApps != null;
  }

I haven't checked it but it ought to work.

> 
> Andy Kriger
> Triene Inc.
> 116 W23rd Street
> Suite 500
> New York, NY 10011
> 646.375.2364 (W)
> 646.298.5493 (M)
> 
>   ------------------------------------------------------------------------
> 
>    Part 1.2    Type: application/ms-tnef
>            Encoding: base64

--
Anders Kristensen

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to