Redirecting the console output directly to email message body

Highlighted
Five Stars

Redirecting the console output directly to email message body

Hi,
I have a requirement of redirecting console output to email. But, the console output needs to be written to the message body of the email. 
I also understand that tjava needs to be used. May I know where must I connect it?
I DO NOT want to write into any file and then read it or attach to an email.
 I want to run this as a .sh job
Please find the below screenshot. I have introduced an error on purpose in the tmysqloutput. 



I also want the job to stop executing and hence, used the tdie. 
Request you to help me achieve this
Thanks in advance

Highlighted
Moderator

Re: Redirecting the console output directly to email message body

Hi,
We usually use tLogCatcher to capture the error message and log them into file or database, but it is impossible to output the full stack trace.
We can capture the error message "[font=Verdana, Helvetica, Arial, sans-serif]Exception in component tmysqlsp_1[/font]
[font=Verdana, Helvetica, Arial, sans-serif]com.mysql.jdbc.exception.jdbc.mysqlsyntaxErrorException[/font]" with tLogCatcher component, not the full stack trace.
Did you really need to redirect the full stack trace on console output to email?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Highlighted
Five Stars

Re: Redirecting the console output directly to email message body

Hi Sabrina,
Thank you for the response.
The error message as shown  by you is enough and the full stack trace would not be needed
Please find below the job design. Inside tjavarow I have globalMap.put("errorCode", input_row.message);
And inside the message body of tsendmail I have "the error message is: "+(String)globalMap.get("errorCode")


This works. I get the error in the body of the email. However, the job does not get killed  and keeps running and sends infinite number of emails. I have to manually kill the job to stop it. The tdie is not killing the job. 

Please let me know where am I going wrong.

Also, in case of Rejects I would want to send an warning email and do not want the job to end. How do I accomplish this?  The rejects go to a database table.

Regards
Rathi

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog