logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nel...@monkey.org (Nelson Minar)
Subject Re: use of log4j with servlet
Date Fri, 05 Jan 2001 23:06:07 GMT
>Is there a way to detect if a BasicConfigurator is already configurate ?

As a bunch of folks have said; no, not really.
One option is to use a special startup class that your servlet engine
invokes. I don't know if there's a standard way to do this in the
servlet API; some engines will invoke any given class you ask it to,
others will run a specially designated "startup servlet".

Another option is to encapsulate your initialization of log4j in your
own static class. Ie, a class like this:

public class LoggingInitializer extends Object {
  private static boolean initialized = false;

  public static void initialize() {
    if (initialized)

Then just invoke your initialize method. Not super-efficient, but it
works fine. And you will probably find later that having all
initialization centralized in one class simplifies your life when you
start initializing log4j in a more complex way.

View raw message