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

Java BootLogger类代码示例

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

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



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

示例1: run

import io.bootique.log.BootLogger; //导入依赖的package包/类
public CommandOutcome run(Consumer<BQRuntime> beforeShutdownCallback, String... args) {

        BootLogger logger = createBootLogger();
        Bootique bootique = Bootique.app(args).bootLogger(logger);
        configure(bootique);

        BQRuntime runtime = bootique.createRuntime();
        try {
            return runtime.getInstance(Runner.class).run();
        } catch (Exception e) {
            logger.stderr("Error", e);
            return CommandOutcome.failed(1, getStderr());
        } finally {

            try {
                beforeShutdownCallback.accept(runtime);
            }
            finally {
                runtime.shutdown();
            }
        }
    }
 
开发者ID:bootique,项目名称:bootique-bom,代码行数:23,代码来源:BomTestApp.java


示例2: createServer

import io.bootique.log.BootLogger; //导入依赖的package包/类
@Singleton
@Provides
Server createServer(ServerFactory factory,
                    Set<Servlet> servlets,
                    Set<MappedServlet> mappedServlets,
                    Set<Filter> filters,
                    Set<MappedFilter> mappedFilters,
                    Set<EventListener> listeners,
                    Set<MappedListener> mappedListeners,
                    BootLogger bootLogger,
                    ShutdownManager shutdownManager) {

    Server server = factory.createServer(
            allServlets(servlets, mappedServlets),
            allFilters(filters, mappedFilters),
            allListeners(listeners, mappedListeners));

    shutdownManager.addShutdownHook(() -> {
        bootLogger.trace(() -> "stopping Jetty...");
        server.stop();
    });

    return server;
}
 
开发者ID:bootique,项目名称:bootique-jetty,代码行数:25,代码来源:JettyModule.java


示例3: createJVMShutdownHook

import io.bootique.log.BootLogger; //导入依赖的package包/类
private Thread createJVMShutdownHook() {

        // resolve all services needed for shutdown eagerly and outside shutdown thread to ensure that shutdown hook
        // will not fail due to misconfiguration, etc.

        ShutdownManager shutdownManager = this.shutdownManager;
        BootLogger logger = this.bootLogger;

        return new Thread("bootique-shutdown") {

            @Override
            public void run() {
                shutdown(shutdownManager, logger);
            }
        };
    }
 
开发者ID:bootique,项目名称:bootique,代码行数:17,代码来源:Bootique.java


示例4: addJVMShutdownHook

import io.bootique.log.BootLogger; //导入依赖的package包/类
/**
 * Registers a JVM shutdown hook that is delegated to {@link ShutdownManager}.
 *
 * @see Bootique#exec()
 * @since 0.11
 * @deprecated since 0.23 unused as {@link Bootique} class handles JVM-level shutdown events. BQRuntime should not
 * get involved in that.
 */
@Deprecated
public void addJVMShutdownHook() {

    // resolve all Injector services needed for shutdown eagerly and outside
    // shutdown thread to ensure that shutdown hook will not fail due to
    // misconfiguration, etc.

    ShutdownManager shutdownManager = injector.getInstance(ShutdownManager.class);
    BootLogger logger = getBootLogger();

    Runtime.getRuntime().addShutdownHook(new Thread("bootique-shutdown") {

        @Override
        public void run() {
            shutdown(shutdownManager, logger);
        }
    });
}
 
开发者ID:bootique,项目名称:bootique,代码行数:27,代码来源:BQRuntime.java


示例5: configure

import io.bootique.log.BootLogger; //导入依赖的package包/类
@Override
public void configure(Binder binder) {

    BQCoreModule.extend(binder)
            .initAllExtensions()
            .addOption(createConfigOption())
            .addCommand(HelpConfigCommand.class);

    // bind instances
    binder.bind(BootLogger.class).toInstance(Objects.requireNonNull(bootLogger));
    binder.bind(ShutdownManager.class).toInstance(Objects.requireNonNull(shutdownManager));
    binder.bind(String[].class).annotatedWith(Args.class).toInstance(Objects.requireNonNull(args));

    // deprecated, kept for those users who may have injected this in their own code
    binder.bind(Duration.class).annotatedWith(ShutdownTimeout.class)
            .toInstance(Objects.requireNonNull(Duration.ofMillis(10000L)));

    // too much code to create config factory.. extracting it in a provider
    // class...
    binder.bind(ConfigurationFactory.class).toProvider(JsonNodeConfigurationFactoryProvider.class).in(Singleton.class);
}
 
开发者ID:bootique,项目名称:bootique,代码行数:22,代码来源:BQCoreModule.java


示例6: provideExecutionPlanBuilder

import io.bootique.log.BootLogger; //导入依赖的package包/类
@Provides
@Singleton
ExecutionPlanBuilder provideExecutionPlanBuilder(
        Provider<CliFactory> cliFactoryProvider,
        Provider<CommandManager> commandManagerProvider,
        Set<CommandRefDecorated> commandDecorators,
        BootLogger logger,
        ShutdownManager shutdownManager) {

    Provider<ExecutorService> executorProvider = () -> {
        ExecutorService service = Executors.newCachedThreadPool(new CommandDispatchThreadFactory());
        shutdownManager.addShutdownHook(() -> service.shutdownNow());
        return service;
    };

    Map<Class<? extends Command>, CommandDecorator> merged = ExecutionPlanBuilder.mergeDecorators(commandDecorators);
    return new ExecutionPlanBuilder(cliFactoryProvider, commandManagerProvider, executorProvider, merged, logger);
}
 
开发者ID:bootique,项目名称:bootique,代码行数:19,代码来源:BQCoreModule.java


示例7: provideEnvironment

import io.bootique.log.BootLogger; //导入依赖的package包/类
@Provides
@Singleton
Environment provideEnvironment(
        @EnvironmentProperties Map<String, String> diProperties,
        @EnvironmentVariables Map<String, String> diVars,
        Set<DeclaredVariable> declaredVariables,
        BootLogger logger) {

    DefaultEnvironment.Builder environment = DefaultEnvironment.builder(logger);

    if (Boolean.valueOf(diProperties.get(EXCLUDE_SYSTEM_PROPERTIES))) {
        environment.excludeSystemProperties();
    }
    if (Boolean.valueOf(diProperties.containsKey(EXCLUDE_SYSTEM_VARIABLES))) {
        environment.excludeSystemVariables();
    }

    return environment.diProperties(diProperties)
            .diVariables(diVars)
            .declaredVariables(declaredVariables)
            .build();
}
 
开发者ID:bootique,项目名称:bootique,代码行数:23,代码来源:BQCoreModule.java


示例8: MultiCommand

import io.bootique.log.BootLogger; //导入依赖的package包/类
public MultiCommand(
        Command mainCommand,
        CommandDecorator extraCommands,
        Provider<CliFactory> cliFactoryProvider,
        Provider<CommandManager> commandManagerProvider,
        Provider<ExecutorService> executorProvider,
        BootLogger logger) {

    super(mainCommand.getMetadata());

    this.logger = logger;
    this.mainCommand = mainCommand;
    this.cliFactoryProvider = cliFactoryProvider;
    this.commandManagerProvider = commandManagerProvider;
    this.executorProvider = executorProvider;
    this.extraCommands = extraCommands;
}
 
开发者ID:bootique,项目名称:bootique,代码行数:18,代码来源:MultiCommand.java


示例9: JsonNodeConfigurationFactoryProvider

import io.bootique.log.BootLogger; //导入依赖的package包/类
@Inject
public JsonNodeConfigurationFactoryProvider(
        ConfigurationSource configurationSource,
        Environment environment,
        JacksonService jacksonService,
        BootLogger bootLogger,
        Set<OptionMetadata> optionMetadata,
        Set<OptionRefWithConfig> optionDecorators,
        Cli cli) {

    this.configurationSource = configurationSource;
    this.environment = environment;
    this.jacksonService = jacksonService;
    this.bootLogger = bootLogger;
    this.optionMetadata = optionMetadata;
    this.optionDecorators = optionDecorators;
    this.cli = cli;
}
 
开发者ID:bootique,项目名称:bootique,代码行数:19,代码来源:JsonNodeConfigurationFactoryProvider.java


示例10: createDataSource

import io.bootique.log.BootLogger; //导入依赖的package包/类
@Singleton
@Provides
public DataSourceFactory createDataSource(
        ConfigurationFactory configFactory,
        BootLogger bootLogger,
        ShutdownManager shutdownManager,
        Set<DataSourceListener> listeners,
        Injector injector) {

    Map<String, ManagedDataSourceFactory> configs = configFactory
            .config(new TypeRef<Map<String, ManagedDataSourceFactory>>() {
            }, configPrefix);

    LazyDataSourceFactory factory = new LazyDataSourceFactoryFactory(configs).create(injector, listeners);
    shutdownManager.addShutdownHook(() -> {
        bootLogger.trace(() -> "shutting down LazyDataSourceFactory...");
        factory.shutdown();
    });

    return factory;
}
 
开发者ID:bootique,项目名称:bootique-jdbc,代码行数:22,代码来源:JdbcModule.java


示例11: createServer

import io.bootique.log.BootLogger; //导入依赖的package包/类
@Provides
@Singleton
public UndertowServer createServer(Builder builder,
                                   BootLogger bootLogger,
                                   ShutdownManager shutdownManager) {
    UndertowServer server = new UndertowServer(builder);
    shutdownManager.addShutdownHook(() -> {
        bootLogger.trace(() -> "stopping Undertow...");
        server.stop();
    });

    return server;
}
 
开发者ID:bootique,项目名称:bootique-undertow,代码行数:14,代码来源:UndertowModule.java


示例12: ListCommand

import io.bootique.log.BootLogger; //导入依赖的package包/类
@Inject
public ListCommand(Provider<JobRegistry> jobRegistryProvider, BootLogger bootLogger) {
	super(createMetadata());

	this.jobRegistryProvider = jobRegistryProvider;
	this.bootLogger = bootLogger;
}
 
开发者ID:bootique,项目名称:bootique-job,代码行数:8,代码来源:ListCommand.java


示例13: HelpConfigCommand

import io.bootique.log.BootLogger; //导入依赖的package包/类
public HelpConfigCommand(BootLogger bootLogger, Provider<ConfigHelpGenerator> helpGeneratorProvider) {
    super(CommandMetadata
            .builder(HelpConfigCommand.class)
            .description("Prints information about application modules and their configuration options.")
            .shortName('H'));

    this.bootLogger = bootLogger;
    this.helpGeneratorProvider = helpGeneratorProvider;
}
 
开发者ID:bootique,项目名称:bootique,代码行数:10,代码来源:HelpConfigCommand.java


示例14: shutdown

import io.bootique.log.BootLogger; //导入依赖的package包/类
/**
 * Executes Bootique runtime shutdown, allowing all interested DI services to perform cleanup.
 *
 * @since 0.12
 */
public void shutdown() {
    ShutdownManager shutdownManager = injector.getInstance(ShutdownManager.class);
    BootLogger logger = getBootLogger();

    shutdown(shutdownManager, logger);
}
 
开发者ID:bootique,项目名称:bootique,代码行数:12,代码来源:BQRuntime.java


示例15: provideConfigurationSource

import io.bootique.log.BootLogger; //导入依赖的package包/类
@Provides
@Singleton
ConfigurationSource provideConfigurationSource(Cli cli, @DIConfigs Set<String> diConfigs, BootLogger bootLogger) {
    return CliConfigurationSource
            .builder(bootLogger)
            .diConfigs(diConfigs)
            .cliConfigs(cli)
            .build();
}
 
开发者ID:bootique,项目名称:bootique,代码行数:10,代码来源:BQCoreModule.java


示例16: provideTerminal

import io.bootique.log.BootLogger; //导入依赖的package包/类
@Provides
@Singleton
Terminal provideTerminal(BootLogger bootLogger) {

    // very simple OS test...
    boolean isUnix = "/".equals(System.getProperty("file.separator"));
    return isUnix ? new SttyTerminal(bootLogger) : new FixedWidthTerminal(TTY_DEFAULT_COLUMNS);
}
 
开发者ID:bootique,项目名称:bootique,代码行数:9,代码来源:BQCoreModule.java


示例17: createManager

import io.bootique.log.BootLogger; //导入依赖的package包/类
@Provides
@Singleton
CommandManager createManager(Set<Command> moduleCommands,
                             @ExtraCommands Set<Command> extraCommands,
                             HelpCommand helpCommand,
                             Injector injector,
                             BootLogger bootLogger) {

    return new CommandManagerWithOverridesBuilder(moduleCommands, bootLogger)
            .defaultCommand(defaultCommand(injector))
            .helpCommand(helpCommand)
            .hideBaseCommands(noModuleCommands)
            .overrideWith(extraCommands)
            .build();
}
 
开发者ID:bootique,项目名称:bootique,代码行数:16,代码来源:Commands.java


示例18: ExecutionPlanBuilder

import io.bootique.log.BootLogger; //导入依赖的package包/类
public ExecutionPlanBuilder(
        Provider<CliFactory> cliFactoryProvider,
        Provider<CommandManager> commandManagerProvider,
        Provider<ExecutorService> executorProvider,
        Map<Class<? extends Command>, CommandDecorator> decorators,
        BootLogger logger) {

    this.logger = logger;
    this.decorators = decorators;
    this.cliFactoryProvider = cliFactoryProvider;
    this.commandManagerProvider = commandManagerProvider;
    this.executorProvider = executorProvider;
}
 
开发者ID:bootique,项目名称:bootique,代码行数:14,代码来源:ExecutionPlanBuilder.java


示例19: testDeclaredVar_InHelp

import io.bootique.log.BootLogger; //导入依赖的package包/类
@Test
public void testDeclaredVar_InHelp() {

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ByteArrayOutputStream err = new ByteArrayOutputStream();
    BootLogger logger = new DefaultBootLogger(false, new PrintStream(out), new PrintStream(err));

    BQModuleProvider configurableProvider = new BQModuleProvider() {
        @Override
        public Module module() {
            return b -> {
            };
        }

        @Override
        public Map<String, Type> configs() {
            return Collections.singletonMap("x", Bean5.class);
        }
    };

    BQRuntime runtime = testFactory.app()
            .module(configurableProvider)
            .declareVar("x.m", "X_VALID_VAR")
            .declareVar("x.y.prop", "X_INVALID_VAR")
            .bootLogger(logger)
            .createRuntime();

    Cli cli = runtime.getInstance(Cli.class);
    runtime.getInstance(HelpCommand.class).run(cli);

    String help = new String(out.toByteArray());
    assertTrue("No ENVIRONMENT section:\n" + help, help.contains("ENVIRONMENT"));
    assertTrue(help.contains("X_VALID_VAR"));
    assertFalse(help.contains("X_INVALID_VAR"));
}
 
开发者ID:bootique,项目名称:bootique,代码行数:36,代码来源:Bootique_VarsIT.java


示例20: testDeclaredVar_InHelpWithMap

import io.bootique.log.BootLogger; //导入依赖的package包/类
@Test
@Ignore
public void testDeclaredVar_InHelpWithMap() {

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ByteArrayOutputStream err = new ByteArrayOutputStream();
    BootLogger logger = new DefaultBootLogger(false, new PrintStream(out), new PrintStream(err));

    BQModuleProvider configurableProvider = new BQModuleProvider() {
        @Override
        public Module module() {
            return b -> {
            };
        }

        @Override
        public Map<String, Type> configs() {
            return Collections.singletonMap("x", Bean4.class);
        }
    };

    BQRuntime runtime = testFactory.app()
            .module(configurableProvider)
            .declareVar("x.m.prop", "X_VALID_VAR")
            .declareVar("x.m.prop.x", "X_INVALID_VAR")
            .bootLogger(logger)
            .createRuntime();

    Cli cli = runtime.getInstance(Cli.class);
    runtime.getInstance(HelpCommand.class).run(cli);

    String help = new String(out.toByteArray());
    assertTrue("No ENVIRONMENT section:\n" + help, help.contains("ENVIRONMENT"));
    assertTrue(help.contains("X_VALID_VAR"));
    assertFalse(help.contains("X_INVALID_VAR"));
}
 
开发者ID:bootique,项目名称:bootique,代码行数:37,代码来源:Bootique_VarsIT.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java RelDataType类代码示例发布时间:2022-05-22
下一篇:
Java ParserException类代码示例发布时间: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