How to enable or disable log4j for a custom component

author
Talend Documentation Team
EnrichVersion
6.4
6.3
6.2
6.1
6.0
EnrichProdName
Talend Data Fabric
Talend Real-Time Big Data Platform
Talend Big Data
Talend Big Data Platform
task
Installation and Upgrade
EnrichPlatform
Talend Studio

How to enable or disable log4j for a custom component

This article explains how to enable log4j in a custom component in order to trace and record log messages regarding the execution of this component. It also explains how to disable it for the whole component or for a particular parameter.
Environment

The log4j feature is only available in Talend subscription product starting from version 5.6.

Prerequisites

Before following this procedure, it is strongly advised to read the following articles:

  • How to create a custom component
  • How to activate log4j in Talend Studio?
Enabling the log4j for a custom component

In order to enable log4j for a custom component, proceed as follows:

  1. Open the *_java.xml file corresponding to the custom component for which you want to enable log4j.
  2. In the HEADER element of this file, add the following line:
    LOG4J_ENABLED="true"

    The HEADER element of your *_java.xml file should look like this:

    <HEADER
        PLATEFORM="ALL"
        SERIAL=""
        VERSION="2.0"
        STATUS="ALPHA"
      
        COMPATIBILITY="ALL"
        AUTHOR="Component Author"
        RELEASE_DATE="20070525A"
        STARTABLE="false"
    	LOG4J_ENABLED="true"
      >
        <SIGNATURE/>
      </HEADER>

    Note that it is advised to append the log4j attribute to the last attribute of the HEADER element.

Deactivate log4j for a parameter

To deactivate log4j for a specific parameter, add the following attribute to the parameter you want to deactivate log4j for:

LOG4J_ENABLED="false"

Please note that log4j is activated by default for a parameter.