ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » printStackTrace in WMB6.1

Post new topic  Reply to topic
 printStackTrace in WMB6.1 « View previous topic :: View next topic » 
Author Message
mustang
PostPosted: Tue Aug 04, 2009 11:11 am    Post subject: printStackTrace in WMB6.1 Reply with quote

Acolyte

Joined: 07 Feb 2006
Posts: 72

We just recently migrated from WMB6.0 to WMB6.1. Under WMB6.0, from JavaComputeNodes, we used to log exceptions as well as the corresponding stack traces. Under WMB6.0, we were capturing the stack traces. Under WMB6.1, we are not. Any ideas?

The exceptions were usually thrown from business logic in our own jar files (not WMB exceptions). These jar files are deployed inside the bar file with the message flows, and were compiled using J2SE 1.4.

Listed below is the JavaComputeNode code that worked in WMB6.0 but not in WMB6.1. The property "stack" now resolves to empty.

public void log(Exception e) {
String msg = e.toString();
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
String stack = "";
e.printStackTrace(new PrintWriter(bytes));
stack = bytes.toString();

persistLog(msg, stack);
}

Thanks!
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Aug 04, 2009 11:25 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Use a StringWriter instead of a ByteArrayOutputStream.


StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
stack=sw.toString();
Back to top
View user's profile Send private message
mustang
PostPosted: Tue Aug 04, 2009 12:34 pm    Post subject: Reply with quote

Acolyte

Joined: 07 Feb 2006
Posts: 72

That did it. Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » printStackTrace in WMB6.1
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.