Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to show stacktrace on error when running from command-line?

When I run my job from the command-line (using the shell script), is there any way to make it show a stack trace of the error? All I get is:
Exception in component tSystem_1
0683p000009MDaX.png
Labels (2)
16 Replies
Anonymous
Not applicable
Author

Yes unfortunately the tParallel component is not part of the open source release. In this case you can only check the job output at its end.
Or you export the job as a standalone job and sends the outputs to a file (as Sabrina already suggested) and another job running parallel (checks the output file and sends the stack trace).
Why do you need the stack trace in a email? I would design the job and the tDie's in a way to have more meaningful messages. From my point of view this is a be far better approach than reading stacktraces to find the problem.
Anonymous
Not applicable
Author

Yes unfortunately the tParallel component is not part of the open source release. In this case you can only check the job output at its end.
Or you export the job as a standalone job and sends the outputs to a file (as Sabrina already suggested) and another job running parallel (checks the output file and sends the stack trace).
Why do you need the stack trace in a email? I would design the job and the tDie's in a way to have more meaningful messages. From my point of view this is a be far better approach than reading stacktraces to find the problem.

As far as the stack trace on email its because the job is supposed to be running everyday on an external server, so if anything goes wrong, i wanted to have all the possible information about what happened.
At least this was the ideia 0683p000009MACn.png
Anonymous
Not applicable
Author

Yes I can imagine, it would be great but with the build-in possibilities, there is no way.
You could also consider to use the OnComponentError triggers to have tDie's closer to the problem instead of OnSubjobError.
When you are running the jobs in an external Job scheduler like JobScheduler from SOS Berlin you could configure the scheduler to get the whole output (log file) as email attachment.
Anonymous
Not applicable
Author

I have the same console output problem, but am not dependent on any enterprise components.
The problem is simple.  I built the job in Open Studio (Right-Click on Job -> Build Job).  I run the job on the command line and it runs perfectly, but there is not output.  I want the output that displays in the studio:
Starting job <JOB> at 15:38 17/02/2015.
connecting to socket on port 3927
connected
disconnected
Job <JOB> ended at 15:38 17/02/2015.
to display on the standard output (console).  I can redirect it there to where I need (via the > out.txt as you described above).
Is there a command-line parameter?  (ie.  MyJob.sh -consoleOutput) or something like that (tried that BTW, it's a CommandLine arg, but it doesn't work on the standalone job).
Anonymous
Not applicable
Author

1. Use the tAssertCather component to get the exception object.
0683p000009MDXu.png
2.  Create a Routine class to handle the exception to a string
0683p000009MDRH.png
public static String getStacktrace(Object o)
   {
     StringWriter sw = new StringWriter();
     PrintWriter pw = new PrintWriter(sw);
     ((Throwable) o).printStackTrace(pw);
     return sw.toString(); // stack trace as a string     
   }
Anonymous
Not applicable
Author

Hi dseiler,
Could you please indicate what's the error you are getting?
Best regards
Sabrina
Anonymous
Not applicable
Author

How to use stack trace to find out which column is responsible for null pointer excepction