Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
n999
Contributor II
Contributor II

Logging Frustration using Log4J Levels

Hi

I'm trying to configure logging using log4j paradigms in Talend 7 and am left a bit frustrated.

This is my journey so far,,, 🙂

Basically I want to be log at different levels based on my project log4 settings. 

So I want to log at DEBUG/INFO/WARN etc and only see those logs if my log4j level is set appropriately

tLogRow

Looking at tLogRow there is no log level but there is a "Print Content with log4j" check box that is explained by talend as 

"Select this check box to output the data flow content if the log4j feature is activated and the log4j output level is set to INFO or lower than INFO for your Job. For how to activate the log4j feature and customize the log4j output level, refer to Talend Studio User Guide."

So this doesn't present any granularity, and I would say that tLogRow output is more a debug or trace things based on its verbosity...?

tJava

Use tJava as https://community.talend.com/s/article/Log-j-tips-and-tricks-I8730 only works in you do your logging out of any flow. In flow the tJava is called even if there are no rows in that flow so you get spurious logging

I could hook into okComponentOk, etc to run the tJava but sometimes I'm logging in mid flow.

tJavaRow

Using tJavaRow, I can do the above and in flow, but have to ensure the default generated code is still created, and maintained if schemas change as this seems a bit brittle

tWarn

An oddly named/icon-ed component as it logs at all the different priority/log levels....and has a superfluous error code.

Although this component mentions nothing about log4J specifically, the priority levels seem to match with log4J levels when running the job.

So this seems to be the best way to achieve what I want, even though the tWarn component seems like the least likely candidate based on first impressions!

Would be interested to know if others have found the same as me.

cheers

n

1 Solution

Accepted Solutions
Anonymous
Not applicable

Hello,

 

using tJavaFlex instead of tJavaRow would be the solution for you I believe. It can propagate the dataset automatically for you, so when the schema changes you have nothing to do.

 

The best solution would be to go with tLogRow, there is a feature request in JIRA for that: https://jira.talendforge.org/browse/TDI-42755

 

Feel free add comments / vote on the JIRA itself.

 

Regards,

Balázs

View solution in original post

2 Replies
Anonymous
Not applicable

Hello,

 

using tJavaFlex instead of tJavaRow would be the solution for you I believe. It can propagate the dataset automatically for you, so when the schema changes you have nothing to do.

 

The best solution would be to go with tLogRow, there is a feature request in JIRA for that: https://jira.talendforge.org/browse/TDI-42755

 

Feel free add comments / vote on the JIRA itself.

 

Regards,

Balázs

n999
Contributor II
Contributor II
Author

Many thanks for the response.

  • Will try tJavaFlex
  • Will try and vote after figuring out what credentials to use 🙂