Java 类org.slf4j.bridge.SLF4JBridgeHandler 实例源码

项目:secondbase    文件:JsonLoggerModule.java   
@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);
}
项目:servicebuilder    文件:TestServiceRunnerJetty.java   
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);
    }
项目:servicebuilder    文件:IndexerTest.java   
@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);
    }
项目:servicebuilder    文件:SearcherTest.java   
@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);
}
项目:ccow    文件:CCOWContextListener.java   
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();
}
项目:gossip    文件:GossipLogModule.java   
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);
        }
    }
}
项目:metasfresh    文件:LogManager.java   
/**
 * Initialize Logging
 *
 * @param isClient client
 */
public static void initialize(final boolean isClient)
{
    if (s_initialized.getAndSet(true))
    {
        return;
    }

    //
    // Forward all logs from JUL to SLF4J
    {
        SLF4JBridgeHandler.uninstall();
        SLF4JBridgeHandler.install();
    }

    if (isClient)
    {
        // FRESH-267: in server mode, do not (re)set the loglevels. They are coming out of logback.xml and/or application properties and were probably fine-tuned.
        // resetting them to info might cause the disk to run full.
        setLevel(Level.INFO);
    }
}
项目:xsf    文件:JettyServer.java   
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();
    }
}
项目:jindy    文件:LoggerConfigurator.java   
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);
}
项目:openhab-hdl    文件:CoreActivator.java   
public void start(BundleContext context) throws Exception {
    createUUIDFile();

    String versionString = context.getBundle().getVersion().toString();
    // if the version string contains a qualifier, remove it!
    if (StringUtils.countMatches(versionString, ".") == 3) {
        versionString = StringUtils.substringBeforeLast(versionString, ".");
    }
    createVersionFile(versionString);

    logger.info("openHAB runtime has been started (v{}).", versionString);

    java.util.logging.Logger rootLogger = java.util.logging.LogManager.getLogManager().getLogger("");
    Handler[] handlers = rootLogger.getHandlers();
    for (Handler handler : handlers) {
        rootLogger.removeHandler(handler);
    }

    SLF4JBridgeHandler.install();
}
项目:armeria    文件:ArmeriaGrpcServerInteropTest.java   
/** 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();
}
项目:MoodCat.me-Core    文件:TestPackageAppRunner.java   
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();
}
项目:kazoo-client    文件:LoggingConfig.java   
/**
 * Constructor.
 */
public LoggingConfig() {
   boolean bridgeJULtoSLF4J = ConfigManager.getInstance().getBoolean("logging.bridgeJULtoSLF4J", true);

   if (bridgeJULtoSLF4J) {
      try {
         // Remove existing handlers
         Logger rootLogger = LoggingConfig.getRootLogger();
         Handler[] handlers = rootLogger.getHandlers();
         for (Handler handler : handlers) {
            rootLogger.removeHandler(handler);
         }

         // Install bridge handler as only handler
         SLF4JBridgeHandler bridgeToSlf4j = new SLF4JBridgeHandler();
         rootLogger.addHandler(bridgeToSlf4j);
      } catch (Exception e) {
         System.err.println("Unable to configure java logging due to exception: " + e.getMessage());
         e.printStackTrace();
      }
   }
}
项目:sqlexplorer-vaadin    文件:DemoUI.java   
public static void main(String[] args) throws Exception {
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();
    Server server = new Server(9090);
    ClassList classlist = Configuration.ClassList.setServerDefault(server);
    classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", "org.eclipse.jetty.annotations.AnnotationConfiguration");
    WebAppContext webapp = new WebAppContext();
    webapp.setParentLoaderPriority(true);
    webapp.setConfigurationDiscovered(true);
    webapp.setContextPath("/");
    webapp.setResourceBase("src/main/webapp");
    webapp.setWar("src/main/webapp");       
    ServletHolder servletHolder = webapp.addServlet(DemoUIServlet.class, "/*");
    servletHolder.setAsyncSupported(true);
    servletHolder.setInitParameter("org.atmosphere.cpr.asyncSupport", JSR356AsyncSupport.class.getName());
    server.setHandler(webapp);
    ServerContainer webSocketServer = WebSocketServerContainerInitializer.configureContext(webapp);
    webSocketServer.setDefaultMaxSessionIdleTimeout(10000000);        
    server.start();
    log.info("Browse http://localhost:9090 to see the demo");
    server.join();
}
项目:jMCS    文件:LoggingService.java   
/** 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();
}
项目:scale.commons    文件:OSClientFactory.java   
/**
 * 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();
    }
}
项目:ISAAC    文件:SyncTesting.java   
public static void main(String[] args) throws Exception
{
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();
    AppContext.setup();
    ProfileSyncI ssg = AppContext.getService(SyncServiceGIT.class);
    File localFolder = new File("/mnt/SSD/scratch/gitTesting");
    ssg.setRootLocation(localFolder);

    String username = "username";
    String password = "password";

    ssg.linkAndFetchFromRemote("https://github.com/" + username + "/test.git", username, password);
    ssg.linkAndFetchFromRemote("ssh://" + username + "@csfe.aceworkspace.net:29418/testrepo", username, password);
    ssg.addUntrackedFiles();
    System.out.println("UpdateCommitAndPush result: " + ssg.updateCommitAndPush("mergetest2", username, password, MergeFailOption.FAIL, (String[])null));

    ssg.removeFiles("b");

    System.out.println("Update from remote result: " + ssg.updateFromRemote(username, password, MergeFailOption.FAIL));

    HashMap<String, MergeFailOption> resolutions = new HashMap<>();
    resolutions.put("b", MergeFailOption.KEEP_REMOTE);
    System.out.println("resolve merge failures result: " + ssg.resolveMergeFailures(resolutions));
    System.out.println("UpdateCommitAndPush result: " + ssg.updateCommitAndPush("mergetest2", username, password, MergeFailOption.FAIL, (String[])null));
}
项目:ISAAC    文件:SampleTest.java   
/**
 * Application entry point.
 *
 * @param args the command line arguments
 * @throws Exception the exception
 */
public static void main(String[] args) throws Exception {

  // Set up like ISAAC App.
  SLF4JBridgeHandler.removeHandlersForRootLogger();
  SLF4JBridgeHandler.install();
  AppContext.setup();
  // TODO OTF fix: this needs to be fixed so I don't have to hack it with
  // reflection....(https://jira.ihtsdotools.org/browse/OTFISSUE-11)
  Field f = Hk2Looker.class.getDeclaredField("looker");
  f.setAccessible(true);
  f.set(null, AppContext.getServiceLocator());
  System.setProperty(BdbTerminologyStore.BDB_LOCATION_PROPERTY, new File(
      "../isaac-app/berkeley-db").getAbsolutePath());

  // FHIM Models RS.
  SampleTest tester = new SampleTest();

  tester.shutdown();
}
项目:ISAAC    文件:ListViewRunner.java   
/**
 * @param args
 * @throws IOException
 * @throws ClassNotFoundException
 * @throws IllegalAccessException
 * @throws IllegalArgumentException
 * @throws SecurityException
 * @throws NoSuchFieldException
 */
public static void main(String[] args) throws ClassNotFoundException, IOException, IllegalArgumentException, IllegalAccessException, NoSuchFieldException,
        SecurityException
{
    // Configure Java logging into logback
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();
    AppContext.setup();
    // TODO OTF fix: this needs to be fixed so I don't have to hack it with reflection.... https://jira.ihtsdotools.org/browse/OTFISSUE-11
    Field f = Hk2Looker.class.getDeclaredField("looker");
    f.setAccessible(true);
    f.set(null, AppContext.getServiceLocator());
    System.setProperty(BdbTerminologyStore.BDB_LOCATION_PROPERTY, new File("../../ISAAC-PA/app/berkeley-db").getCanonicalPath());
    System.setProperty(LuceneIndexer.LUCENE_ROOT_LOCATION_PROPERTY, new File("../../ISAAC-PA/app/berkeley-db").getCanonicalPath());
    launch(args);
}
项目:class_3647    文件:JerseyResourceTest.java   
/**
 * Call this method to recreate a jersey test runtime with the following
 * configuration changes to the default.
 * <ul>
 * <li>Enabled logging of HTTP traffic to the STDERR device.</li>
 * <li>Enabled dumping of HTTP traffic entities to the STDERR device.</li>
 * <li>Registered the resource specific as the generic type argument with
 * the Jersey runtime.</li>
 * <li>Registered all provides declared in the
 * <code>chirp.service.providers</code> package.</li>
 * </ul>
 */
@Override
protected Application configure() {
    // enable logging of HTTP traffic
    enable(TestProperties.LOG_TRAFFIC);

    // enable logging of dumped HTTP traffic entities
    enable(TestProperties.DUMP_ENTITY);

    // Jersey uses java.util.logging - bridge to slf4
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();

    // create an instance of the parameterized declared class
    @SuppressWarnings("unchecked")
    final Class<R> resourceClass = (Class<R>) ((ParameterizedType) getClass()
            .getGenericSuperclass()).getActualTypeArguments()[0];

    // ResourceConfig is a Jersey specific javax.ws.rs.core.Application
    // subclass
    return new ResourceConfig().register(resourceClass);

}
项目:raml-tester-uc-servlet    文件:ServerTest.java   
@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();
}
项目:baseline    文件:Logging.java   
private static Logger getResetRootLogger() {
    // reset JUL logging
    LogManager.getLogManager().reset();
    // set JUL to allow *all* logging to be enabled
    // have to do this otherwise it'll filter before slf4j does
    java.util.logging.Logger.getLogger("").setLevel(java.util.logging.Level.FINEST);

    // now, reset the JUL handlers and route its messages to slf4j
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();

    // note that netty by default will use slf4j
    // so we don't have to do anything special to get its output

    // reset the logback system
    Logger root = (Logger) LoggerFactory.getLogger(ROOT_LOGGER_NAME);
    root.setLevel(Level.ALL);
    root.detachAndStopAllAppenders();
    return root;
}
项目:cas-server-security-filter    文件:RequestParameterPolicyEnforcementFilterTests.java   
@Test
public void configureSlf4jLogging() throws ServletException {
    final RequestParameterPolicyEnforcementFilter filter = new RequestParameterPolicyEnforcementFilter();

    // mock up filter config.
    final Set<String> initParameterNames = new HashSet<String>();

    initParameterNames.add(RequestParameterPolicyEnforcementFilter.CHARACTERS_TO_FORBID);
    initParameterNames.add(AbstractSecurityFilter.LOGGER_HANDLER_CLASS_NAME);
    final Enumeration parameterNamesEnumeration = Collections.enumeration(initParameterNames);
    final FilterConfig filterConfig = mock(FilterConfig.class);
    when(filterConfig.getInitParameterNames()).thenReturn(parameterNamesEnumeration);

    when(filterConfig.getInitParameter(RequestParameterPolicyEnforcementFilter.CHARACTERS_TO_FORBID))
            .thenReturn("none");
    when(filterConfig.getInitParameter(RequestParameterPolicyEnforcementFilter.PARAMETERS_TO_CHECK))
            .thenReturn(null);
    when(filterConfig.getInitParameter(AbstractSecurityFilter.LOGGER_HANDLER_CLASS_NAME))
            .thenReturn(SLF4JBridgeHandler.class.getCanonicalName());

    filter.init(filterConfig);
    assertTrue(filter.getLogger().getHandlers().length > 0);
    assertTrue(filter.getLogger().getHandlers()[0] instanceof SLF4JBridgeHandler);
}
项目:raml-tester    文件:ServerTest.java   
@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();
    }
}
项目:anythingworks    文件:Boot.java   
public static void main(String... args) throws Exception {
    Boot boot = new Boot();

    LogManager.getLogManager().reset();
    SLF4JBridgeHandler.install();

    try {
        boot.boot();
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(1);
    }
    //in case of an exception we don't arrive here because of system.exit!
    System.out.println("Stopping normally.");
    System.exit(0);
}
项目:git-server    文件:GitServer.java   
/**
 * Starts a new {@link GitServer} instance on a specified port. You can specify a HTTP port by providing an argument
 * of the form <code>--httpPort=xxxx</code> where <code>xxxx</code> is a port number. If no such argument is
 * specified the HTTP port defaults to 8080.
 * 
 * @param args
 *        The arguments to influence the start-up phase of the {@link GitServer} instance.
 * @throws Exception
 *         In case the {@link GitServer} instance could not be started.
 */
public static void main(String[] args) throws Exception {
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();

    // TODO: Fix this...
    SshSessionFactory.setInstance(new JschConfigSessionFactory() {
        @Override
        protected void configure(Host hc, Session session) {
            session.setConfig("StrictHostKeyChecking", "no");
        }
    });

    Config config = new Config();
    config.reload();

    GitServer server = new GitServer(config);
    server.start();
    server.join();
}
项目:aq-to-amq    文件:PumpMessagesIntoOracleAQTest.java   
@Test
public void pumpMessages() throws Exception {
    java.util.logging.LogManager.getLogManager().getLogger("").setLevel(Level.FINEST);
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();

    log.info("Creating UNIT TEST Class");

    createOracleAQQueue();

    Clob message = CLOB.createTemporary(dbConnection, false, CLOB.DURATION_SESSION);
    message.setString(1, TEST_MESSAGE);

    String plsql = String.format("begin mdb_aq.send_message('" + DB_SCHEMA_NAME + ".%1$s', ?); end;", oracleQueueName);
    CallableStatement statement = dbConnection.prepareCall(plsql);
    statement.setClob(1, message);
    statement.execute();
    statement.close();
    message.free();
}
项目:raml-tester-proxy    文件:TomcatServer.java   
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();
}
项目:udidb    文件:UdidbServer.java   
private static void initializeLogging()
{
    if (!loggingInitialized.get()) {
        synchronized (UdidbServer.class) {
            if (!loggingInitialized.get()) {
                System.setProperty("vertx.logger-delegate-factory-class-name",
                        "io.vertx.core.logging.SLF4JLogDelegateFactory");

                SLF4JBridgeHandler.removeHandlersForRootLogger();

                SLF4JBridgeHandler.install();

                loggingInitialized.set(true);
            }
        }
    }
}
项目:Reer    文件:JavaUtilLoggingSystem.java   
private void install(Level level) {
    if (installed) {
        return;
    }

    LogManager.getLogManager().reset();
    SLF4JBridgeHandler.install();
    logger.setLevel(level);
    installed = true;
}
项目:jbake-rtl-jalaali    文件:Main.java   
protected void run(String[] args) {
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();
    LaunchOptions res = parseArguments( args );

    final CompositeConfiguration config;
    try {
        config = ConfigUtil.load( res.getSource() );
    } catch( final ConfigurationException e ) {
        throw new JBakeException( "Configuration error: " + e.getMessage(), e );
    }

    run(res, config);
}
项目:Alpine    文件:EmbeddedJettyServer.java   
public static void main(String[] args) throws Exception {

        SLF4JBridgeHandler.removeHandlersForRootLogger();
        SLF4JBridgeHandler.install();

        Server server = new Server();
        ServerConnector connector = new ServerConnector(server);
        connector.setPort(8080);
        server.setConnectors(new Connector[]{connector});

        WebAppContext context = new WebAppContext();
        context.setServer(server);
        context.setContextPath("/");
        context.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", ".*/[^/]*taglibs.*\\.jar$");
        context.setAttribute("org.eclipse.jetty.containerInitializers", jspInitializers());
        context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
        context.addBean(new ServletContainerInitializersStarter(context), true);

        // Prevent loading of logging classes
        context.getSystemClasspathPattern().add("org.apache.log4j.");
        context.getSystemClasspathPattern().add("org.slf4j.");
        context.getSystemClasspathPattern().add("org.apache.commons.logging.");

        ProtectionDomain protectionDomain = EmbeddedJettyServer.class.getProtectionDomain();
        URL location = protectionDomain.getCodeSource().getLocation();
        context.setWar(location.toExternalForm());

        server.setHandler(context);
        try {
            server.start();
            server.join();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }
项目:jitsi-videobridge-openfire-plugin    文件:SLF4JBridgeHandlerBundleActivator.java   
@Override
public void start( BundleContext context ) throws Exception
{
    // Remove existing handlers attached to j.u.l root logger
    SLF4JBridgeHandler.removeHandlersForRootLogger();

    SLF4JBridgeHandler.install();
}
项目:dlface    文件:AppInitializer.java   
/**
 * Redirect JUL from third-party libraries to SLF4J
 */
private void redirectJULtoSLF4J() {
    LOGGER.info("Redirecting JUL to SLF4J");
    LogManager.getLogManager().reset();
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();
    java.util.logging.Logger.getGlobal().setLevel(Level.FINEST);
}
项目:Voice_Activated_EV3_Robot    文件:Runner.java   
public static void main(String[] args) throws Exception {
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();

    int port = 8888;
    if (args.length > 0) {
        port = Integer.parseInt(args[0]);
    }
    if (port == 80) {
        System.out.println("Dorset web demo running on http://localhost/");            
    } else {
        System.out.println("Dorset web demo running on http://localhost:" 
                        + String.valueOf(port) + "/");
    }
    Server server = new Server(port);

    WebAppContext context = new WebAppContext();
    context.setServer(server);
    context.setContextPath("/");
    // turn off class loading from WEB-INF due to logging
    context.setParentLoaderPriority(true);

    ProtectionDomain protectionDomain = Runner.class.getProtectionDomain();
    URL location = protectionDomain.getCodeSource().getLocation();
    context.setWar(location.toExternalForm());

    server.setHandler(context);
    server.start();
    server.join();
}
项目:carnotzet    文件:AbstractZetMojo.java   
@Override
public void execute() throws MojoFailureException, MojoExecutionException {
    SLF4JBridgeHandler.install();

    List<CarnotzetExtension> runtimeExtensions = findRuntimeExtensions();

    CarnotzetModuleCoordinates coordinates =
            new CarnotzetModuleCoordinates(project.getGroupId(), project.getArtifactId(), project.getVersion());

    if (instanceId == null) {
        instanceId = Carnotzet.getModuleName(coordinates, Pattern.compile(CarnotzetConfig.DEFAULT_MODULE_FILTER_PATTERN),
                Pattern.compile(CarnotzetConfig.DEFAULT_CLASSIFIER_INCLUDE_PATTERN));
    }

    Path resourcesPath = Paths.get(project.getBuild().getDirectory(), "carnotzet");
    if (SystemUtils.IS_OS_WINDOWS) {
        // we avoid using ${project.build.directory} because "mvn clean" when the sandbox is running would try to delete mounted files,
        // which is not supported on Windows.
        resourcesPath = Paths.get("/var/tmp/carnotzet_" + instanceId);
    }

    CarnotzetConfig config = CarnotzetConfig.builder()
            .topLevelModuleId(coordinates)
            .resourcesPath(resourcesPath)
            .topLevelModuleResourcesPath(project.getBasedir().toPath().resolve("src/main/resources"))
            .failOnDependencyCycle(failOnDependencyCycle)
            .extensions(runtimeExtensions)
            .build();

    carnotzet = new Carnotzet(config);
    if (bindLocalPorts == null) {
        bindLocalPorts = !SystemUtils.IS_OS_LINUX;
    }
    runtime = new DockerComposeRuntime(carnotzet, instanceId, DefaultCommandRunner.INSTANCE, bindLocalPorts);

    executeInternal();

    SLF4JBridgeHandler.uninstall();
}
项目:OperatieBRP    文件:Configurer.java   
/**
 * Configureer JUL.
 */
public final void configure() {
    LOGGER.debug("Configure java.util.logging to log via SLF4j");
    // Remove existing handlers
    SLF4JBridgeHandler.removeHandlersForRootLogger();

    // Install SLF4j bridge
    SLF4JBridgeHandler.install();

    // Uit performance oogpunt sturen we alleen INFO logs door
    LogManager.getLogManager().getLogger("").setLevel(Level.INFO);
}
项目:servicebuilder    文件:ServiceRunner.java   
public ServiceRunner start() {

        SLF4JBridgeHandler.removeHandlersForRootLogger();
        SLF4JBridgeHandler.install();
        jerseyConfig
                .addRegistrators(serviceConfig.registrators)
                .addBinders(serviceConfig.binders);
        serviceConfig.addons.forEach(it -> it.addToJerseyConfig(jerseyConfig));
        serviceConfig.addons.forEach(it -> it.addToJettyServer(jettyServer));
        jettyServer.start();
        return this;
    }
项目:restfb-examples    文件:GraphReaderExample.java   
/**
 * Entry point. You must provide a single argument on the command line: a valid Graph API access token.
 * 
 * @param args
 *          Command-line arguments.
 * @throws IllegalArgumentException
 *           If no command-line arguments are provided.
 */
public static void main(String[] args) {
  if (args.length == 0)
    throw new IllegalArgumentException(
      "You must provide an OAuth access token parameter. See README for more information.");

  SLF4JBridgeHandler.removeHandlersForRootLogger();
  SLF4JBridgeHandler.install();
  new GraphReaderExample(args[0]).runEverything();
}
项目:ph-as4    文件:AS4WebAppListener.java   
@Override
protected void initGlobalSettings ()
{
  // Logging: JUL to SLF4J
  SLF4JBridgeHandler.removeHandlersForRootLogger ();
  SLF4JBridgeHandler.install ();

  if (GlobalDebug.isDebugMode ())
    RequestTracker.getInstance ().getRequestTrackingMgr ().setLongRunningCheckEnabled (false);

  HttpDebugger.setEnabled (false);
}