Skip to main content

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.

Note that you can develop custom components using the Talend Component Kit framework. For more information, see Developing a component using Talend Component Kit.

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.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!