Can I use slf4j in KNIME ?

Hi @goulpan,

This is also possible, we have a slf4j binding available, so in theory you can just call:

final Logger logger = LoggerFactory.getLogger(getClass());

However, this log is filtered, to prevent the log being flooded by third party log messages. To whitelist your log messages, you will need to create a NodeLogger instance with the shared package prefix.
Take a look at the following example:


Example

Given two projects, Library and KNIME Extension, with the latter making use of the former.

Library:

package com.example.shared;

class ExampleClass {
   final Logger logger = LoggerFactory.getLogger(getClass());
}

KNIME extension

package com.example.knime;

class KNIMEExampleClass {
   final NodeLogger logger = NodeLogger.getLogger("com.example.shared");
}

best,
Gabriel