Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
JackStrong
Contributor
Contributor

MS SQL queries in Talend Cloud Management Console log

Hi Everyone.

 

How can I log the MS SQL queries to the TC Management Console?

I would like to write the query to the log (only query, without rows/results).

I use the tDBInput component and the flow is very simple:

tDBInput(MSSQL)---->tJavaRow ----->tDBOutput

 

I know that for some DB technology (for example Snowflake) the queries (tDBInput and tDBRow) are written to the log automatically but for MS SQL is doesn't work.

 

 

Regards. 

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi
Use the tJobLog component in the job and customize the log messages, eg:
"This is the query: "+context.query

Note that:
To be able to use this component to generate logs, you must enable the Log4j option in the project settings in the Studio.

Regards
Shong

View solution in original post

4 Replies
Anonymous
Not applicable

Hi,

 

    The most easy way will be store the query in a context variable and print it using a tJava.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

JackStrong
Contributor
Contributor
Author

 Hi nikhillthampi.

 

Maybe I'm wrong but simple System.out.println(context.query) puts the query into the output.

But I would like to see the query in the Cloud log.

How can I do it?

 

Regards.

 

Anonymous
Not applicable

Hi
Use the tJobLog component in the job and customize the log messages, eg:
"This is the query: "+context.query

Note that:
To be able to use this component to generate logs, you must enable the Log4j option in the project settings in the Studio.

Regards
Shong
JackStrong
Contributor
Contributor
Author

Thanks a lot.

 

I did as you both wrote and it looks ok.

 

I thought that there is more easier and shorter way to do it so this is why I asked.

Right now If I want to add some log entries/details in a few places in job, it is necessary to add a lot of components to the job.

For example, if I have 10 different queries to run in one job in different places I need to add 10 additional tJava component and 10 additional tJobLog component.

This makes the job difficult to read.

It would be great to have some java function to write some logs (context variables) in both places - to the output and to the cloud log (web).

Do you know if there is something like this?

 

Thanks.