本文整理汇总了Java中org.mortbay.log.Log.setLog方法的典型用法代码示例。如果您正苦于以下问题:Java Log.setLog方法的具体用法?Java Log.setLog怎么用?Java Log.setLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mortbay.log.Log
的用法示例。
在下文中一共展示了Log.setLog方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JettyHttpServer
import org.mortbay.log.Log; //导入方法依赖的package包/类
public JettyHttpServer(URL url, final HttpHandler handler){
super(url, handler);
// modified by lishen
this.url = url;
// TODO we should leave this setting to slf4j
Log.setLog(new StdErrLog());
Log.getLog().setDebugEnabled(false);
DispatcherServlet.addHttpHandler(url.getPort(), handler);
int threads = url.getParameter(Constants.THREADS_KEY, Constants.DEFAULT_THREADS);
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setDaemon(true);
threadPool.setMaxThreads(threads);
threadPool.setMinThreads(threads);
SelectChannelConnector connector = new SelectChannelConnector();
if (! url.isAnyHost() && NetUtils.isValidLocalHost(url.getHost())) {
connector.setHost(url.getHost());
}
connector.setPort(url.getPort());
server = new Server();
server.setThreadPool(threadPool);
server.addConnector(connector);
ServletHandler servletHandler = new ServletHandler();
ServletHolder servletHolder = servletHandler.addServletWithMapping(DispatcherServlet.class, "/*");
servletHolder.setInitOrder(2);
// modified by lishen
// dubbo's original impl can't support the use of ServletContext
// server.addHandler(servletHandler);
// TODO Context.SESSIONS is the best option here?
Context context = new Context(server, "/", Context.SESSIONS);
context.setServletHandler(servletHandler);
ServletManager.getInstance().addServletContext(url.getPort(), context.getServletContext());
try {
server.start();
} catch (Exception e) {
throw new IllegalStateException("Failed to start jetty server on " + url.getAddress() + ", cause: "
+ e.getMessage(), e);
}
}
示例2: JettyHttpServer
import org.mortbay.log.Log; //导入方法依赖的package包/类
public JettyHttpServer(URL url, final HttpHandler handler){
super(url, handler);
// modified by lishen
this.url = url;
// TODO we should leave this setting to slf4j
Log.setLog(new StdErrLog());
Log.getLog().setDebugEnabled(false);
DispatcherServlet.addHttpHandler(url.getPort(), handler);
int threads = url.getParameter(Constants.THREADS_KEY, Constants.DEFAULT_THREADS);
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setDaemon(true);
threadPool.setMaxThreads(threads);
threadPool.setMinThreads(threads);
SelectChannelConnector connector = new SelectChannelConnector();
if (! url.isAnyHost() && NetUtils.isValidLocalHost(url.getHost())) {
connector.setHost(url.getHost());
}
connector.setPort(url.getPort());
server = new Server();
server.setThreadPool(threadPool);
server.addConnector(connector);
ServletHandler servletHandler = new ServletHandler();
ServletHolder servletHolder = servletHandler.addServletWithMapping(DispatcherServlet.class, "/*");
servletHolder.setInitOrder(2);
// modified by lishen
// dubbo's original impl can't support the use of ServletContext
// server.addHandler(servletHandler);
// TODO Context.SESSIONS is the best option here?
Context context = new Context(server, "/", Context.SESSIONS);
context.setServletHandler(servletHandler);
BaseContext.CTX.addServletContext(url.getPort(), context.getServletContext());
try {
server.start();
} catch (Exception e) {
throw new IllegalStateException("Failed to start jetty server on " + url.getAddress() + ", cause: "
+ e.getMessage(), e);
}
}