I'm using jersey 2. This is an app I did not set up myself. I followed the instructions in this answer: https://stackoverflow.com/a/33271754
But, this isn't doing anything. I put breakpoints on every method and none of them are ever called whether on startup or on thrown exceptions. I googled a bit and read that I need to register it in the web.xml with a line like this:
<servlet>
<servlet-name>jersey-serlvet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.mypackage.rest</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
But, my ExceptionLogger is already in that package. Official docs give examples with a ResourceConfig class, but that class doesn't exist in my project (despite the fact that the app runs fine).
I'm not necessarily asking what I'm doing wrong, I want to know how to get some information out of Jersey 2 so that I can troubleshoot what I'm doing wrong. It doesn't spit out any logs on startup, but the app appears to be running fine when I hit it. Is there a property I can set to that it will print debugging information about how it's searching for things like ApplicationEventListener
?
Update
I figured out how to solve it. I needed to add this to my web.xml:
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>org.glassfish.jersey.filter.LoggingFilter;com.mypackage.rest.ExceptionLogger</param-value>
</init-param>
Can someone explain to me why the .packages
param wouldn't make the .classnames
redundant?