I am using
- Tomcat 9
- Eclipse Version: 2020-09 (4.17.0)
- Apache Maven 3.6.3
and I am starting to write a servlet, which runs in the Tomcat container. When I run it in Ecplise (Debug on Server) I can see some logging output from Tomcat. Like
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Dec 08, 2020 4:21:34 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-127.0.0.1-8009"]
Dec 08, 2020 4:21:34 PM org.apache.catalina.startup.Catalina load
INFO: Server initialization in [1291] milliseconds
Dec 08, 2020 4:21:34 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Dec 08, 2020 4:21:34 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.39]
Dec 08, 2020 4:21:36 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Dec 08, 2020 4:21:38 PM org.glassfish.jersey.server.wadl.WadlFeature configure
WARNING: JAXBContext implementation could not be found. WADL feature is disabled.
Dec 08, 2020 4:21:39 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [/home/myname/bin/tomcat/apache-tomcat-9.0.39/webapps/examples]
Dec 08, 2020 4:21:39 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Dec 08, 2020 4:21:39 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
... ...
The servlet runs fine and the start looks like this:
public class MyMain extends Application {
private final static Logger logger = LoggerFactory.getLogger(SdpApiMain.class);
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> s = new HashSet<Class<?>>();
s.add(Test.class);
s.add(User.class);
logger.debug("We are in main class, collectiong resources.");
return s;
}
}
But I do not see the debug line.
For logging I am using slf4j 1.7 and log4j2. I have the following log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
Do I just need a different console view in Eclipse? Anything wrong with my configuration and how can I debug it?