Java Code Examples for org.mortbay.log.Log#setLog()
The following examples show how to use
org.mortbay.log.Log#setLog() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JettyHttpServer.java From dubbo-2.6.5 with Apache License 2.0 | 4 votes |
public JettyHttpServer(URL url, final HttpHandler handler) { super(url, handler); this.url = url; // TODO we should leave this setting to slf4j // we must disable the debug logging for production use Log.setLog(new StdErrLog()); Log.getLog().setDebugEnabled(false); DispatcherServlet.addHttpHandler(url.getParameter(Constants.BIND_PORT_KEY, 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(); String bindIp = url.getParameter(Constants.BIND_IP_KEY, url.getHost()); if (!url.isAnyHost() && NetUtils.isValidLocalHost(bindIp)) { connector.setHost(bindIp); } connector.setPort(url.getParameter(Constants.BIND_PORT_KEY, url.getPort())); server = new Server(); server.setThreadPool(threadPool); server.addConnector(connector); ServletHandler servletHandler = new ServletHandler(); ServletHolder servletHolder = servletHandler.addServletWithMapping(DispatcherServlet.class, "/*"); servletHolder.setInitOrder(2); // 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.getParameter(Constants.BIND_PORT_KEY, url.getPort()), context.getServletContext()); try { server.start(); } catch (Exception e) { throw new IllegalStateException("Failed to start jetty server on " + url.getParameter(Constants.BIND_IP_KEY) + ":" + url.getParameter(Constants.BIND_PORT_KEY) + ", cause: " + e.getMessage(), e); } }
Example 2
Source File: JettyHttpServer.java From dubbox with Apache License 2.0 | 4 votes |
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); } }
Example 3
Source File: JettyHttpServer.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
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); } }
Example 4
Source File: JettyHttpServer.java From dubbox with Apache License 2.0 | 4 votes |
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); } }
Example 5
Source File: JettyHttpServer.java From dubbox with Apache License 2.0 | 4 votes |
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); } }