You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Robert Fischer <th...@gmx.net> on 2006/08/16 11:41:28 UTC

throw Exceptions in activateOptions()

Hello,

i'm developing a Plugin for log4j version 1.3, but somehow i'm not sure
whats the "right way" to handle exceptions in the activateOptions() method.

Currently my code is as follows:

class MyPlugin extends PluginSkeleton {
  ...

  public void activateOptions() {
    try {
      [ ...do something.. ]
    }
    catch (MyException e) {
      throw new IllegalStateException("illegal property value", e);
    }
  }
 
  ...
}

the Plugin gets loaded on log4j-startup, but somehow the
IllegalStateException gets "consumed" by log4j, instead of causing a
immediate shutdown of log4j.

i traced the execution flow and saw that the exception is caught by
org.apache.log4j.joran.spi.Interpreter.callEndAction(List
applicableActionList, String tagName) which just prints out an error
message like: "Exception in Action for tag <"+tagName+">"

So my question is: which Exception class needs to be thrown to prevent log4j
to continue. Furthermore: whats the right "log4j way" to handle Exceptions
in activateOptions()?

regards,
Robert



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org