本文整理汇总了Java中org.pentaho.di.core.logging.LogLevel类的典型用法代码示例。如果您正苦于以下问题:Java LogLevel类的具体用法?Java LogLevel怎么用?Java LogLevel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LogLevel类属于org.pentaho.di.core.logging包,在下文中一共展示了LogLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logger
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
public static LogLevel logger(String level) {
LogLevel logLevel = null;
if ("basic".equals(level)) {
logLevel = LogLevel.BASIC;
} else if ("detail".equals(level)) {
logLevel = LogLevel.DETAILED;
} else if ("error".equals(level)) {
logLevel = LogLevel.ERROR;
} else if ("debug".equals(level)) {
logLevel = LogLevel.DEBUG;
} else if ("minimal".equals(level)) {
logLevel = LogLevel.MINIMAL;
} else if ("rowlevel".equals(level)) {
logLevel = LogLevel.ROWLEVEL;
} else {
logLevel = KETTLE_LOGLEVEL;
}
return logLevel;
}
示例2: loadXML
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
public void loadXML(Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers, Repository rep)
throws KettleXMLException
{
try
{
super.loadXML(entrynode, databases, slaveServers);
logmessage = XMLHandler.getTagValue(entrynode, "logmessage");
entryLogLevel = LogLevel.getLogLevelForCode(XMLHandler.getTagValue(entrynode, "loglevel"));
logsubject = XMLHandler.getTagValue(entrynode, "logsubject");
}
catch(Exception e)
{
throw new KettleXMLException(BaseMessages.getString(PKG, "WriteToLog.Error.UnableToLoadFromXML.Label"), e);
}
}
示例3: clear
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
public void clear()
{
super.clear();
specificationMethod = ObjectLocationSpecificationMethod.FILENAME;
transname=null;
filename=null;
directory = null;
arguments=null;
argFromPrevious=false;
execPerRow=false;
addDate=false;
addTime=false;
logfile=null;
logext=null;
setLogfile=false;
clearResultRows=false;
clearResultFiles=false;
remoteSlaveServerName=null;
setAppendLogfile=false;
waitingToFinish=true;
followingAbortRemotely=false; // backward compatibility reasons
createParentFolder=false;
logFileLevel = LogLevel.BASIC;
}
示例4: getLogLevelByDesc
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
public LogLevel getLogLevelByDesc()
{
if(loglevel==null) return LogLevel.BASIC;
LogLevel retval;
if(loglevel.equals(logLevelCodes[0]))
retval=LogLevel.NOTHING;
else if(loglevel.equals(logLevelCodes[1]))
retval=LogLevel.ERROR;
else if(loglevel.equals(logLevelCodes[2]))
retval=LogLevel.MINIMAL;
else if(loglevel.equals(logLevelCodes[3]))
retval=LogLevel.BASIC;
else if(loglevel.equals(logLevelCodes[4]))
retval=LogLevel.DETAILED;
else if(loglevel.equals(logLevelCodes[5]))
retval=LogLevel.DEBUG;
else
retval=LogLevel.ROWLEVEL;
return retval;
}
示例5: get
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
public String get(String key, String ... params) {
String res = null;
String notFoundKey = "!" + key + "!";
for (String pName : packageNames) {
// Kettle will generate an exception message if there is a
// failed message search. Since we are searching over multiple
// packages, we don't want this message generated unless we
// cannot find the message in any of the packages.
LogLevel logLevel = DefaultLogLevel.getLogLevel();
DefaultLogLevel.setLogLevel(LogLevel.NOTHING);
try {
res = BaseMessages.getString(pName, key);
}
finally {
DefaultLogLevel.setLogLevel(logLevel);
}
if (!res.equals(notFoundKey)) {
return res;
}
}
// This means we did not find the key, so let Kettle generate
// its normal error.
return BaseMessages.getString(packageNames.get(0), key);
}
示例6: TransExecutionConfiguration
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
public TransExecutionConfiguration()
{
executingLocally = true;
clusterPosting = true;
clusterPreparing = true;
clusterStarting = true;
clusterShowingTransformation = false;
passingExport = false;
arguments = new HashMap<String, String>();
params = new HashMap<String, String>();
variables = new HashMap<String, String>();
transDebugMeta = null;
logLevel = LogLevel.BASIC;
clearingLog = true;
}
示例7: ok
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
private void ok()
{
if(Const.isEmpty(wName.getText()))
{
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR );
mb.setText(BaseMessages.getString(PKG, "System.StepJobEntryNameMissing.Title"));
mb.setMessage(BaseMessages.getString(PKG, "System.JobEntryNameMissing.Msg"));
mb.open();
return;
}
jobEntry.setName(wName.getText());
jobEntry.setLogMessage(wLogMessage.getText());
jobEntry.setLogSubject(wLogSubject.getText());
if (wLoglevel.getSelectionIndex() != -1) {
jobEntry.entryLogLevel = LogLevel.values()[wLoglevel.getSelectionIndex()];
}
dispose();
}
示例8: ok
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
private void ok()
{
int idx=wLoglevel.getSelectionIndex();
DefaultLogLevel.setLogLevel(LogLevel.values()[idx]);
String filter = wFilter.getText();
if (Const.isEmpty(filter)) {
LogWriter.getInstance().setFilter(null); // clear filter
} else {
LogWriter.getInstance().setFilter(wFilter.getText());
}
layout.setTimeAdded(wTime.getSelection());
props.setLogFilter(wFilter.getText());
props.setLogLevel(wLoglevel.getText());
props.saveProps();
dispose();
}
示例9: initLogging
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
private static void initLogging(CommandLineOption[] options) throws KettleException {
StringBuffer optionLogfile = getCommandLineOption(options, "logfile").getArgument();
StringBuffer optionLoglevel = getCommandLineOption(options, "level").getArgument();
// Set default Locale:
Locale.setDefault(Const.DEFAULT_LOCALE);
Log4jFileAppender fileAppender;
if (Const.isEmpty(optionLogfile)) {
fileAppender = LogWriter.createFileAppender(Const.SPOON_LOG_FILE, false);
} else {
fileAppender = LogWriter.createFileAppender(optionLogfile.toString(), true);
}
LogWriter.getInstance().addAppender(fileAppender);
if (log.isBasic()) {
log.logBasic(BaseMessages.getString(PKG, "Spoon.Log.LoggingToFile") + fileAppender.getFile().toString());// "Logging goes to "
}
if (!Const.isEmpty(optionLoglevel)) {
log.setLogLevel(LogLevel.getLogLevelForCode(optionLoglevel.toString()));
if (log.isBasic())
log.logBasic(BaseMessages.getString(PKG, "Spoon.Log.LoggingAtLevel") + log.getLogLevel().getDescription());// "Logging is at level : "
}
}
示例10: testBadInput
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
@Test
public void testBadInput() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
helper.redirectLog( out, LogLevel.ERROR );
JsonInputField isbn = new JsonInputField( "isbn" );
isbn.setPath( "$..book[?(@.isbn)].isbn" );
isbn.setType( ValueMetaInterface.TYPE_STRING );
String input = "{{";
try ( LocaleChange enUS = new LocaleChange( Locale.US ) ) {
JsonInputMeta meta = createSimpleMeta( "json", isbn );
JsonInput jsonInput = createJsonInput( "json", meta, new Object[] { input } );
processRows( jsonInput, 3 );
Assert.assertEquals( "error", 1, jsonInput.getErrors() );
Assert.assertEquals( "rows written", 0, jsonInput.getLinesWritten() );
String errors = IOUtils.toString( new ByteArrayInputStream( out.toByteArray() ), StandardCharsets.UTF_8.name() );
Assert.assertTrue( "expected error", errors.contains( "Error parsing string" ) );
}
}
示例11: testDefaultLeafToNull
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
@Test
public void testDefaultLeafToNull() throws Exception {
JsonInputField noPath = new JsonInputField( "price" );
noPath.setPath( "$..price" );
noPath.setType( ValueMetaInterface.TYPE_STRING );
ByteArrayOutputStream out = new ByteArrayOutputStream();
helper.redirectLog( out, LogLevel.ERROR );
JsonInputMeta meta = createSimpleMeta( "json", noPath );
meta.setIgnoreMissingPath( true );
meta.setRemoveSourceField( true );
final String input = getBasicTestJson();
JsonInput jsonInput = createJsonInput( "json", meta, new Object[] { input } );
processRows( jsonInput, 8 );
disposeJsonInput( jsonInput );
Assert.assertEquals( 5, jsonInput.getLinesWritten() );
}
示例12: testSingleObjPred
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
@Test
public void testSingleObjPred() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
helper.redirectLog( out, LogLevel.ERROR );
JsonInputField bic = new JsonInputField( "color" );
bic.setPath( "$.store.bicycle[?(@.price)].color" );
bic.setType( ValueMetaInterface.TYPE_STRING );
JsonInputMeta meta = createSimpleMeta( "json", bic );
meta.setRemoveSourceField( true );
JsonInput jsonInput = createJsonInput( "json", meta, new Object[] { getBasicTestJson() } );
RowComparatorListener rowComparator = new RowComparatorListener(
new Object[] { "red" } );
jsonInput.addRowListener( rowComparator );
processRows( jsonInput, 2 );
Assert.assertEquals( out.toString(), 0, jsonInput.getErrors() );
Assert.assertEquals( "rows written", 1, jsonInput.getLinesWritten() );
}
示例13: testWaitingtime
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
@Test( timeout = 5000 )
public void testWaitingtime() {
int waitTimes = 3;
Job mockedJob = Mockito.mock( Job.class );
Mockito.when( mockedJob.isStopped() ).thenReturn( false );
JobEntryCheckDbConnections meta = new JobEntryCheckDbConnections();
meta.setParentJob( mockedJob );
meta.setLogLevel( LogLevel.DETAILED );
DatabaseMeta db = new DatabaseMeta( "InMemory H2", "H2", null, null, H2_DATABASE, "-1", null, null );
meta.setConnections( new DatabaseMeta[]{ db } );
meta.setWaittimes( new int[]{ JobEntryCheckDbConnections.UNIT_TIME_SECOND } );
meta.setWaitfors( new String[]{ String.valueOf( waitTimes ) } );
Result result = meta.execute( new Result(), 0 );
Assert.assertTrue( meta.getNow() - meta.getTimeStart() >= waitTimes * 1000 );
Assert.assertTrue( result.getResult() );
}
示例14: testArrayOut
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
@Test
public void testArrayOut() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
helper.redirectLog( out, LogLevel.ERROR );
JsonInputField byc = new JsonInputField( "books (array)" );
byc.setPath( "$.store.book" );
byc.setType( ValueMetaInterface.TYPE_STRING );
JsonInputMeta meta = createSimpleMeta( "json", byc );
meta.setRemoveSourceField( true );
JsonInput jsonInput = createJsonInput( "json", meta, new Object[] { getBasicTestJson() } );
RowComparatorListener rowComparator = new RowComparatorListener(
new Object[] {
"[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":8.95},"
+ "{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99},"
+ "{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\","
+ "\"isbn\":\"0-553-21311-3\",\"price\":8.99},{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\","
+ "\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}]" } );
jsonInput.addRowListener( rowComparator );
processRows( jsonInput, 2 );
Assert.assertEquals( out.toString(), 0, jsonInput.getErrors() );
Assert.assertEquals( "rows written", 1, jsonInput.getLinesWritten() );
}
示例15: testZeroSizeFile
import org.pentaho.di.core.logging.LogLevel; //导入依赖的package包/类
@Test
public void testZeroSizeFile() throws Exception {
ByteArrayOutputStream log = new ByteArrayOutputStream();
helper.redirectLog( log, LogLevel.BASIC );
try ( FileObject fileObj = KettleVFS.getFileObject( BASE_RAM_DIR + "test.json" );
LocaleChange enUs = new LocaleChange( Locale.US ); ) {
fileObj.createFile();
JsonInputField price = new JsonInputField();
price.setName( "price" );
price.setType( ValueMetaInterface.TYPE_NUMBER );
price.setPath( "$..book[*].price" );
JsonInputMeta meta = createSimpleMeta( "in file", price );
meta.setIsAFile( true );
meta.setRemoveSourceField( true );
meta.setIgnoreEmptyFile( false );
JsonInput jsonInput = createJsonInput( "in file", meta, new Object[][] {
new Object[] { BASE_RAM_DIR + "test.json" }
} );
processRows( jsonInput, 1 );
String logMsgs = log.toString();
assertTrue( logMsgs, logMsgs.contains( "is empty!" ) );
} finally {
deleteFiles();
}
}