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


Java SLF4JBridgeHandler.removeHandlersForRootLogger方法代码示例

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


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

示例1: setup

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
@BeforeClass
    public static void setup() throws NodeValidationException, IOException {
        SLF4JBridgeHandler.removeHandlersForRootLogger();
        SLF4JBridgeHandler.install();

        ServiceConfig serviceConfig = ServiceConfig
                .defaults(ServiceDefinitionUtil.simple(Resource.class))
                .addon(ElasticsearchAddonMockImpl.defaults)
//                .addon(ElasticsearchAddonImpl.defaults
//                        .coordinatorPort(9300)
//                        .coordinatorUrl("127.0.0.1")
//                        .clustername("test-search-api-5-local_jonas")
//                        .clientname("banan")
//                        .unitTest(true)
//                )
                .addon(ExceptionMapperAddon.defaults)
                .addon(ServerLogAddon.defaults)
                .addon(ElasticsearchIndexAddon.defaults("oneIndex", TestService.Payload.class)
                        .doIndexing(true)
                )
                .bind(ResourceImpl.class, Resource.class);
        testServiceRunner = TestServiceRunner.defaults(serviceConfig);
        TestServiceRunner.defaults(serviceConfig);
    }
 
开发者ID:code-obos,项目名称:servicebuilder,代码行数:25,代码来源:IndexerTest.java

示例2: start

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
public TestServiceRunnerJetty.Runtime start() {

        SLF4JBridgeHandler.removeHandlersForRootLogger();
        SLF4JBridgeHandler.install();
        ServiceConfig serviceConfigwithProps = serviceConfig.addPropertiesAndApplyToBindings(propertyMap);
        ServiceRunner serviceRunner = new ServiceRunner(serviceConfigwithProps, propertyMap);
        ServiceRunner runningServiceRunner = serviceRunner.start();

        URI uri = runningServiceRunner.jettyServer.server.getURI();
        uri = UriBuilder.fromUri(uri).host("localhost").build();

        ClientGenerator clientGenerator = clientConfigurator.apply(
                ClientGenerator.defaults(serviceConfigwithProps.serviceDefinition)
        );
        Client client = clientGenerator.generate();
        StubGenerator stubGenerator = stubConfigurator.apply(StubGenerator.defaults(client, UriBuilder.fromUri(uri).build()));

        TargetGenerator targetGenerator = targetConfigurator.apply(TargetGenerator.defaults(client, uri));

        return new Runtime(runningServiceRunner, uri, stubGenerator, clientGenerator, targetGenerator);
    }
 
开发者ID:code-obos,项目名称:servicebuilder,代码行数:22,代码来源:TestServiceRunnerJetty.java

示例3: setup

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
@BeforeClass
public static void setup() throws NodeValidationException, UnknownHostException {
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();

    ServiceConfig serviceConfig = ServiceConfig
            .defaults(ServiceDefinitionUtil.simple(Resource.class))
            .addon(ExceptionMapperAddon.defaults)
            .addon(ServerLogAddon.defaults)
            .addon(ElasticsearchAddonMockImpl.defaults)
            .addon(ElasticsearchIndexAddon.defaults("oneIndex", TestService.Payload.class))
            .addon(ElasticsearchIndexAddon.defaults("anotherIndex", String.class))
            .bind(ResourceImpl.class, Resource.class);
    testServiceRunner = TestServiceRunner.defaults(serviceConfig);
    TestServiceRunner.defaults(serviceConfig);
}
 
开发者ID:code-obos,项目名称:servicebuilder,代码行数:17,代码来源:SearcherTest.java

示例4: init

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
@Override
public void init() {
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();
    final List<String> keyList = new LinkedList<>();
    final List<String> valueList = new LinkedList<>();
    if (!Strings.isNullOrEmpty(SecondBase.serviceName)) {
        keyList.add("service");
        valueList.add(SecondBase.serviceName);
    }
    if (!Strings.isNullOrEmpty(SecondBase.environment)) {
        keyList.add("environment");
        valueList.add(SecondBase.environment);
    }
    if (!Strings.isNullOrEmpty(JsonLoggerConfiguration.datacenter)) {
        keyList.add("datacenter");
        valueList.add(JsonLoggerConfiguration.datacenter);
    }
    SecondBaseLogger.setupLoggingStdoutOnly(
            keyList.toArray(new String[] {}),
            valueList.toArray(new String[] {}),
            JsonLoggerConfiguration.requestLoggerClassName,
            true);
}
 
开发者ID:secondbase,项目名称:secondbase,代码行数:25,代码来源:JsonLoggerModule.java

示例5: CCOWContextListener

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
public CCOWContextListener(final ContextState commonContext, final Module... behaviourModules) {
	super();
	SLF4JBridgeHandler.removeHandlersForRootLogger();
	SLF4JBridgeHandler.install();
	logger.info("Starting up servlet ...");
	this.modules = ImmutableList.<Module> builder().add(behaviourModules).add(new EndpointModule(commonContext))
			.add(new JerseyServletModule() {

				@Override
				protected void configureServlets() {
					final Map<String, String> params = ImmutableMap.<String, String> builder()
							.put(ResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS,
									GZIPContentEncodingFilter.class.getName())
							.build();
					bind(CORSFilter.class).in(Singleton.class);
					bind(UrlRewriteFilter.class).in(Singleton.class);
					serve("/*").with(GuiceContainer.class, params);
					filter("/*").through(CORSFilter.class);
					filter("/*").through(UrlRewriteFilter.class);

					requestStaticInjection(WebSocketsConfigurator.class);
				}
			}).build();
}
 
开发者ID:jkiddo,项目名称:ccow,代码行数:25,代码来源:CCOWContextListener.java

示例6: initializeLogback

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
private void initializeLogback() {
    Path logbackFilePath = Paths.get(configPath, "logback.xml");
    if (logbackFilePath.toFile().exists()) {
        try {
            // Load logback configuration
            LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
            context.reset();
            JoranConfigurator configurator = new JoranConfigurator();
            configurator.setContext(context);
            configurator.doConfigure(logbackFilePath.toFile());

            // Install java.util.logging bridge
            SLF4JBridgeHandler.removeHandlersForRootLogger();
            SLF4JBridgeHandler.install();
        } catch (JoranException e) {
            throw new GossipInitializeException("Misconfiguration on logback.xml, check it.", e);
        }
    }
}
 
开发者ID:syhily,项目名称:gossip,代码行数:20,代码来源:GossipLogModule.java

示例7: startIfRequired

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
public static void startIfRequired() throws Exception
{
    if (server == null) {
    	
        SLF4JBridgeHandler.removeHandlersForRootLogger();
        SLF4JBridgeHandler.install();
         
        server = new Server(TEST_PORT);
 
        WebAppContext context = new WebAppContext();
        context.setDescriptor("src/test/resources/jetty/WEB-INF/web.xml");
        context.setResourceBase("src/main/webapp");
        context.setContextPath(TEST_CONTEXT);
        context.setParentLoaderPriority(true);
 
        server.setHandler(context);
 
        server.start();
    }
}
 
开发者ID:xtivia,项目名称:xsf,代码行数:21,代码来源:JettyServer.java

示例8: installJulBridge

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
private void installJulBridge() {
  // Workaround for strange ClassCircularityErrors in the JUL bridge when very
  // strange classloader hierarchies are
  // set up and logging occurs from inside classloaders themselves (eg: some
  // strange Tomcat deployments)
  try {
    Class.forName("java.util.logging.LogRecord");
  } catch (ClassNotFoundException e) {
    throw new AssertionError(e);
  }

  LoggerContext loggerContext = (LoggerContext) getContext();

  if (!SLF4JBridgeHandler.isInstalled()) {
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();
  }
  LevelChangePropagator julLevelChanger = new LevelChangePropagator();
  julLevelChanger.setContext(loggerContext);
  julLevelChanger.setResetJUL(true);
  julLevelChanger.start();
  loggerContext.addListener(julLevelChanger);
}
 
开发者ID:irenical,项目名称:jindy,代码行数:24,代码来源:LoggerConfigurator.java

示例9: startServer

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
/** Starts the server with HTTPS. */
@BeforeClass
public static void startServer() throws Exception {
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();

    ssc = new SelfSignedCertificate("example.com");
    ServerBuilder sb = new ServerBuilder()
            .port(0, SessionProtocol.HTTPS)
            .defaultMaxRequestLength(16 * 1024 * 1024)
            .sslContext(GrpcSslContexts.forServer(ssc.certificate(), ssc.privateKey())
                                       .applicationProtocolConfig(ALPN)
                                       .trustManager(TestUtils.loadCert("ca.pem"))
                                       .build());

    final ArmeriaGrpcServerBuilder builder = new ArmeriaGrpcServerBuilder(sb, new GrpcServiceBuilder(),
                                                                          ctxCapture);
    startStaticServer(builder);
    server = builder.builtServer();
}
 
开发者ID:line,项目名称:armeria,代码行数:21,代码来源:ArmeriaGrpcServerInteropTest.java

示例10: main

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
public static void main(final String... args) throws Exception {
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();

    final App app = new App();
    app.startServer();

    Injector injector = app.getInjector();

    // Bootstrap the database
    final Bootstrapper bootstrappper = injector.getInstance(Bootstrapper.class);
    bootstrappper.parseFromResource("/bootstrap/test-bootstrapper.json");

    // Init inserted rooms
    final RoomBackend roomBackend = injector.getInstance(RoomBackend.class);
    roomBackend.initializeRooms();

    app.joinThread();
}
 
开发者ID:MoodCat,项目名称:MoodCat.me-Core,代码行数:20,代码来源:TestPackageAppRunner.java

示例11: startTomcat

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
@BeforeClass
public static void startTomcat() throws ServletException, LifecycleException {
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();

    tomcat = new Tomcat();
    tomcat.setPort(8081);
    tomcat.setBaseDir(".");
    Context ctx = tomcat.addWebapp("/", "src/main/webapp");
    ctx.setJarScanner(new JarScanner() {
        @Override
        public void scan(ServletContext context, ClassLoader classloader, JarScannerCallback callback, Set<String> jarsToSkip) {
        }
    });
    ((Host) ctx.getParent()).setAppBase("");
    tomcat.start();
    server = tomcat.getServer();
    server.start();
}
 
开发者ID:nidi3,项目名称:raml-tester-uc-servlet,代码行数:20,代码来源:ServerTest.java

示例12: init

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
/** slf4j / Logback initialization */
private static void init() throws SecurityException, IllegalStateException {
    final LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
    final URL logConf = ResourceUtils.getResource(JMMC_LOGBACK_CONFIG_RESOURCE);
    try {
        final JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(loggerContext);
        loggerContext.reset();
        configurator.doConfigure(logConf.openStream());
    } catch (IOException ioe) {
        throw new IllegalStateException("IO Exception occured", ioe);
    } catch (JoranException je) {
        StatusPrinter.printInCaseOfErrorsOrWarnings((LoggerContext) LoggerFactory.getILoggerFactory());
    }

    // Remove existing handlers attached to j.u.l root logger
    SLF4JBridgeHandler.removeHandlersForRootLogger();  // (since SLF4J 1.6.5)

    // add SLF4JBridgeHandler to j.u.l's root logger, should be done once during
    // the initialization phase of your application
    SLF4JBridgeHandler.install();
}
 
开发者ID:JMMC-OpenDev,项目名称:jMCS,代码行数:23,代码来源:LoggingService.java

示例13: OSClientFactory

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
/**
 * Creates an {@link OSClientFactory} with a custom {@link OSClientCreator}.
 *
 * @param apiAccessConfig
 *            API access configuration that describes how to authenticate
 *            with and communicate over the OpenStack API.
 *
 */
public OSClientFactory(ApiAccessConfig apiAccessConfig, OSClientBuilder clientBuilder) {
    checkArgument(apiAccessConfig != null, "no apiAccessConfig given");
    checkArgument(clientBuilder != null, "no clientBuilder given");
    apiAccessConfig.validate();

    this.apiAccessConfig = apiAccessConfig;
    this.clientBuilder = clientBuilder;

    if (apiAccessConfig.shouldLogHttpRequests()) {
        LOG.debug("setting up HTTP request logging");
        // enable logging of each http request from openstack4j
        OSFactory.enableHttpLoggingFilter(true);
        // Install slf4j logging bridge to capture java.util.logging output
        // from the openstack4j. NOTE: the logger appears to be named 'os'.
        SLF4JBridgeHandler.removeHandlersForRootLogger();
        SLF4JBridgeHandler.install();
    }
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:27,代码来源:OSClientFactory.java

示例14: initImpl

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
@Before
public void initImpl() throws LifecycleException, ServletException {
    if (!inited.contains(getClass())) {
        inited.add(getClass());
        SLF4JBridgeHandler.removeHandlersForRootLogger();
        SLF4JBridgeHandler.install();

        tomcat = new Tomcat();
        tomcat.setPort(PORT);
        tomcat.setBaseDir(".");
        final Context ctx = tomcat.addWebapp("", "src/test");
        ctx.setJarScanner(NO_SCAN);
        ((Host) ctx.getParent()).setAppBase("");

        init(ctx);

        tomcat.start();
    }
}
 
开发者ID:nidi3,项目名称:raml-tester,代码行数:20,代码来源:ServerTest.java

示例15: start

import org.slf4j.bridge.SLF4JBridgeHandler; //导入方法依赖的package包/类
private void start() throws LifecycleException, ServletException {
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();

    tomcat = new Tomcat();
    tomcat.setPort(port);
    tomcat.setBaseDir(".");
    Context ctx = tomcat.addWebapp("", Ramls.clientDir("src/test"));
    ctx.setJarScanner(NO_SCAN);
    ((Host) ctx.getParent()).setAppBase("");

    contextIniter.initContext(ctx);

    tomcat.start();
    Server server = tomcat.getServer();
    server.start();
}
 
开发者ID:nidi3,项目名称:raml-tester-proxy,代码行数:18,代码来源:TomcatServer.java


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