1

I have a Spring boot application deployed on Tomcat8

When the app starts I see the following

18-Feb-2016 15:28:12.164 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=
--- Many more JVM arguments 
  .   ___          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.3.1.RELEASE)
18-Feb-2016 15:28:23.328 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /var/lib/tomcat8/webapps/ROOT has finished in 10,922 ms
18-Feb-2016 15:28:23.351 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]

I want to stop the JVM argument being logged via org.apache.catalina.startup.VersionLoggerListener

I have a logback.xml file in my resources folder

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
        <appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d %-5level [%thread] %logger{0}: %msg%n</pattern>
        </encoder>
    </appender>
    <root>
        <level value="ERROR" />
        <appender-ref ref="consoleAppender" />
    </root>
</configuration>

This seems to kick in and reduce logging to ERROR once the Spring container has loaded but after the JVM arg's have been logged

Does anyone know how i can stop VersionLoggerListener logging ?

user2205623
  • 39
  • 2
  • 8
  • Why do you care ? Just ignore the prolog. – Marged Feb 18 '16 at 15:42
  • 1
    The JVM arguments contain a username and password to a resource I access. – user2205623 Feb 18 '16 at 16:47
  • This is altogether a not so clever approach ... But those having access to the log are likely also able to see the script calling your app so you do not gain much when hiding that information. Try to pass the credentials by some other means. – Marged Feb 18 '16 at 16:53
  • at this point I just want to remove the info from the logs – user2205623 Feb 18 '16 at 16:56

1 Answers1

5

You can disable the VersionsLoggerListener by removing <Listener className="org.apache.catalina.startup.VersionLoggerListener" /> from your Tomcats server.xml.

Cyril
  • 2,376
  • 16
  • 21
  • Thanks, i am trying to avoid editing anything in the tomcat server.xml. Is there anyway to perform this within the web app I have? – user2205623 Feb 19 '16 at 08:16
  • Then you should use the embedded Tomcat. I think the listener is executed by Tomcat before the spring boot app starts. – Cyril Feb 19 '16 at 08:39