当前位置: 首页>>代码示例>>Java>>正文


Java LogWriter.isBasic方法代码示例

本文整理汇总了Java中org.pentaho.di.core.logging.LogWriter.isBasic方法的典型用法代码示例。如果您正苦于以下问题:Java LogWriter.isBasic方法的具体用法?Java LogWriter.isBasic怎么用?Java LogWriter.isBasic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.core.logging.LogWriter的用法示例。


在下文中一共展示了LogWriter.isBasic方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initLogging

import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的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);

	LogWriter.setConsoleAppenderDebug();
	LogWriter log;
	if (Const.isEmpty(optionLogfile)) {
		log = LogWriter.getInstance(Const.SPOON_LOG_FILE, false, LogWriter.LOG_LEVEL_BASIC);
	} else {
		log = LogWriter.getInstance(optionLogfile.toString(), true, LogWriter.LOG_LEVEL_BASIC);
	}

	if (log.getRealFilename() != null) {
		if (log.isBasic())
			log.logBasic(APP_NAME, Messages.getString("Spoon.Log.LoggingToFile") + log.getRealFilename());// "Logging goes to "
	}

	if (!Const.isEmpty(optionLoglevel)) {
		log.setLogLevel(optionLoglevel.toString());
		if (log.isBasic())
			log.logBasic(APP_NAME, Messages.getString("Spoon.Log.LoggingAtLevel") + log.getLogLevelDesc());// "Logging is at level : "
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:27,代码来源:Spoon.java

示例2: 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;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:38,代码来源:JobEntryCopyMoveResultFilenames.java

示例3: 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;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:68,代码来源:JobEntryFolderIsEmpty.java

示例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(previousResult!=null)
	{
		try
		{
			int size=previousResult.getResultFiles().size();
			if(log.isBasic())
				log.logBasic(toString(),Messages.getString("JobEntryDeleteResultFilenames.log.FilesFound",""+size));
			if(!specifywildcard)
			{
				// Delete all files
				previousResult.getResultFiles().clear();
				if(log.isDetailed()) log.logDetailed(toString(),Messages.getString("JobEntryDeleteResultFilenames.log.DeletedFiles",""+size));
			}
			else
			{

				 List <ResultFile> resultFiles = result.getResultFilesList();
		        if (resultFiles != null && resultFiles.size() > 0)
		        {
		        	for (Iterator <ResultFile>  it = resultFiles.iterator(); it.hasNext() && !parentJob.isStopped();)
		            {
		        	  ResultFile resultFile = (ResultFile) it.next();
		              FileObject file = resultFile.getFile();
		              if (file != null && file.exists())
		              {
		            	if(CheckFileWildcard(file.getName().getBaseName(), environmentSubstitute(wildcard),true) 
		            			&& !CheckFileWildcard(file.getName().getBaseName(),  environmentSubstitute(wildcardexclude),false))
		  				{
		            		// Remove file from result files list
							result.getResultFiles().remove(resultFile.getFile().toString());
							
		            		if(log.isDetailed()) log.logDetailed(toString(),Messages.getString("JobEntryDeleteResultFilenames.log.DeletedFile",file.toString()));
		  				}  
		            	 
		              }
		            }
		        }     
			}
			result.setResult(true);
		}
		catch(Exception e)
		{
			log.logError(toString(), Messages.getString("JobEntryDeleteResultFilenames.Error",e.toString()));
		}
	}	
	return result;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:54,代码来源:JobEntryDeleteResultFilenames.java

示例5: execute

import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
public Result execute(Result result, int nr, Repository rep, Job parentJob) throws KettleException {
   LogWriter log = LogWriter.getInstance();
   List<RowMetaAndData> rows = result.getRows();
   RowMetaAndData resultRow = null;

   int nrErrFiles = 0;
   result.setResult(true);


   if(deleteallbefore)
{
   	// clear result filenames
   	int size=result.getResultFiles().size();
   	if(log.isBasic()) log.logBasic(toString(),Messages.getString("JobEntryAddResultFilenames.log.FilesFound",""+size));

	result.getResultFiles().clear();
	if(log.isDetailed()) log.logDetailed(toString(),Messages.getString("JobEntryAddResultFilenames.log.DeletedFiles",""+size));
}
   
   
   if (argFromPrevious) 
   {
   	if(log.isDetailed()) 
   		log.logDetailed(toString(), Messages.getString("JobEntryAddResultFilenames.FoundPreviousRows", String.valueOf((rows != null ? rows.size() : 0)))); //$NON-NLS-1$
   }

   if (argFromPrevious && rows != null) // Copy the input row to the (command line) arguments
   {   	        
     for (int iteration = 0; iteration < rows.size() && !parentJob.isStopped(); iteration++) {
   	  resultRow = rows.get(iteration);

   	 // Get values from previous result 
       String filefolder_previous = resultRow.getString(0,null);
       String fmasks_previous = resultRow.getString(1,null);       

        // ok we can process this file/folder
       if(log.isDetailed()) log.logDetailed(toString(), Messages.getString("JobEntryAddResultFilenames.ProcessingRow", filefolder_previous, fmasks_previous)); //$NON-NLS-1$

         if (!ProcessFile(filefolder_previous, fmasks_previous,parentJob,result, log)) {
       	  nrErrFiles++;
         }
      
     }
   } else if (arguments != null) {

     for (int i = 0; i < arguments.length  && !parentJob.isStopped(); i++) {
       
         // ok we can process this file/folder
   	  if(log.isDetailed()) log.logDetailed(toString(), Messages.getString("JobEntryAddResultFilenames.ProcessingArg", arguments[i], filemasks[i])); //$NON-NLS-1$
         if (!ProcessFile(arguments[i], filemasks[i],parentJob,result, log)) {
       	  nrErrFiles++;
         }
     }
   }
  

   if (nrErrFiles>0)
   {
   	result.setResult(false);
   	result.setNrErrors(nrErrFiles);
   }
   

   return result;
 }
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:66,代码来源:JobEntryAddResultFilenames.java

示例6: deleteFolder

import org.pentaho.di.core.logging.LogWriter; //导入方法依赖的package包/类
private boolean deleteFolder(String foldername) {
  LogWriter log = LogWriter.getInstance();

  boolean rcode = false;
  FileObject filefolder = null;

  try {
    filefolder = KettleVFS.getFileObject(foldername);

    // 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("JobEntryDeleteFolders.ProcessingFolder", foldername)); //$NON-NLS-1$
        // Delete Files
        int Nr = filefolder.delete(new TextFileSelector());

        if (log.isDetailed())
          log.logDetailed(toString(), Messages.getString("JobEntryDeleteFolders.TotalDeleted", foldername,String.valueOf(Nr))); //$NON-NLS-1$
        rcode = true;
      } else {
      	// Error...This file is not a folder!
      	log.logError(toString(), Messages.getString("JobEntryDeleteFolders.Error.NotFolder"));
      }
    } else {
      // File already deleted, no reason to try to delete it
  	  if(log.isBasic()) log.logBasic(toString(), Messages.getString("JobEntryDeleteFolders.FolderAlreadyDeleted", foldername)); //$NON-NLS-1$
      rcode = true;
    }
  } catch (IOException e) {
    log.logError(toString(), Messages.getString("JobEntryDeleteFolders.CouldNotDelete", foldername, e.getMessage())); //$NON-NLS-1$
  } finally {
    if (filefolder != null) {
      try {
        filefolder.close();
      } catch (IOException ex) {
      };
    }
  }

  return rcode;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:51,代码来源:JobEntryDeleteFolders.java

示例7: 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();

           FileObject fileObject = null;
           try {
           	fileObject = KettleVFS.getFileObject(realFilename);

			if ( ! fileObject.exists() )
			{
				if ( isFailIfFileNotExists() )
				{
					// File doesn't exist and fail flag is on.
				    result.setResult( false );
				    log.logError(toString(), Messages.getString("JobEntryDeleteFile.ERROR_0004_File_Does_Not_Exist", realFilename)); //$NON-NLS-1$
				}
				else
				{
					// File already deleted, no reason to try to delete it
				    result.setResult( true );
				    if(log.isBasic()) log.logBasic(toString(), Messages.getString("JobEntryDeleteFile.File_Already_Deleted", realFilename)); //$NON-NLS-1$
				}
			}
			else
			{
				// 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();

			    boolean deleted = fileObject.delete();
			    if ( ! deleted )
			    {
					log.logError(toString(), Messages.getString("JobEntryDeleteFile.ERROR_0005_Could_Not_Delete_File", realFilename)); //$NON-NLS-1$
					result.setResult( false );
					result.setNrErrors(1);
			    }
			    if(log.isBasic()) log.logBasic(toString(), Messages.getString("JobEntryDeleteFile.File_Deleted", realFilename)); //$NON-NLS-1$
				result.setResult( true );
			}
		}
           catch (IOException e) {
			log.logError(toString(), Messages.getString("JobEntryDeleteFile.ERROR_0006_Exception_Deleting_File", realFilename, e.getMessage())); //$NON-NLS-1$
			result.setResult( false );
			result.setNrErrors(1);
		}
           finally {
           	if ( fileObject != null )
           	{
           		try  {
           		     fileObject.close();
           		}
           		catch ( IOException ex ) {};
           	}
           }
	}
	else
	{
		log.logError(toString(), Messages.getString("JobEntryDeleteFile.ERROR_0007_No_Filename_Is_Defined")); //$NON-NLS-1$
	}

	return result;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:71,代码来源:JobEntryDeleteFile.java

示例8: 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;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:64,代码来源:JobEntryDeleteFiles.java


注:本文中的org.pentaho.di.core.logging.LogWriter.isBasic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。