List of usage examples for org.springframework.boot.web.embedded.tomcat TomcatWebServer logger
Log logger
To view the source code for org.springframework.boot.web.embedded.tomcat TomcatWebServer logger.
Click Source Link
From source file:org.springframework.boot.web.embedded.tomcat.TomcatWebServer.java
private void initialize() throws WebServerException { TomcatWebServer.logger.info("Tomcat initialized with port(s): " + getPortsDescription(false)); synchronized (this.monitor) { try {/* w ww . j a va2s . co m*/ addInstanceIdToEngineName(); Context context = findContext(); context.addLifecycleListener((event) -> { if (context.equals(event.getSource()) && Lifecycle.START_EVENT.equals(event.getType())) { // Remove service connectors so that protocol binding doesn't // happen when the service is started. removeServiceConnectors(); } }); // Start the server to trigger initialization listeners this.tomcat.start(); // We can re-throw failure exception directly in the main thread rethrowDeferredStartupExceptions(); try { ContextBindings.bindClassLoader(context, context.getNamingToken(), getClass().getClassLoader()); } catch (NamingException ex) { // Naming is not enabled. Continue } // Unlike Jetty, all Tomcat threads are daemon threads. We create a // blocking non-daemon to stop immediate shutdown startDaemonAwaitThread(); } catch (Exception ex) { stopSilently(); throw new WebServerException("Unable to start embedded Tomcat", ex); } } }
From source file:org.springframework.boot.web.embedded.tomcat.TomcatWebServer.java
@Override public void start() throws WebServerException { synchronized (this.monitor) { if (this.started) { return; }/* w w w . j ava2 s.c om*/ try { addPreviouslyRemovedConnectors(); Connector connector = this.tomcat.getConnector(); if (connector != null && this.autoStart) { performDeferredLoadOnStartup(); } checkThatConnectorsHaveStarted(); this.started = true; TomcatWebServer.logger.info("Tomcat started on port(s): " + getPortsDescription(true) + " with context path '" + getContextPath() + "'"); } catch (ConnectorStartFailedException ex) { stopSilently(); throw ex; } catch (Exception ex) { throw new WebServerException("Unable to start embedded Tomcat server", ex); } finally { Context context = findContext(); ContextBindings.unbindClassLoader(context, context.getNamingToken(), getClass().getClassLoader()); } } }
From source file:org.springframework.boot.web.embedded.tomcat.TomcatWebServer.java
private void stopProtocolHandler(Connector connector) { try {/* w ww. j a v a 2 s. co m*/ connector.getProtocolHandler().stop(); } catch (Exception ex) { TomcatWebServer.logger.error("Cannot pause connector: ", ex); } }
From source file:org.springframework.boot.web.embedded.tomcat.TomcatWebServer.java
private void performDeferredLoadOnStartup() { try {// w w w . j a v a 2 s . c o m for (Container child : this.tomcat.getHost().findChildren()) { if (child instanceof TomcatEmbeddedContext) { ((TomcatEmbeddedContext) child).deferredLoadOnStartup(); } } } catch (Exception ex) { TomcatWebServer.logger.error("Cannot start connector: ", ex); throw new WebServerException("Unable to start embedded Tomcat connectors", ex); } }