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


Java Slf4jLog类代码示例

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


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

示例1: run

import org.eclipse.jetty.util.log.Slf4jLog; //导入依赖的package包/类
public void run() throws Exception {
	org.eclipse.jetty.util.log.Log.setLog(new Slf4jLog());
	Server server = new Server(port);
       ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
       context.setContextPath("/");
       context.setWelcomeFiles(new String[]{ "demo.html" });
       context.setResourceBase(httpPath);
       HashSessionIdManager idmanager = new HashSessionIdManager();
       server.setSessionIdManager(idmanager);
       HashSessionManager manager = new HashSessionManager();
       SessionHandler sessions = new SessionHandler(manager);
       sessions.setHandler(context);
       context.addServlet(new ServletHolder(new Servlet(this::getPinto)),"/pinto/*");
       ServletHolder holderPwd = new ServletHolder("default", DefaultServlet.class);
       context.addServlet(holderPwd,"/*");
       server.setHandler(sessions);
       server.start();
       server.join();
}
 
开发者ID:punkbrwstr,项目名称:pinto,代码行数:20,代码来源:Demo.java

示例2: init

import org.eclipse.jetty.util.log.Slf4jLog; //导入依赖的package包/类
public @NotNull CollectorServer init(@NotNull InetSocketAddress address, @NotNull ExpositionFormat format) {
  try {
    Log.setLog(new Slf4jLog());

    final Server serverInstance = new Server(address);
    format.handler(serverInstance);
    serverInstance.start();

    server = serverInstance;

    Logger.instance.info("Prometheus server with JMX metrics started at " + address);
  } catch (Exception e) {
    Logger.instance.error("Failed to start server at " + address, e);
  }
  return this;
}
 
开发者ID:nolequen,项目名称:jmx-prometheus-exporter,代码行数:17,代码来源:CollectorServer.java

示例3: run

import org.eclipse.jetty.util.log.Slf4jLog; //导入依赖的package包/类
public void run() throws Exception {

		org.eclipse.jetty.util.log.Log.setLog(new Slf4jLog());
		Server server = new Server(port);
        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        context.setContextPath("/");
        context.setResourceBase(httpPath);
        HashSessionIdManager idmanager = new HashSessionIdManager();
        server.setSessionIdManager(idmanager);
        HashSessionManager manager = new HashSessionManager();
        SessionHandler sessions = new SessionHandler(manager);
        sessions.setHandler(context);
        context.addServlet(new ServletHolder(new Servlet(this::getPinto)),"/pinto/*");
        ServletHolder holderPwd = new ServletHolder("default", DefaultServlet.class);
        context.addServlet(holderPwd,"/*");
        server.setHandler(sessions);
		new Thread(new Console(getPinto(),port,build, () -> {
			try {
				server.stop();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}), "console_thread").start();
        server.start();
        server.join();
	}
 
开发者ID:punkbrwstr,项目名称:pinto,代码行数:27,代码来源:Main.java

示例4: createAppContext

import org.eclipse.jetty.util.log.Slf4jLog; //导入依赖的package包/类
private static WebAppContext createAppContext() throws Exception {

        // Configure HTTP handler

        WebAppContext context = new WebAppContext();
        context.setResourceBase(getResourceLocation());
        context.setContextPath(DEFAULT_SERVLET_CTX_PATH);
        context.setLogger(new Slf4jLog());

        return context;
    }
 
开发者ID:AirVantage,项目名称:av-sched,代码行数:12,代码来源:Launcher.java

示例5: setJettyLog

import org.eclipse.jetty.util.log.Slf4jLog; //导入依赖的package包/类
private void setJettyLog() {
    // Explicitly set the Jetty Log impl to avoid the NPE raised at
    // https://issues.apache.org/jira/browse/APLO-264
    try {
        org.eclipse.jetty.util.log.Log.setLog(new Slf4jLog());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:christian-posta,项目名称:activemq-apollo-java-port,代码行数:10,代码来源:WsTransportServer.java

示例6: main

import org.eclipse.jetty.util.log.Slf4jLog; //导入依赖的package包/类
public static void main(final String[] args) {
  InetSocketAddress _inetSocketAddress = new InetSocketAddress("localhost", 8080);
  final Server server = new Server(_inetSocketAddress);
  WebAppContext _webAppContext = new WebAppContext();
  final Procedure1<WebAppContext> _function = (WebAppContext it) -> {
    it.setResourceBase("WebRoot");
    it.setWelcomeFiles(new String[] { "index.html" });
    it.setContextPath("/");
    AnnotationConfiguration _annotationConfiguration = new AnnotationConfiguration();
    WebXmlConfiguration _webXmlConfiguration = new WebXmlConfiguration();
    WebInfConfiguration _webInfConfiguration = new WebInfConfiguration();
    MetaInfConfiguration _metaInfConfiguration = new MetaInfConfiguration();
    it.setConfigurations(new Configuration[] { _annotationConfiguration, _webXmlConfiguration, _webInfConfiguration, _metaInfConfiguration });
    it.setAttribute(WebInfConfiguration.CONTAINER_JAR_PATTERN, ".*/com\\.hribol\\.bromium\\.dsl\\.web/.*,.*\\.jar");
    it.setInitParameter("org.mortbay.jetty.servlet.Default.useFileMappedBuffer", "false");
  };
  WebAppContext _doubleArrow = ObjectExtensions.<WebAppContext>operator_doubleArrow(_webAppContext, _function);
  server.setHandler(_doubleArrow);
  String _name = ServerLauncher.class.getName();
  final Slf4jLog log = new Slf4jLog(_name);
  try {
    server.start();
    URI _uRI = server.getURI();
    String _plus = ("Server started " + _uRI);
    String _plus_1 = (_plus + "...");
    log.info(_plus_1);
    final Runnable _function_1 = () -> {
      try {
        log.info("Press enter to stop the server...");
        final int key = System.in.read();
        if ((key != (-1))) {
          server.stop();
        } else {
          log.warn("Console input is not available. In order to stop the server, you need to cancel process manually.");
        }
      } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
      }
    };
    new Thread(_function_1).start();
    server.join();
  } catch (final Throwable _t) {
    if (_t instanceof Exception) {
      final Exception exception = (Exception)_t;
      log.warn(exception.getMessage());
      System.exit(1);
    } else {
      throw Exceptions.sneakyThrow(_t);
    }
  }
}
 
开发者ID:hristo-vrigazov,项目名称:bromium,代码行数:52,代码来源:ServerLauncher.java

示例7: main

import org.eclipse.jetty.util.log.Slf4jLog; //导入依赖的package包/类
public static void main(final String[] args) {
  InetSocketAddress _inetSocketAddress = new InetSocketAddress("localhost", 8080);
  final Server server = new Server(_inetSocketAddress);
  WebAppContext _webAppContext = new WebAppContext();
  final Procedure1<WebAppContext> _function = (WebAppContext it) -> {
    it.setResourceBase("WebRoot");
    it.setWelcomeFiles(new String[] { "index.html" });
    it.setContextPath("/");
    AnnotationConfiguration _annotationConfiguration = new AnnotationConfiguration();
    WebXmlConfiguration _webXmlConfiguration = new WebXmlConfiguration();
    WebInfConfiguration _webInfConfiguration = new WebInfConfiguration();
    MetaInfConfiguration _metaInfConfiguration = new MetaInfConfiguration();
    it.setConfigurations(new Configuration[] { _annotationConfiguration, _webXmlConfiguration, _webInfConfiguration, _metaInfConfiguration });
    it.setAttribute(WebInfConfiguration.CONTAINER_JAR_PATTERN, ".*/org\\.xtext\\.dsl\\.restaurante\\.web/.*,.*\\.jar");
    it.setInitParameter("org.mortbay.jetty.servlet.Default.useFileMappedBuffer", "false");
  };
  WebAppContext _doubleArrow = ObjectExtensions.<WebAppContext>operator_doubleArrow(_webAppContext, _function);
  server.setHandler(_doubleArrow);
  String _name = ServerLauncher.class.getName();
  final Slf4jLog log = new Slf4jLog(_name);
  try {
    server.start();
    URI _uRI = server.getURI();
    String _plus = ("Server started " + _uRI);
    String _plus_1 = (_plus + "...");
    log.info(_plus_1);
    final Runnable _function_1 = () -> {
      try {
        log.info("Press enter to stop the server...");
        final int key = System.in.read();
        if ((key != (-1))) {
          server.stop();
        } else {
          log.warn("Console input is not available. In order to stop the server, you need to cancel process manually.");
        }
      } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
      }
    };
    new Thread(_function_1).start();
    server.join();
  } catch (final Throwable _t) {
    if (_t instanceof Exception) {
      final Exception exception = (Exception)_t;
      log.warn(exception.getMessage());
      System.exit(1);
    } else {
      throw Exceptions.sneakyThrow(_t);
    }
  }
}
 
开发者ID:vicegd,项目名称:org.xtext.dsl.restaurante,代码行数:52,代码来源:ServerLauncher.java

示例8: doStart

import org.eclipse.jetty.util.log.Slf4jLog; //导入依赖的package包/类
@Override
protected synchronized void doStart() throws Exception
{
  logger = new Slf4jLog(loggerName);
  super.doStart();
}
 
开发者ID:confluentinc,项目名称:rest-utils,代码行数:7,代码来源:Slf4jRequestLog.java


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