I would like to log in serveral services the stack-trace.
I can do that in an exception, when I catch an error, I call the service
WmPublic/pub.flow:getLastError and get the pipeline lastError/callStack.
But I would like to get the callStack anytime from anywhere in a service, not only after an error occured, because I need it to log the Stack into my log-files.
Can anybody help me here ?
Hi Ralf,
We created the following java service to do this. It will return the stack in a string list.
String[] serviceStack;
IDataCursor idc_pipeline = pipeline.getCursor();
try {
Thread t = Thread.currentThread();
com.wm.app.b2b.server.ServerThread st = (com.wm.app.b2b.server.ServerThread)t;
java.util.Stack stack = st.getState().getCallStack();
serviceStack = new String[stack.size()];
if (stack.size() > 0) {
for (int i=0;i<stack.size();i++) {
serviceStack[i] = stack.elementAt(i).toString();
}
}
} catch (Exception e) {
throw new ServiceException(e);
}
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
IDataUtil.put( pipelineCursor, "serviceStack", serviceStack );
pipelineCursor.destroy();
Mvg,
Dave
Hi Dave,
Do you know how to do it in wM 7.1?
I get a java error at compile time. The getState method from ServerThread does not exist anymore.
Any ideas how to do it now?
Many Thanks,
Ganesh
Hi Ganesh,
what about getCurrentState()?
As this is undocument
If you change this line…
java.util.Stack stack = st.getState().getCallStack();
…into this…
java.util.Stack stack = st.getInvokeState().getCallStack();
…then it should work in 7.1.