本文整理汇总了Java中org.pentaho.di.core.logging.LogWriter.logError方法的典型用法代码示例。如果您正苦于以下问题:Java LogWriter.logError方法的具体用法?Java LogWriter.logError怎么用?Java LogWriter.logError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.logging.LogWriter
的用法示例。
在下文中一共展示了LogWriter.logError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTableFields
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
public RowMetaInterface getTableFields()
{
LogWriter log = LogWriter.getInstance();
RowMetaInterface fields = null;
if (databaseMeta!=null)
{
Database db = new Database(databaseMeta);
databases = new Database[] { db }; // Keep track of this one for cancelQuery
try
{
db.connect();
String schemaTable = databaseMeta.getQuotedSchemaTableCombination(schemaName, tablename);
fields = db.getTableFields(schemaTable);
}
catch(KettleDatabaseException dbe)
{
log.logError(toString(), Messages.getString("DatabaseLookupMeta.ERROR0004.ErrorGettingTableFields")+dbe.getMessage()); //$NON-NLS-1$
}
finally
{
db.disconnect();
}
}
return fields;
}
示例2: evaluate
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
public boolean evaluate(Result result) {
LogWriter log = LogWriter.getInstance();
String Returnmessage = null;
String RealMessageabort = environmentSubstitute(getMessageabort());
try {
// Return False
if (RealMessageabort == null) {
Returnmessage = Messages.getString("JobEntryAbort.Meta.CheckResult.Label"); //$NON-NLS-1$
} else {
Returnmessage = RealMessageabort;
}
log.logError(toString(), Returnmessage);
result.setNrErrors(1);
return false;
} catch (Exception e) {
result.setNrErrors(1);
log.logError(toString(), Messages.getString("JobEntryAbort.Meta.CheckResult.CouldNotExecute") + e.toString()); //$NON-NLS-1$
return false;
}
}
示例3: main
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
public static void main(String[] args)
{
Display display = new Display();
LogWriter log = LogWriter.getInstance();
PropsUI.init(display, Props.TYPE_PROPERTIES_SPOON);
Translator translator = new Translator(display);
translator.open();
try
{
while (!display.isDisposed ())
{
if (!display.readAndDispatch()) display.sleep ();
}
}
catch(Throwable e)
{
log.logError(APP_NAME, "An unexpected error occurred : "+e.getMessage());
log.logError(APP_NAME, Const.getStackTracker(e));
}
}
示例4: execute
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
public Result execute(Result previousResult, int nr, Repository rep, Job parentJob)
{
LogWriter log = LogWriter.getInstance();
Result result = previousResult;
result.setResult( false );
if (filename!=null)
{
String realFilename = getRealFilename();
try
{
FileObject file = KettleVFS.getFileObject(realFilename);
if (file.exists() && file.isReadable())
{
log.logDetailed(toString(), Messages.getString("JobEntryFileExists.File_Exists", realFilename)); //$NON-NLS-1$
result.setResult( true );
}
else
{
log.logDetailed(toString(), Messages.getString("JobEntryFileExists.File_Does_Not_Exist", realFilename)); //$NON-NLS-1$
}
}
catch (IOException e)
{
result.setNrErrors(1);
log.logError(toString(), Messages.getString("JobEntryFileExists.ERROR_0004_IO_Exception", e.toString())); //$NON-NLS-1$
}
}
else
{
result.setNrErrors(1);
log.logError(toString(), Messages.getString("JobEntryFileExists.ERROR_0005_No_Filename_Defined")); //$NON-NLS-1$
}
return result;
}
示例5: setLog
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
private void setLog(LogWriter log, int loglevel, StringBuffer msg)
{
switch (loglevel) {
case LogWriter.LOG_LEVEL_ERROR:
// Output message to log
// Log level = ERREUR
log.logError(toString(), msg.toString());
break;
case LogWriter.LOG_LEVEL_MINIMAL:
// Output message to log
// Log level = MINIMAL
log.logMinimal(toString(), msg.toString());
break;
case LogWriter.LOG_LEVEL_BASIC:
// Output message to log
// Log level = BASIC
log.logBasic(toString(), msg.toString());
break;
case LogWriter.LOG_LEVEL_DETAILED:
// Output message to log
// Log level = DETAILED
log.logDetailed(toString(), msg.toString());
break;
case LogWriter.LOG_LEVEL_DEBUG:
// Output message to log
// Log level = DEBUG
log.logDebug(toString(), msg.toString());
break;
case LogWriter.LOG_LEVEL_ROWLEVEL:
// Output message to log
// Log level = ROW LEVEL
log.logRowlevel(toString(), msg.toString());
break;
default:
// Output message to log
// Log level = BASIC
log.logBasic(toString(), msg.toString());
break;
}
}
示例6: checkOneFile
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
private boolean checkOneFile(FileObject file, LogWriter log,Result result,Job parentJob)
{
boolean retval=false;
try
{
// We deal with a file..so let's check if it's well formed
boolean retformed=CheckWellFormed(file,log);
if(!retformed)
{
log.logError(toString(), Messages.getString("JobXMLWellFormed.Error.FileBadFormed",file.toString()));
// Update Bad formed files number
updateBadFormed();
if(resultfilenames.equals(ADD_ALL_FILENAMES) || resultfilenames.equals(ADD_BAD_FORMED_FILES_ONLY))
addFileToResultFilenames(KettleVFS.getFilename(file),log,result,parentJob);
}else
{
if(log.isDetailed())
{
log.logDetailed(toString(), "---------------------------");
log.logDetailed(toString(), Messages.getString("JobXMLWellFormed.Error.FileWellFormed",file.toString()));
}
// Update Well formed files number
updateWellFormed();
if(resultfilenames.equals(ADD_ALL_FILENAMES) || resultfilenames.equals(ADD_WELL_FORMED_FILES_ONLY))
addFileToResultFilenames(KettleVFS.getFilename(file),log,result,parentJob);
}
}catch (Exception e){}
return retval;
}
示例7: CreateDestinationFolder
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
private boolean CreateDestinationFolder(String foldername,LogWriter log)
{
FileObject folder=null;
try
{
folder=KettleVFS.getFileObject(foldername);
if(!folder.exists())
{
log.logError(toString(), Messages.getString("JobEntryCopyMoveResultFilenames.Log.FolderNotExists", foldername));
if(isCreateDestinationFolder())
folder.createFolder();
else
return false;
if(log.isBasic()) log.logBasic(toString(), Messages.getString("JobEntryCopyMoveResultFilenames.Log.FolderCreated",foldername));
}else
{
if(log.isDetailed())
log.logDetailed(toString(), Messages.getString("JobEntryCopyMoveResultFilenames.Log.FolderExists",foldername));
}
return true;
}
catch (Exception e) {
log.logError(toString(), Messages.getString("JobEntryCopyMoveResultFilenames.Log.CanNotCreatedFolder", foldername,e.toString()));
}
finally {
if ( folder != null )
{
try {
folder.close();
}
catch (Exception ex ) {};
}
}
return false;
}
示例8: getTableFields
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
public RowMetaInterface getTableFields()
{
LogWriter log = LogWriter.getInstance();
// Build a dummy parameter row...
//
RowMetaInterface param = new RowMeta();
for (int i=0;i<parameterField.length;i++)
{
param.addValueMeta( new ValueMeta(parameterField[i], parameterType[i]) );
}
RowMetaInterface fields = null;
if (databaseMeta!=null)
{
Database db = new Database(databaseMeta);
databases = new Database[] { db }; // Keep track of this one for cancelQuery
try
{
db.connect();
fields = db.getQueryFields(sql, true, param, new Object[param.size()]);
}
catch(KettleDatabaseException dbe)
{
log.logError(toString(), Messages.getString("DatabaseJoinMeta.Log.DatabaseErrorOccurred")+dbe.getMessage()); //$NON-NLS-1$
}
finally
{
db.disconnect();
}
}
return fields;
}
示例9: TruncateTables
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
private boolean TruncateTables(LogWriter log,String tablename, String schemaname, Database db)
{
boolean retval=false;
String realSchemaname=schemaname;
String realTablename=tablename;
try{
if(!Const.isEmpty(realSchemaname))
realTablename = db.getDatabaseMeta().getQuotedSchemaTableCombination(realSchemaname, realTablename);
// check if table exists!
if(db.checkTableExists(realTablename)){
if(!Const.isEmpty(realSchemaname))
db.truncateTable(realSchemaname, tablename);
else
db.truncateTable(tablename);
if(log.isDetailed()) log.logDetailed(toString(), Messages.getString("JobEntryTruncateTables.Log.TableTruncated",realTablename));
retval=true;
}else{
log.logError(toString(), Messages.getString("JobEntryTruncateTables.Error.CanNotFindTable",realTablename));
}
}catch (Exception e)
{
log.logError(toString(), Messages.getString("JobEntryTruncateTables.Error.CanNotTruncateTables",realTablename,e.toString()));
}
return retval;
}
示例10: getCommandLineArgs
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
public static CommandLineOption[] getCommandLineArgs(List<String> args) {
CommandLineOption[] clOptions = new CommandLineOption[] { new CommandLineOption("rep", "Repository name", new StringBuffer()), new CommandLineOption("user", "Repository username", new StringBuffer()),
new CommandLineOption("pass", "Repository password", new StringBuffer()), new CommandLineOption("job", "The name of the job to launch", new StringBuffer()),
new CommandLineOption("trans", "The name of the transformation to launch", new StringBuffer()), new CommandLineOption("dir", "The directory (don't forget the leading /)", new StringBuffer()),
new CommandLineOption("file", "The filename (Transformation in XML) to launch", new StringBuffer()), new CommandLineOption("level", "The logging level (Basic, Detailed, Debug, Rowlevel, Error, Nothing)", new StringBuffer()),
new CommandLineOption("logfile", "The logging file to write to", new StringBuffer()), new CommandLineOption("log", "The logging file to write to (deprecated)", new StringBuffer(), false, true), };
LogWriter log;
LogWriter.setConsoleAppenderDebug();
// start with the default logger until we find out otherwise
log = LogWriter.getInstance(LogWriter.LOG_LEVEL_BASIC);
// Parse the options...
if (!CommandLineOption.parseArguments(args, clOptions, log)) {
log.logError("Spoon", "Command line option not understood");
System.exit(8);
}
String kettleRepname = Const.getEnvironmentVariable("KETTLE_REPOSITORY", null);
String kettleUsername = Const.getEnvironmentVariable("KETTLE_USER", null);
String kettlePassword = Const.getEnvironmentVariable("KETTLE_PASSWORD", null);
if (!Const.isEmpty(kettleRepname))
clOptions[0].setArgument(new StringBuffer(kettleRepname));
if (!Const.isEmpty(kettleUsername))
clOptions[1].setArgument(new StringBuffer(kettleUsername));
if (!Const.isEmpty(kettlePassword))
clOptions[2].setArgument(new StringBuffer(kettlePassword));
return clOptions;
}
示例11: addFileToResultFilenames
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
private void addFileToResultFilenames(String fileaddentry,LogWriter log,Result result,Job parentJob)
{
try{
ResultFile resultFile = new ResultFile(ResultFile.FILE_TYPE_GENERAL, KettleVFS.getFileObject(fileaddentry), parentJob.getJobname(), toString());
result.getResultFiles().put(resultFile.getFile().toString(), resultFile);
if(log.isDebug()){
log.logDebug(toString()," ------ ");
log.logDebug(toString(),Messages.getString("JobEntryMSAccessBulkLoad.Log.FileAddedToResultFilesName",fileaddentry));
}
}catch (Exception e){
log.logError(Messages.getString("JobEntryMSAccessBulkLoad.Error.AddingToFilenameResult"),fileaddentry + ""+e.getMessage());
}
}
示例12: processOneFolder
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
private boolean processOneFolder(Job parentJob,Result result,LogWriter log,
RepositoryDirectory repdir,String realoutfilename, int folderno, int totalfolders)
{
boolean retval=false;
try{
if(!repdir.isRoot())
{
if(repdir.toString().lastIndexOf("/")==0)
{
String filename=repdir.toString().replace("/", "");
String foldername=realoutfilename;
if(newfolder)
{
foldername=realoutfilename + Const.FILE_SEPARATOR + filename;
this.file=KettleVFS.getFileObject(foldername);
if(!this.file.exists())
{
this.file.createFolder();
}
}
filename=foldername+ Const.FILE_SEPARATOR + buildFilename(filename)+".xml";
this.file=KettleVFS.getFileObject(filename);
if(this.file.exists())
{
if(iffileexists.equals(If_FileExists_Skip)){
// Skip this folder
return true;
}else if(iffileexists.equals(If_FileExists_Uniquename)){
filename=realoutfilename+ Const.FILE_SEPARATOR + buildUniqueFilename(filename)+".xml";
}else if(iffileexists.equals(If_FileExists_Fail)){
// Fail
return false;
}
}
//System.out.print(filename + "\n");
if(log.isDetailed())
{
log.logDetailed(toString(),"---");
log.logDetailed(toString(), Messages.getString("JobExportRepository.Log.FolderProcessing",""+folderno,""+ totalfolders));
log.logDetailed(toString(), Messages.getString("JobExportRepository.Log.OutFilename",repdir.toString(),filename));
}
//System.out.println("Directory ID #"+d+" : "+dirids[d]+" : "+repdir + "\n");
this.repo.exportAllObjects(null, filename, repdir, "all");
if(log.isDetailed()) log.logDetailed(toString(), Messages.getString("JobExportRepository.Log.OutFilenameEnd",repdir.toString(),filename));
if(add_result_filesname) addFileToResultFilenames(filename,log,result,parentJob);
}
} // end if root
retval=true;
}catch(Exception e)
{
// Update errors
updateErrors();
log.logError(toString(),Messages.getString("JobExportRepository.ErrorExportingFolder",repdir.toString(),e.toString()));
}
return retval;
}
示例13: execute
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
public Result execute(Result previousResult, int nr, Repository rep, Job parentJob)
{
LogWriter log = LogWriter.getInstance();
Result result = previousResult;
result.setResult( false );
result.setNrErrors(1);
filescount=0;
folderscount=0;
pattern = null;
if (!Const.isEmpty(getWildcard())) pattern = Pattern.compile(getRealWildcard());
if (foldername!=null)
{
String realFoldername = getRealFoldername();
FileObject FolderObject = null;
try {
FolderObject = KettleVFS.getFileObject(realFoldername);
if ( FolderObject.exists() )
{
//Check if it's a folder
if(FolderObject.getType() == FileType.FOLDER)
{
// File provided is a folder, so we can process ...
FolderObject.findFiles(new TextFileSelector(FolderObject.toString()));
if(log.isBasic()) log.logBasic("Total files", "We found : "+filescount + " file(s)");
if(filescount==0)
{
result.setResult(true);
result.setNrErrors(0);
}
}
else
{
// Not a folder, fail
log.logError("Found files", "[" + realFoldername+"] is not a folder, failing.");
}
}
else
{
// No Folder found
if(log.isBasic()) log.logBasic(toString(), "we can not find ["+realFoldername+"] !");
}
} catch (IOException e) {
log.logError(toString(), "Could not create Folder ["+realFoldername+"], exception: " + e.getMessage());
result.setResult( false );
result.setNrErrors(1);
}
finally {
if ( FolderObject != null )
{
try {
FolderObject.close();
}
catch ( IOException ex ) {};
}
}
}
else
{
log.logError(toString(), "No Foldername is defined.");
}
return result;
}
示例14: ProcessFile
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
private boolean ProcessFile(String filename, String wildcard,Job parentJob) {
LogWriter log = LogWriter.getInstance();
boolean rcode = false;
FileObject filefolder = null;
String realFilefoldername = environmentSubstitute(filename);
String realwildcard = environmentSubstitute(wildcard);
try {
filefolder = KettleVFS.getFileObject(realFilefoldername);
// Here gc() is explicitly called if e.g. createfile is used in the same
// job for the same file. The problem is that after creating the file the
// file object is not properly garbaged collected and thus the file cannot
// be deleted anymore. This is a known problem in the JVM.
System.gc();
if (filefolder.exists()) {
// the file or folder exists
if (filefolder.getType() == FileType.FOLDER)
{
// It's a folder
if (log.isDetailed())
log.logDetailed(toString(), Messages.getString("JobEntryDeleteFiles.ProcessingFolder", realFilefoldername)); //$NON-NLS-1$
// Delete Files
int Nr = filefolder.delete(new TextFileSelector(filefolder.toString(),realwildcard,parentJob));
if (log.isDetailed())
log.logDetailed(toString(), Messages.getString("JobEntryDeleteFiles.TotalDeleted", String.valueOf(Nr))); //$NON-NLS-1$
rcode = true;
} else {
// It's a file
if(log.isDetailed())
log.logDetailed(toString(), Messages.getString("JobEntryDeleteFiles.ProcessingFile", realFilefoldername)); //$NON-NLS-1$
boolean deleted = filefolder.delete();
if (!deleted) {
log.logError(toString(), Messages.getString("JobEntryDeleteFiles.CouldNotDeleteFile", realFilefoldername)); //$NON-NLS-1$
} else {
if(log.isBasic()) log.logBasic(toString(), Messages.getString("JobEntryDeleteFiles.FileDeleted", filename)); //$NON-NLS-1$
rcode = true;
}
}
} else {
// File already deleted, no reason to try to delete it
if(log.isBasic()) log.logBasic(toString(), Messages.getString("JobEntryDeleteFiles.FileAlreadyDeleted", realFilefoldername)); //$NON-NLS-1$
rcode = true;
}
} catch (IOException e) {
log.logError(toString(), Messages.getString("JobEntryDeleteFiles.CouldNotProcess", realFilefoldername, e.getMessage())); //$NON-NLS-1$
} finally {
if (filefolder != null) {
try {
filefolder.close();
} catch (IOException ex) {
}
;
}
}
return rcode;
}
示例15: evaluate
import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
/**
* Output message to job log.
*/
public boolean evaluate(Result result)
{
LogWriter log = LogWriter.getInstance();
try
{
loglevel=loglevel+1;
if (loglevel==LogWriter.LOG_LEVEL_ERROR)
{
// Output message to log
// Log level = ERREUR
log.logError(Const.CR + getRealLogSubject()+ Const.CR, getRealLogMessage()+ Const.CR);
}
else if (loglevel==LogWriter.LOG_LEVEL_MINIMAL)
{
// Output message to log
// Log level = MINIMAL
log.logMinimal(Const.CR + getRealLogSubject()+ Const.CR, getRealLogMessage()+ Const.CR);
}
else if (loglevel==LogWriter.LOG_LEVEL_BASIC)
{
// Output message to log
// Log level = BASIC
log.logBasic(Const.CR + getRealLogSubject()+ Const.CR, getRealLogMessage()+ Const.CR);
}
else if (loglevel==LogWriter.LOG_LEVEL_DETAILED)
{
// Output message to log
// Log level = DETAILED
log.logDetailed(Const.CR + getRealLogSubject()+ Const.CR, getRealLogMessage()+ Const.CR);
}
else if (loglevel==LogWriter.LOG_LEVEL_DEBUG)
{
// Output message to log
// Log level = DEBUG
log.logDebug(Const.CR + getRealLogSubject()+ Const.CR, getRealLogMessage()+ Const.CR);
}
else if (loglevel==LogWriter.LOG_LEVEL_ROWLEVEL)
{
// Output message to log
// Log level = ROWLEVEL
log.logRowlevel(Const.CR + getRealLogSubject()+ Const.CR, getRealLogMessage()+ Const.CR);
}
return true;
}
catch(Exception e)
{
result.setNrErrors(1);
log.logError(Messages.getString("WriteToLog.Error.Label"), Messages.getString("WriteToLog.Error.Description") + " : "+e.toString());
return false;
}
}