Hi list,

I have a problem with error logging strategies. In our application, we use a
log4j SMTP  appender, that sends out alarming emails in case of error logs.
However, we cannot properly control our wicket application as far as logging
is concerned. The problem is that this causes us to receive emails, for
instance, when a user  enters an incorrect URL - which is hardly alarming,
I'd say.

We override the application's getDefaultRequestCycleFactory to return a
factory that constructs  WebRequestCycle instances that override the
onRuntimeException method - we assumed that that way we could control
logging in case of runtime exceptions. However, in **private** methods of
RequestCycle, Exceptions are logged on the error level, most notably
RuntimeException. In the step() method for example, the following snippet
causes our problems:

catch (RuntimeException e)
{
   // set step manually to handle exception
   currentStep = HANDLE_EXCEPTION;

   // probably our last chance the exception can be logged
   log.error(e.getMessage(), e);

   // try to play nicely and let the request processor handle the
   // exception response. If that doesn't work, any runtime exception
   // will automatically be bubbled up
   if (processor != null)
   {
       processor.respond(e, this);
   }
}


I'd say one should allow more control: why not call a  protected method that
has a default implementation of log.error(e.getMessage, e) ? This way,  one
can easily adjust the logging level by overriding this method in a subclass.


Your thoughts?

Regards,

--
Ivo van Dongen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500

Reply via email to