One Star

how to log executed query to console? (tOracleRow)

Need to log the executed query used within the tOracleRow component to the console window in order to have a complete Job execution protocol. Any idea how to log the query?
7 REPLIES
Moderator

Re: how to log executed query to console? (tOracleRow)

Hi,
Here is a global variable  ((String)globalMap.get("tOracleRow_1_QUERY")) from tOracleRow which is the SQL query statement being processed.
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.
Six Stars

Re: how to log executed query to console? (tOracleRow)

Hi,
Here is a global variable  ((String)globalMap.get("tOracleRow_1_QUERY")) from tOracleRow which is the SQL query statement being processed.
Best regards
Sabrina

Hi Sabrina,
is there any way to be able to enable/disable query logging for most/all DB components in a job, for debugging purpose?
I could use one/many tJava component(s) (one it'd be better), and 'println' any query I need to log, but sometime it is not so easy to find out where to link the tJava component for a good flow design and optimization.
Any suggestion?
Thank you,
Lorenzo
Twelve Stars

Re: how to log executed query to console? (tOracleRow)

generally query - most easiest part for debug
You always can catch them from database side 
-----------
Six Stars

Re: how to log executed query to console? (tOracleRow)

generally query - most easiest part for debug
You always can catch them from database side 

Sometime jobs are a better common point where to implement different monitoring/debug policies, to decide which queries to log, for example when you interact with different databases and/or a lot of clients and jobs are querying at the same time.
Twelve Stars

Re: how to log executed query to console? (tOracleRow)

Sometime jobs are a better common point where to implement different monitoring/debug policies, to decide which queries to log, for example when you interact with different databases and/or a lot of clients and jobs are querying at the same time.

I have DBA background, so I just not meet no one case when I will need log queries in Talend, when need - I debug all direct on database
From my point of view - all problems could be only from variable parameters, so I will debug variables, but not a query
but as Sabrina explain above for the ROW component You can use - ((String)globalMap.get("tOracleRow_1_QUERY"))
-----------
Twelve Stars

Re: how to log executed query to console? (tOracleRow)

in additional, I never look for this information, but at least in TAC (subscription) - all database queries write to the log

in Studio (not Open) You can select Log4JLevel - Debug (same if You Build Job), and You will also have all queries on console:
 
will need to check - component from Exchange for Log4Jhow it work
-----------
Twelve Stars

Re: how to log executed query to console? (tOracleRow)

not so easy as on subscription, but still possible  
    
-----------