How to enable or disable log4j for a custom component
A new framework is available to build custom components and must be used from this version onwards. Refer to Developing a component using Talend Component Kit. You can still use this procedure for components created using the deprecated component framework.
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.
The log4j feature is only available in Talend subscription product starting from version 5.6.
PrerequisitesBefore 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?
In order to enable log4j for a custom component, proceed as follows:
- Open the *_java.xml file corresponding to the custom component for which you want to enable log4j.
- 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.
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.