• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java HandlerUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.shell.support.logging.HandlerUtils的典型用法代码示例。如果您正苦于以下问题:Java HandlerUtils类的具体用法?Java HandlerUtils怎么用?Java HandlerUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HandlerUtils类属于org.springframework.shell.support.logging包,在下文中一共展示了HandlerUtils类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: HandleHelp

import org.springframework.shell.support.logging.HandlerUtils; //导入依赖的package包/类
private InterpreterResult HandleHelp(JLineShell shell, String st) {
  java.util.logging.StreamHandler sh = null;
  java.util.logging.Logger springLogger = null;
  java.util.logging.Formatter formatter = new java.util.logging.Formatter() {
    public String format(java.util.logging.LogRecord record) {
      return record.getMessage();
    }
  };
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  try {
    sh = new java.util.logging.StreamHandler(baos, formatter);
    springLogger = HandlerUtils.getLogger(org.springframework.shell.core.SimpleParser.class);
    springLogger.addHandler(sh);
    shell.executeCommand(st);
  } catch (Exception e) {
    s_logger.error(e.getMessage(), e);
    return new InterpreterResult(Code.ERROR, e.getMessage());
  }
  finally {
    sh.flush();
    springLogger.removeHandler(sh);
    sh.close();
  }
  return new InterpreterResult(Code.SUCCESS, baos.toString());
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:26,代码来源:LensInterpreter.java


示例2: main

import org.springframework.shell.support.logging.HandlerUtils; //导入依赖的package包/类
public static void main(String[] args) {

		SpringApplication application = new SpringApplication(Application.class);
		application.setAdditionalProfiles("local");

		try {
			BootShim bs = new BootShim(args, application.run(args));
			bs.run();
		} catch (RuntimeException e) {
			throw e;
		} finally {
			HandlerUtils.flushAllHandlers(Logger.getLogger(""));
		}
	}
 
开发者ID:spring-projects,项目名称:spring-data-dev-tools,代码行数:15,代码来源:Application.java


示例3: main

import org.springframework.shell.support.logging.HandlerUtils; //导入依赖的package包/类
public static void main(String[] args) {

        ConfigurableApplicationContext ctx = SpringApplication.run(DemoApplication.class, args);

        try {
            BootShim bs = new BootShim(args,ctx);
            bs.run();
        } catch (RuntimeException e) {
            throw e;
        } finally {
            HandlerUtils.flushAllHandlers(Logger.getLogger(""));
        }
        }
 
开发者ID:jeffellin,项目名称:springshellwithboot,代码行数:14,代码来源:DemoApplication.java


示例4: setupLogging

import org.springframework.shell.support.logging.HandlerUtils; //导入依赖的package包/类
private void setupLogging() {
    Logger rootLogger = Logger.getLogger("");
    HandlerUtils.wrapWithDeferredLogHandler(rootLogger, Level.SEVERE);
    Logger sfwLogger = Logger.getLogger("org.springframework");
    sfwLogger.setLevel(Level.WARNING);
    Logger rooLogger = Logger.getLogger("org.springframework.shell");
    rooLogger.setLevel(Level.FINE);
}
 
开发者ID:jeffellin,项目名称:springshellwithboot,代码行数:9,代码来源:BootShim.java


示例5: doRun

import org.springframework.shell.support.logging.HandlerUtils; //导入依赖的package包/类
private ExitShellRequest doRun() {
    this.stopWatch.start();
    try {

        String[] commandsToExecuteAndThenQuit = this.commandLine.getShellCommandsToExecute();
        ExitShellRequest exitShellRequest;
        if (null != commandsToExecuteAndThenQuit) {

            boolean successful = false;
            exitShellRequest = ExitShellRequest.FATAL_EXIT;

            for (String cmd : commandsToExecuteAndThenQuit) {
                if (!(successful = this.lineShellComponent.executeCommand(cmd).isSuccess()))
                    break;
            }

            if (successful) {
                exitShellRequest = ExitShellRequest.NORMAL_EXIT;
            }
        }
        else if (this.applicationArguments.containsOption("help")) {
            System.out.println(FileUtils.readBanner(ShellCommandLineRunner.class, "/usage.txt"));
            exitShellRequest = ExitShellRequest.NORMAL_EXIT;
        } else {
            this.lineShellComponent.start();
            this.lineShellComponent.promptLoop();
            exitShellRequest = this.lineShellComponent.getExitShellRequest();
            if (exitShellRequest == null) {
                exitShellRequest = ExitShellRequest.NORMAL_EXIT;
            }
            this.lineShellComponent.waitForComplete();
        }

        if (this.lineShellComponent.isDevelopmentMode()) {
            System.out.println("Total execution time: " + this.stopWatch
                    .getLastTaskTimeMillis() + " ms");
        }

        return exitShellRequest;
    } catch (Exception ex) {
        throw new ShellException(ex.getMessage(), ex);
    } finally {
        HandlerUtils.flushAllHandlers(this.logger);
        this.stopWatch.stop();
    }
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:47,代码来源:ShellCommandLineRunner.java


示例6: doRun

import org.springframework.shell.support.logging.HandlerUtils; //导入依赖的package包/类
private ExitShellRequest doRun() {
	this.stopWatch.start();
	try {

		String[] commandsToExecuteAndThenQuit = this.commandLine.getShellCommandsToExecute();
		ExitShellRequest exitShellRequest;
		if (null != commandsToExecuteAndThenQuit) {

			boolean successful = false;
			exitShellRequest = ExitShellRequest.FATAL_EXIT;

			for (String cmd : commandsToExecuteAndThenQuit) {
				if (!(successful = this.lineShellComponent.executeCommand(cmd).isSuccess()))
					break;
			}

			if (successful) {
				exitShellRequest = ExitShellRequest.NORMAL_EXIT;
			}
		}
		else if (this.applicationArguments.containsOption("help")) {
			System.out.println(FileUtils.readBanner(ShellCommandLineRunner.class, "/usage.txt"));
			exitShellRequest = ExitShellRequest.NORMAL_EXIT;
		}
		else {
			this.lineShellComponent.start();
			this.lineShellComponent.promptLoop();
			exitShellRequest = this.lineShellComponent.getExitShellRequest();
			if (exitShellRequest == null) {
				exitShellRequest = ExitShellRequest.NORMAL_EXIT;
			}
			this.lineShellComponent.waitForComplete();
		}

		if (this.lineShellComponent.isDevelopmentMode()) {
			System.out.println("Total execution time: " + this.stopWatch.getLastTaskTimeMillis() + " ms");
		}

		return exitShellRequest;
	}
	catch (Exception ex) {
		throw new ShellException(ex.getMessage(), ex);
	}
	finally {
		HandlerUtils.flushAllHandlers(this.logger);
		this.stopWatch.stop();
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:49,代码来源:ShellCommandLineRunner.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SliceImpl类代码示例发布时间:2022-05-22
下一篇:
Java Index类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap