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: 
ksontakke
Contributor
Contributor

log4j global XML settings and auto generated java code issue

Hi all,

we are having following file name in the global log4j setting

<File name= "file" filename="${sys:FileNameWithPath.log} ">

we have an issue getting log files

generated

in two different locations one is provided log Path which is expected output and another log is getting created in installation path(C:/programs/talend/studio path)

how do we restrict talend not to create log under installation path ?

we also observed that these issue is not coming in previous talend version 7.3.1, build 20200219_1130 but coming with latest version 7.3.1 2022-12-7.3.1

we also noted in generated java code static block of code is build

static{

System.setProperty("TalendJob.log" , "Jb_JobName.log")

}

is there any option to restrict above line of code which is auto generated.

Thanks in advance.

Labels (2)
2 Replies
Nicolenix
Contributor
Contributor

Hello,

 

To address the issue of log files being created in two different locations, you can modify the log4j configuration to ensure that logs are only created in the desired log path and not in the installation path. Here's how you can do it:

 

Locate the log4j configuration file, typically named "log4j.xml" or "log4j.properties". This file is usually found in the root directory of your Talend project.

 

Open the log4j configuration file in a text editor.

 

Look for the <File> element with the name attribute set to "file" and the filename attribute set to ${sys:FileNameWithPath.log}. This element defines the log file location.

 

Ensure that the filename attribute is correctly configured to point to the desired log path. Double-check that the path is specified correctly and that any system properties or variables used in the attribute are resolved correctly.

 

Save the log4j configuration file. my account access

 

By making the above changes, you should be able to restrict Talend from creating logs in the installation path.

 

Regarding the auto-generated static block of code in the Java file, it appears to set the system property "TalendJob.log" to "Jb_JobName.log". To prevent this code from being generated, you can follow these steps:

 

Open the Talend Studio or the Talend job in question.

 

Navigate to the job that is generating the log4j configuration and auto-generated code.

 

In the job designer, select the "Job" tab.

 

In the Outline view or the Component view, locate the job entry or component that is responsible for generating the log4j configuration and code.

 

Right-click on the job entry or component and select "Component Settings" or a similar option.

 

Look for any settings related to logging or log file configuration and ensure they are correctly configured according to your requirements. If there is an option to disable the auto-generation of log4j code, uncheck or disable it.

 

Save the changes to the Talend job.

 

pablo125
Contributor II
Contributor II

To address the issue of log files being created in two different locations, you can make the following adjustments:

 

Check the global log4j configuration file: Verify that the file name specified in the global log4j settings is correctly set to the desired log file path. Ensure that the ${sys:FileNameWithPath.log} variable is resolved to the correct path.

 

Double-check the Talend job configurations: Ensure that you haven't inadvertently overridden the log file path in the Talend job configurations. Check any specific log settings within the Talend job to ensure they align with your desired log file location. YourTexasBenefits App

 

Examine the Talend Studio installation configuration: Review the configuration of Talend Studio to see if there are any settings related to log file creation. Look for any options or properties that may be causing logs to be created in the installation path. Adjust these settings accordingly to prevent logs from being generated in undesired locations.

 

Regarding the auto-generated Java code, specifically the static block of code, it is typically created by Talend Studio based on the job's configuration. Modifying this auto-generated code directly may not be recommended as it can lead to unexpected behavior.

 

Instead, consider reviewing the job configuration in Talend Studio to see if there are any options to control the logging behavior. Talend often provides built-in features and settings related to logging that can be adjusted within the job design.

If the issue persists or you require further assistance, consider reaching out to Talend support for more specific guidance related to the log file generation and configuration in your particular version of Talend Studio.