Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Kettle 5.0.1 : Log4j plugin usage

  1. #1

    Default Kettle 5.0.1 : Log4j plugin usage

    Hi,

    I am trying to use log4j logging with kettle 5.0.1. Here is a link where Matt pointed to using a plugin to route the logging to log4j. However, i couldnt find any details on how to use it.

    So far,
    - Checked out code from git hub and tried to look into the commit log to understand the purpose/usage of kettle5-log4j-plugin project. But couldnt.
    - Googled internet and this forum but no details either
    - Debugged kettle 5.0.1 code to find a way to plugin log4j logging from kettle5-log4j-plugin. But couldnt find a way
    - Any attempts to using Log4jLogging are in vain.

    Please note that i was able to make my java code takeup my log4j.xml instead of the one from kettle-engine.jar. With that commons-vfs code is getting logged into the configured log4j appender. But no effect on kettle code. Tried both configuration via log4j.xml and programmatic log4j appenders using "org.pentaho.di" It still uses default logging.

    Also, any changes done to the kettle appender is not making any impact on the resultant logging. For ex. following code doesnt make any difference

    Code:
    Logger logger = Logger.getLogger(LogWriter.STRING_PENTAHO_DI_LOGGER_NAME);
    logger.setLevel(Level.ERROR);
    Also, there seems to be no example/article/wiki page what so ever on log4j integration.

    Following is the plugin configuration i used in "kettle-logging-plugins.xml". The plugin configuration is read and added to the plugin list. But the pkugin class (i.e. Log4jLogging) was never called.

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <logging-plugins>
        <logging-plugin id="log4j">
            <description>custom log4j plugin</description>
            <classname>org.pentaho.di.core.logging.log4j.Log4jLogging</classname>
        </logging-plugin>
    </logging-plugins>
    The log clearly shows that the plugin is registered but the eventAdded() is never called

    Code:
    General - Plugin class org.pentaho.di.core.logging.log4j.Log4jLogging registered for plugin type 'Logging Plugin'
    Could any one please point me if i missed the documentation ? Suggestions are welcome too.

    Thanks in advance,
    Rakesh
    Last edited by rakcheru; 01-22-2014 at 06:11 AM.

  2. #2

    Default

    At last got one way to let log4j capture the pentaho logging. Beware: though this works its not a convincing way to achieve it. Personally i would have liked if the plugin configuration via "kettle-logging-plugins.xml" worked. Will further investigate on that.

    Hope it helps someone

    1. While initializing the kettle environment add your own LoggingPluginInterface instance. Following is the code

    Code:
    KettleEnvironment.init(false);
    LoggingBuffer loggingBuffer = KettleLogStore.getAppender();
    loggingBuffer.addLoggingEventListener(new Log4jLogging());
    2. Attached is my LoggingPluginInterface implementation.

    3. In the log4j.xml, add a category for penatho logging. Following is the snippet from log4j.xml. Rest of the log4j.xml is just plain usual configuration

    Code:
        <category name="org.pentaho.di" additivity="false">
            <priority value="DEBUG"/>
            <appender-ref ref="ETLJOB"/>
        </category>

    Thanks,
    Rakesh
    Attached Files Attached Files
    Last edited by rakcheru; 01-23-2014 at 02:03 AM.

  3. #3

    Default

    Hi Rakcheru,

    Can you please share the log4j.xml? Does this implementation enables to redirect the transformation logs to a file?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.