Skip to content

Commit fdcc330

Browse files
committed
Logger: level of Ruby script messages now is WARN. All messages are shown in KNIME console.
1 parent 2526f08 commit fdcc330

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

RubyScript/src/org/knime/ext/jruby/LoggerOutputStream.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,21 @@ public void flush() throws IOException {
3131
@Override
3232
public final void write(char[] b, int off, int len) throws IOException {
3333
String str = new String(b, off, len);
34+
35+
// prevent output of empty strings
36+
if (str.endsWith("\n")) {
37+
str = str.substring(0, str.length()-1);
38+
}
39+
if (str.length() == 0) return;
40+
3441
if (level == NodeLogger.LEVEL.INFO) {
3542
logger.info(str);
43+
} else if (level == NodeLogger.LEVEL.WARN) {
44+
logger.warn(str);
3645
} else if (level == NodeLogger.LEVEL.ERROR) {
3746
logger.error(str);
3847
} else {
3948
logger.debug(str);
4049
}
4150
}
4251
}
43-

RubyScript/src/org/knime/ext/jruby/RubyScriptNodeModel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.knime.core.node.ExecutionMonitor;
3737
import org.knime.core.node.InvalidSettingsException;
3838
import org.knime.core.node.NodeLogger;
39+
import org.knime.core.node.NodeLogger.LEVEL;
3940
import org.knime.core.node.NodeModel;
4041
import org.knime.core.node.NodeSettingsRO;
4142
import org.knime.core.node.NodeSettingsWO;
@@ -287,7 +288,7 @@ protected final BufferedDataTable[] execute(final BufferedDataTable[] inData,
287288
container.setLoadPaths(classpath);
288289

289290
container.setOutput(new LoggerOutputStream(logger,
290-
NodeLogger.LEVEL.INFO));
291+
NodeLogger.LEVEL.WARN));
291292
container.setError(new LoggerOutputStream(logger,
292293
NodeLogger.LEVEL.ERROR));
293294

0 commit comments

Comments
 (0)