[Pki-devel] CMS.debug(Throwable e); stack trace suppressed?

Fraser Tweedale ftweedal at redhat.com
Mon Mar 12 02:28:22 UTC 2018


On Fri, Mar 09, 2018 at 11:00:50PM -0500, Endi Sukma Dewata wrote:
> Hi Fraser,
> 
> Yeah, there's a bug in the message formatter. Could you take a
> look at this patch?
> https://review.gerrithub.io/#/c/403387/
> 
> Here's some documentation (still work in progress):
> http://pki.fedoraproject.org/wiki/PKI_10.6_Logging_Improvements
> 
> Thanks!
> 
Patch works and reads fine, so I'll merge that now.
Thanks for the fix!

Cheers,
Fraser

> --
> Endi S. Dewata
> 
> ----- Original Message -----
> > Hi,
> > 
> > It seems that with the change in logging backend, calls to
> > CMS.debug(Throwable e) no longer print the stack trace.  The name of
> > the exception is printed by the error message has been suppressed.
> > 
> > I couldn't work out why this is happening but in my working tree I'm
> > carrying the below change to get the stack traces back.  Not sure if
> > it's a "proper" way to fix it but it's doing the trick.
> > 
> > Cheers,
> > Fraser
> > 
> > diff --git a/base/server/cmscore/src/com/netscape/cmscore/util/Debug.java
> > b/base/server/cmscore/src/com/netscape/cmscore/util/Debug.java
> > index 21e964c1a..135ca75bc 100644
> > --- a/base/server/cmscore/src/com/netscape/cmscore/util/Debug.java
> > +++ b/base/server/cmscore/src/com/netscape/cmscore/util/Debug.java
> > @@ -20,6 +20,9 @@ package com.netscape.cmscore.util;
> >  import java.util.Hashtable;
> >  import java.util.StringTokenizer;
> >  
> > +import java.io.StringWriter;
> > +import java.io.PrintWriter;
> > +
> >  import org.dogtagpki.util.logging.PKILogger;
> >  
> >  import com.netscape.certsrv.apps.CMS;
> > @@ -167,7 +170,16 @@ public class Debug
> >          if (!TRACE_ON)
> >              return;
> >  
> > -        CMS.logger.warn(e.getMessage(), e);
> > +        /*
> > +        String msg = e.getMessage(); // may be null
> > +        if (msg == null)
> > +            msg = e.toString();
> > +        CMS.logger.warn(msg, e);
> > +        */
> > +        StringWriter sw = new StringWriter();
> > +        PrintWriter pw = new PrintWriter(sw);
> > +        e.printStackTrace(pw);
> > +        CMS.logger.warn(sw.toString());
> >      }
> >  
> >      /**
> > 




More information about the Pki-devel mailing list