本文整理匯總了Java中org.slf4j.bridge.SLF4JBridgeHandler.install方法的典型用法代碼示例。如果您正苦於以下問題:Java SLF4JBridgeHandler.install方法的具體用法?Java SLF4JBridgeHandler.install怎麽用?Java SLF4JBridgeHandler.install使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.slf4j.bridge.SLF4JBridgeHandler
的用法示例。
在下文中一共展示了SLF4JBridgeHandler.install方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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();
}
示例5: 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);
}
}
}
示例6: 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();
}
示例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();
}
}
示例8: main
import org.slf4j.bridge.SLF4JBridgeHandler; //導入方法依賴的package包/類
/**
* 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();
}
示例9: main
import org.slf4j.bridge.SLF4JBridgeHandler; //導入方法依賴的package包/類
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();
}
示例10: getResetRootLogger
import org.slf4j.bridge.SLF4JBridgeHandler; //導入方法依賴的package包/類
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;
}
示例11: 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();
}
}
示例12: configure
import org.slf4j.bridge.SLF4JBridgeHandler; //導入方法依賴的package包/類
/**
* 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);
}
示例13: initializeLogging
import org.slf4j.bridge.SLF4JBridgeHandler; //導入方法依賴的package包/類
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);
}
}
}
}
示例14: install
import org.slf4j.bridge.SLF4JBridgeHandler; //導入方法依賴的package包/類
private void install(Level level) {
if (installed) {
return;
}
LogManager.getLogManager().reset();
SLF4JBridgeHandler.install();
logger.setLevel(level);
installed = true;
}
示例15: start
import org.slf4j.bridge.SLF4JBridgeHandler; //導入方法依賴的package包/類
@Override
public void start( BundleContext context ) throws Exception
{
// Remove existing handlers attached to j.u.l root logger
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
}
開發者ID:jitsi,項目名稱:jitsi-videobridge-openfire-plugin,代碼行數:9,代碼來源:SLF4JBridgeHandlerBundleActivator.java