You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Zsolt Szloboda <sl...@matavnet.hu> on 2001/04/11 22:54:32 UTC

how to disable printstacktrace

is there an easy way to disable/enable printing stack traces of the
throwables (included in the logging event)?
(eg. if i use BasicConfigurator)


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


Re: how to disable printstacktrace

Posted by Robert Burrell Donkin <Ro...@appleonline.net>.
Ceki Gülcü wrote:

> Zsolt,
>
> This was never asked before and as such is not a supported option. Ceki

maybe renderers (in the style of ObjectRenderer) for Throwable exceptions
might be a useful addition to log4j.

- robert


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


Re: how to disable printstacktrace

Posted by Paul Glezen <pg...@atdial.net>.
Ceki Gülcü wrote:
> 
> Zsolt,
> 
> This was never asked before and as such is not a supported option. Ceki
> 
> At 22:54 11.04.2001 +0200, you wrote:
> >is there an easy way to disable/enable printing stack traces of the
> >throwables (included in the logging event)?
> >(eg. if i use BasicConfigurator)
> >

Zsolt,

I have had the same desire as well.  If all you want is the output from
the toString() method of the exception, an error message like this will
do the trick:

   catch(Exception e)
   {
      cat.error("Caught exception: " + e, null);
   }

I am involved in cases where I want the stack trace available to
developers but not operations staff.  The socket appender used for
operations is filtered at INFO level while the log file on disk
available to developers is filtered at DEBUG level.  So the above code
would look like

  catch(Exception e)
  {
    cat.error("Caught exception: " e, null);
    cat.debug("Stack trace: ", e);
  }

This way, stack traces don't fill the green screens of the operations
staff.  But developers can get at it if need be.  One of our log4j
guidelines is that all stack traces are logged at DEBUG.

- Paul
-- 
Beware of bugs in the above code.  I have
only proved it correct, not tried it.
-Don Knuth

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


Re: how to disable printstacktrace

Posted by Ceki Gülcü <cg...@qos.ch>.
Zsolt,

This was never asked before and as such is not a supported option. Ceki

At 22:54 11.04.2001 +0200, you wrote:
>is there an easy way to disable/enable printing stack traces of the
>throwables (included in the logging event)?
>(eg. if i use BasicConfigurator)
>

--
Ceki Gülcü     Web: http://qos.ch 
email: cgu@qos.ch or ceki_gulcu@yahoo.com


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