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


Java DefaultLogger.setOutputPrintStream方法代码示例

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


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

示例1: altCompile

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
/**
 * Description: compile method that does not maintains the i/o streams after the task is done.
 * This is an alternative for the current compile method for future uses.
 * @param file path of the build xml to be executed
 */
public static void altCompile( String file) {
    
    // File buildFile = new File("build.xml");
    File buildFile = new File(file);
    Project p = new Project();
    p.setUserProperty("ant.file", buildFile.getAbsolutePath());     
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    p.addBuildListener(consoleLogger);
    
    try {
        p.fireBuildStarted();
        p.init();
        ProjectHelper helper = ProjectHelper.getProjectHelper();
        p.addReference("ant.projectHelper", helper);
        helper.parse(p, buildFile);
        p.executeTarget(p.getDefaultTarget());
        p.fireBuildFinished(null);
      
    } catch (Exception e) {}
}
 
开发者ID:bufferhe4d,项目名称:call-IDE,代码行数:29,代码来源:BuildSys.java

示例2: setLogFileAndListener

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
public void setLogFileAndListener(String filename) {
  File logFolder = new File(baseDir, "log");
  if (!logFolder.exists()) {
    logFolder.mkdir();
  }
  File file = new File(baseDir + "/log", filename + "-apply.log");
  final DefaultLogger logger1 = new DefaultLogger();
  try {
    logFile = new FileOutputStream(file);
    ps = new PrintStream(logFile);
    logger1.setOutputPrintStream(ps);
    logger1.setErrorPrintStream(ps);
    logger1.setMessageOutputLevel(Project.MSG_INFO);
    project.addBuildListener(logger1);

    Log4jListener listener = new Log4jListener();
    project.addBuildListener(listener);
  } catch (FileNotFoundException e) {
    logger.error("Error assigning rebuild log file.", e);
  }
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:22,代码来源:AntExecutor.java

示例3: setOBPrintStreamLog

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
@Deprecated
public void setOBPrintStreamLog(PrintStream p) {
  final DefaultLogger logger1 = new DefaultLogger();
  final OBPrintStream ps1 = new OBPrintStream(p);
  final OBPrintStream ps2 = new OBPrintStream(p);
  logger1.setOutputPrintStream(ps1);
  logger1.setErrorPrintStream(ps2);
  logger1.setMessageOutputLevel(Project.MSG_INFO);
  project.addBuildListener(logger1);
  err = ps2;
  log = ps1;

  // force log4j to also print to this response
  // OBLogAppender.setOutputStream(ps1);
  org.openbravo.utils.OBLogAppender.setProject(project);
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:17,代码来源:AntExecutor.java

示例4: init

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
public void init(String _buildFile, String _baseDir) throws Exception {
    project = new Project();
    project.init();
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    project.addBuildListener(consoleLogger);
    if (_baseDir == null)
        _baseDir = new String(".");
    project.setBasedir(_baseDir);
    if (_buildFile == null)
        _buildFile = new String(projectBasePath + File.separator
                + "build.xml");
    ProjectHelper.configureProject(project, new File(_buildFile));
}
 
开发者ID:HongQiQu,项目名称:AndroidAntMakePackage,代码行数:17,代码来源:AntMakeAPK.java

示例5: getBuildListener

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
private BuildListener getBuildListener() {
   if (antListener == null) {
      DefaultLogger logger = new DefaultLogger();
      PrintStream ps = null;
      try {
         ps = new PrintStream(new File("log/bugReportLog.txt").getAbsolutePath());
         ps.print("");
      } catch (FileNotFoundException e) {
         StringWriter sw = new StringWriter();
         e.printStackTrace(new PrintWriter(sw));
         String exceptionDetails = sw.toString();
         LOG.warning(exceptionDetails);
      }
      if (ps == null) {
         logger.setErrorPrintStream(System.err);
         logger.setOutputPrintStream(System.out);
      } else {
         logger.setErrorPrintStream(ps);
         logger.setOutputPrintStream(ps);
      }
      logger.setMessageOutputLevel(Project.MSG_INFO);
      antListener = logger;
   }
   return antListener;
}
 
开发者ID:Loreinator,项目名称:Shuffle-Move,代码行数:26,代码来源:ShuffleModel.java

示例6: newProject

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
private static Project newProject() throws IOException {
    setupBuildFile();
    Project project = new Project();
    project.setUserProperty("ant.file", buildFile.getAbsolutePath());
    project.init();
    DefaultLogger listener = new DefaultLogger();
    listener.setErrorPrintStream(System.err);
    listener.setOutputPrintStream(System.out);
    listener.setMessageOutputLevel(Project.MSG_INFO);
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    project.addReference("ant.projectHelper", helper);
    project.setProperty("ftp.port", String.valueOf(ftpPort));
    project.setProperty("ssh.port", String.valueOf(sshPort));
    helper.parse(project, buildFile);
    project.addBuildListener(listener);
    return project;
}
 
开发者ID:Alexey1Gavrilov,项目名称:ExpectIt,代码行数:18,代码来源:AntHarnessTest.java

示例7: main

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
public static void main(String[] args) {

    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);

    File buildFile = new File("build.xml");
    Project p = new Project();
    p.addBuildListener(consoleLogger);
    p.setUserProperty("ant.file", buildFile.getAbsolutePath());
    p.init();
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);
    p.executeTarget("test");

  }
 
开发者ID:perdian,项目名称:ant-webstart,代码行数:19,代码来源:TestAnt.java

示例8: compile

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
/**
 * Description: compile method that maintains the i/o streams after the task is done.
 * @param file path of the build xml to be executed
 * @param out current output stream
 * @param err current input stream
 */
public static void compile( String file, PrintStream out, PrintStream err) {
    
    // File buildFile = new File("build.xml");
    File buildFile = new File(file);
    Project p = new Project();
    p.setUserProperty("ant.file", buildFile.getAbsolutePath());     
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    
    p.addBuildListener(consoleLogger);
    
    try {
        p.fireBuildStarted();
        p.init();
        ProjectHelper helper = ProjectHelper.getProjectHelper();
        p.addReference("ant.projectHelper", helper);
        helper.parse(p, buildFile);
        p.executeTarget(p.getDefaultTarget());
        p.fireBuildFinished(null);
        System.setErr(err);
        System.setOut(out);
        
        
    } catch (Exception e) {}
}
 
开发者ID:bufferhe4d,项目名称:call-IDE,代码行数:34,代码来源:BuildSys.java

示例9: parse

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
/**
 *
 * build.xml파일을 파싱처리하여
 * 빌드처리 준비상태로 처리한다.
 * 이후 run 함수를 호출하여 빌드를 실행할 수 있다.
 *
 * @작성자 : KYJ
 * @작성일 : 2017. 3. 7.
 */
public void parse() {

	p = new Project();
	p.setUserProperty("ant.file", buildFile.getAbsolutePath());
	p.setUserProperty("encoding", encoding.displayName());

	p.init();
	helper = ProjectHelper.getProjectHelper();
	p.addReference("ant.projectHelper", helper);

	if (baseDir != null && baseDir.exists())
		p.setBaseDir(baseDir);
	else
		p.setBaseDir(buildFile.getParentFile());

	//setting console
	DefaultLogger consoleLogger = getLogger();

	consoleLogger.setOutputPrintStream(new PrintStream(out));
	consoleLogger.setErrorPrintStream(new PrintStream(err));

	consoleLogger.setMessageOutputLevel(Project.MSG_VERBOSE);
	p.addBuildListener(consoleLogger);

	//parse build.xml
	helper.parse(p, buildFile);

	LOGGER.debug("  ##### base dir : " + p.getBaseDir());
	LOGGER.debug("  ##### default target : " + p.getDefaultTarget());

	//append build debugger.
	BuildListener buildListener = getBuildListener();
	if (buildListener != null)
		p.addBuildListener(buildListener);

	wasParse = true;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:47,代码来源:AntJavaCompiler.java

示例10: getConsoleLogger

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
/**
 * @param errorStream  with the error stream
 * @param outputStream with the output stream
 * @return a new console logger with the configured parameters
 */
private DefaultLogger getConsoleLogger(final PrintStream errorStream, final PrintStream outputStream)
{
    final DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(errorStream);
    consoleLogger.setOutputPrintStream(outputStream);
    consoleLogger.setMessageOutputLevel(ConstantsAnt.ANT_LEVEL_LOGGER);

    return consoleLogger;
}
 
开发者ID:BBVA-CIB,项目名称:APIRestGenerator,代码行数:15,代码来源:AbstractAntExecutor.java

示例11: createProject

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
/**
 * Creates a new Ant Project with logging set up.
 * 
 * @return A new Ant Project.
 */
protected Project createProject() {
  Project project = new Project();
  // redirect ant output to System streams
  DefaultLogger consoleLogger = new DefaultLogger();
  consoleLogger.setErrorPrintStream(System.err);
  consoleLogger.setOutputPrintStream(System.out);
  consoleLogger.setMessageOutputLevel(getAntMessageOutputLevel());
  project.addBuildListener(consoleLogger);
  return project;
}
 
开发者ID:massdosage,项目名称:ivysvn,代码行数:16,代码来源:BaseIvyTestCase.java

示例12: setUp

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
/**
 * Discover the build file and set up project execution
 * @throws BuildFileNotFoundException
 * @throws FileNotFoundException 
 */
public void setUp() throws BuildFileNotFoundException, FileNotFoundException{
		
	if(!projectFolder.isDirectory())
		throw new FileNotFoundException("The project folder "+projectFolder.getName()+" is not a directory");
	
	for(File f : projectFolder.listFiles(ff)){
		System.out.println(f.getName());
		if(f.getName().equals("build.xml"))
			buildFile = f;
			break;
	}

	if(buildFile == null)
		throw new BuildFileNotFoundException("The build file for project at: "+projectFolder.getAbsolutePath()+" can not be found");
	
	antProject = new Project();
	antProject.init();
	antProject.setUserProperty("ant.file",buildFile.getAbsolutePath());
	
	projectHelp = ProjectHelper.getProjectHelper();
	antProject.addReference("ant.projectHelper", projectHelp);
	
	projectHelp.parse(antProject, buildFile);
	targets = antProject.getTargets();
	
	if(displayOutPut){
		consoleLogger = new DefaultLogger();
		consoleLogger.setErrorPrintStream(System.err);
		consoleLogger.setOutputPrintStream(System.out);
		consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
		antProject.addBuildListener(consoleLogger);
	}
	
	if(requiresInit)
		antProject.executeTarget(targets.get("init").getName());
		
}
 
开发者ID:N0taN3rd,项目名称:Mutation-Testing-Framework,代码行数:43,代码来源:AntRunner.java

示例13: newProject

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
public static Project newProject() {
    Project project = new Project();
    DefaultLogger logger = new DefaultLogger();
    logger.setMessageOutputLevel(Project.MSG_INFO);
    logger.setOutputPrintStream(System.out);
    logger.setErrorPrintStream(System.out);
    project.addBuildListener(logger);
    return project;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:10,代码来源:TestHelper.java

示例14: setupLogger

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
private static void setupLogger(File antBuildFile, Log logger, Project antProject) throws FileNotFoundException {
  DefaultLogger consoleLogger = new DefaultLogger();
  consoleLogger.setOutputPrintStream(System.out);
  consoleLogger.setErrorPrintStream(System.err);

  addBuildListener(logger, antProject, consoleLogger);

  DefaultLogger fileLogger = new DefaultLogger();
  PrintStream ps = new PrintStream(new FileOutputStream(new File(antBuildFile.getAbsolutePath() + ".log")));
  fileLogger.setOutputPrintStream(ps);
  fileLogger.setErrorPrintStream(ps);

  addBuildListener(logger, antProject, fileLogger);
}
 
开发者ID:orctom,项目名称:was-maven-plugin,代码行数:15,代码来源:AntTaskUtils.java

示例15: createConsoleLogger

import org.apache.tools.ant.DefaultLogger; //导入方法依赖的package包/类
private DefaultLogger createConsoleLogger() {
  DefaultLogger consoleLogger = new DefaultLogger();
  consoleLogger.setErrorPrintStream(System.err);
  consoleLogger.setOutputPrintStream(System.out);
  consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
  return consoleLogger;
}
 
开发者ID:tuhrig,项目名称:DeployMan,代码行数:8,代码来源:Launcher.java


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