'How do I get my tomcat server to print debug messages about the rewrite Valve?

I'm making use of the rewrite valve in Tomcat, but something isn't working right. I want to get debugging messages in my catalina log file so I can figure out the issue, but I'm not sure how.

In my logging.properties I just tried putting a blanket

.level = FINE

But this obvously made my catalina log too verbose. I did see what I was after though, which was these lines:

20-Feb-2020 13:42:34.061 FINE [main] org.apache.catalina.valves.rewrite.RewriteValve.parse Add rule with pattern ^/?(.*) and substitution https://%{SERVER_NAME}/$1
20-Feb-2020 13:42:34.061 FINE [main] org.apache.catalina.valves.rewrite.RewriteValve.parse Add condition =80 test %{SERVER_PORT} to rule with pattern ^/?(.*) and substitution https://%{SERVER_NAME}/$1

What do I need to put in my logging.propeties so I'm only focusing on RewriteValve messages?



Solution 1:[1]

Replace .level = FINE with org.apache.catalina.valves.rewrite.RewriteValve=FINE

The prefix of log lines and the left side of the properties entry are used by the logger to decide what to log.

Solution 2:[2]

I found a solution for the original question.

As mentioned in Tomcat 8.0 Rewrite Valve, org.apache.catalina.valves.rewrite.RewriteValve has no own logger.

The RewriteValve logging can be activated in Tomcats logging.properties by:

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = FINE

If you run Tomcat within Eclipse, add the following vm start argument to the Tomcat launch settings:

 -Djava.util.logging.config.file="path/to/logging.properties"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Freiheit
Solution 2 Jack350