我们在编写作业或者转换的时候,运行时,尽管将Kettle的日志级别调整到最大,但是依然无法帮助我们定位到问题所在,此时我们就需要通过日志来输出我们的相关变量,以编程的思维来帮助我们快速定位到问题,以解决问题
旧版本Kettle
借助于搜索引擎,如果你是使用的较旧的Kettle版本,可以使用如下方法进行日志输出:
首先,得到日志输出实例
var log = org.pentaho.di.core.logging.LogWriter.getInstance();
按照日志的输出基本分别进行输出:
public void logMinimal(String subject, String message, Object... args)
{
println(LOG_LEVEL_MINIMAL, subject, message, args) ;
}
public void logBasic(String subject, String message, Object... args)
{
println(LOG_LEVEL_BASIC, subject, message, args) ;
}
public void logDetailed(String subject, String message, Object... args)
{
println(LOG_LEVEL_DETAILED, subject, message, args);
}
public void logDebug(String subject, String message, Object... args)
{
println(LOG_LEVEL_DEBUG, subject, message, args);
}
public void logRowlevel(String subject, String message, Object... args)
{
println(LOG_LEVEL_ROWLEVEL, subject, message, args);
}
public void logError(String subject, String message, Object... args)
{
println(LOG_LEVEL_ERROR, subject, message, args);
}
我们只需要在我们的JavaScript脚本中按照编写Java代码的方式,定义日志变量,然后调用相关的方法即可进行日志输出
var log = org.pentaho.di.core.logging.LogWriter.getInstance();
log.logDebug("Debug日志输出","日志信息Details...")
新版本Kettle
由于在《Kett