本文整理汇总了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();
}
示例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;
}
示例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();
}
示例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;
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
}
示例8: doStart
import org.eclipse.jetty.util.log.Slf4jLog; //导入依赖的package包/类
@Override
protected synchronized void doStart() throws Exception
{
logger = new Slf4jLog(loggerName);
super.doStart();
}