Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
SMR040
Contributor III
Contributor III

Log4j2 not showing System.out.println message in RollingFile logfile

Hi all,

 

After moving to from 7.2 to Talend 8 we are facing some issues with Log4j2.

 

This topic is about the issue that when we are running a job on a server we can see the all the log details in the console, including the System.out.println messages. But when we check the logfile that is being produced we only see logging from the components themselves and no specific System.out.println messages.

 

Does anyone have experience with this?

 

Below is the log4j2.xml template that we are using, it looks very similar to the one we used in 7.2 (where the logging was being written to the file correctly)

 

<?xml version="1.0" encoding="UTF-8"?>

<Configuration>

       <Appenders>

                       <RollingFile name="rollingFile" fileName="/location/logfile.log" filePattern="/location/logfile.log.%i" ignoreExceptions="false" append="true" locking="true" >

                               <PatternLayout>

                                       <Pattern>%d | %5p | %c{1} |%X{jobId}|%X{jobName}|%X{version}| %m%n</Pattern>

                               </PatternLayout>

                               <Policies>

                                       <SizeBasedTriggeringPolicy size="10MB" />

                               </Policies>

                               <DefaultRolloverStrategy max="5"/>

                       </RollingFile>

               <Console name="STDOUT" target="SYSTEM_OUT">

                       <PatternLayout pattern="%d | %5p | %c{1} |%X{jobInstanceId}|%X{jobName}|%X{version}| %m%n"/>

               </Console>

       </Appenders>

       <Loggers>

 <!-- <Logger name="org.apache.log4j.xml" level="info"/> -->

               <Root level="info">

                               <AppenderRef ref="STDOUT"/>

                               <AppenderRef ref="rollingFile"/>

               </Root>

       </Loggers>

</Configuration>

 

Thanks!

Labels (2)
5 Replies
Anonymous
Not applicable

Hello,

What's log4j2 version you are using in talend 8? Maybe in V 7.2 you are using deprecated log4j2 version and the logs are parsed for the messages printed using the System.out.println to send out Pager Duty Alerts.

Here is a tjoblog component which is used in Jobs to debug their execution and decide what type of log information to send to the Studio or Talend Cloud user.

https://help.talend.com/r/en-US/8.0/talend-cloud/tjoblog

Best regards

Sabrina

 

 

SMR040
Contributor III
Contributor III
Author

hi,

 

I am using version log4j2 2.17.1

 

next to that I am not using Talend Cloud, instead we are on TAC. So that component is not fit for my use case I guess.

 

Please let me know how to capture System.out.println logs into the log file using Log4j 2.17.1

 

Thanks.

Anonymous
Not applicable

Hello,

With your subscription solution, could you please raise a support case on talend support portal? In this way, our colleagues from support team will check your issue and use case to see if a patch will be needed.

Best regards

Sabrina

RGunawan1618286753
Contributor
Contributor

Hi , we are also encountering this when migrating our jobs from 7.2.1 to 8.0.1

The logs showing in TMC are only from each components, not the specific system.out.println() messages that we have throughout the job where we sometimes print out helpful information to help debugging

 

Is there any update in relation to this topic ?

 

Anonymous
Not applicable

Hello,

Here is a tjoblog component which is used in Jobs to debug their execution and decide what type of log information to send to the Studio or Talend Cloud user.

https://help.talend.com/r/en-US/8.0/talend-cloud/tjoblog

Hope it helps.

Best regards

Sabrina