Four Stars

TOS 6.4.1 for Data Integration under Linux - Problems with log4j, no value for TalendJob.log

Hi,

 

I use TOS 6.4.1 under Ubuntu Linux.

 

My log4j.xml file is as follows:

 

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
 
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/' >
      <!--  CONSOLE appender  -->
    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
             <!--         <param name="ConversionPattern"      value="[%-5p]: %c - %m%n" />  -->
             <param name="ConversionPattern"  value="%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %m%n" />
        </layout>
    </appender>
 
    <!-- DRFILE appender example -->
    <appender name="DRFILE" class="org.apache.log4j.DailyRollingFileAppender">         
       <param name="file" value="${TalendJob.log}"/>
       <param name="DatePattern" value="'.'yyyy-MM-dd" />
       <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern"  value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5p %c{1}:%L - %m%n" />
       </layout>  
    </appender>  
    
    <!-- Spring Logger -->   
    <logger name="log4j.logger.org.springframework">   
        <level value="WARN" />   
        <appender-ref ref="CONSOLE"/>
    </logger>
     
    <!-- throwableRenderer <throwableRenderer class="org.apache.log4j.EnhancedThrowableRenderer"/>-->  
      
    <!-- logstash appender -->
      <!-- <appender name="LOGSTASH" class="org.apache.log4j.net.SocketAppender">
          <param name="RemoteHost" value="localhost"/>
          <param name="Port" value="8052"/>
    </appender> -->
 
    <!-- Root Logger -->   
    <root>
        <priority value ="INFO"/>
        <appender-ref ref="CONSOLE"/>
        <appender-ref ref="DRFILE"/>   
 
        <!-- <appender-ref ref="LOGSTASH"/> -->
    </root>
</log4j:configuration>

 

I' not sure if the log4j.xml file is correct, and I use tInitLog4J und tLog4J from Talend Exchange. By the way, do these Components work 100% correctly with TOS 6.4.1.

 

When I run my Talend Job, I get the following error:

 

Starting job MyJob at 14:10 05/01/2018.

[statistics] connecting to socket on port 4024
[statistics] connected
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException:  (No such file or directory)
	at java.io.FileOutputStream.open0(Native Method)
	at java.io.FileOutputStream.open(FileOutputStream.java:270)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
	at org.apache.log4j.FileAppender.setFile(FileAppender.java:290)
	at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:164)
	at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:216)
	at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:257)
	at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:285)
	at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:171)
	at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:184)
	at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:502)
	at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:471)
	at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:921)
	at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:790)
	at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:682)
	at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:811)
	at org.courtine.talend.log4j.TalendLog4JConfigurator.configureLog4J(TalendLog4JConfigurator.java:37)
	at <...>.tInitLog4J_1Process(MyJob.java:1178)
	at <...>.tPrejob_1Process(MyJob.java:1079)
	at <...>.runJobInTOS(MyJob.java:13326)
	at <...>.main(MyJob.java:13020)
log4j:ERROR Either File or DatePattern options are not set for appender [DRFILE].

What is wrong?

 

Cheers

 

1 REPLY
Moderator

Re: TOS 6.4.1 for Data Integration under Linux - Problems with log4j, no value for TalendJob.log

Hello,

How did you set the field 'Path to the Log4J configuration file'? Does it exist on your local machine?

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.