Konstantin,

On 3/13/25 12:34 PM, Christopher Schultz wrote:
Konstantin,

On 3/13/25 10:55 AM, Konstantin Kolinko wrote:
чт, 13 мар. 2025 г. в 16:42, Christopher Schultz <ch...@christopherschultz.net>:

All,

I really should be able to figure this out for myself but I'm frustrated
and might just need someone to show me that I'm spelling something wrong.

I'm trying to get all logs from the CsrfPReventionFilter. I know it's
working because I get 403 responses when it's enabled and don't get them
when it's not. But it's 100% silent and I'm getting no logs.

I've added this to the bottom of the stock conf/logging.properties file:

org.apache.catalina.filters.CsrfPreventionFilter.level = ALL
org.apache.catalina.filters.CsrfPreventionFilter.handlers =
java.util.logging.ConsoleHandler

I shouldn't need the second line, since the default .handlers is
ConsoleHandler and the async handler for catalina.[date].

I'm not seeing anything more detailed than INFO in catalina.out or
catalina.[date]. But...

1catalina.org.apache.juli.AsyncFileHandler.level = ALL
...
java.util.logging.ConsoleHandler.level = ALL


??!

This is Tomcat 9.0.98 on Linux with a stock conf/logging.properties file
(plus my .level=ALL for this filter)

What am I missing?

1. It may be that your web application has its own logging.properties
file in classpath,
thus it is preferred over the default one.

There is a logging.properties in my application's webapps/WEB-INF/ classes/logging.properties file but I wouldn't expect that to interfere with Tomcat's logging.

One option to prevent such behaviour is to reconfigure Tomcat to use the
java.util.logging.LogManager from JRE instead of its own class.

I will try that if I get desperate. :)

2.
org.apache.catalina.filters.CsrfPreventionFilter.handlers =
java.util.logging.ConsoleHandler

If those are two separate lines, the first one lacks trailing slash,
and results in an empty value for "handlers".

It's on one line. I think my (or your) email client separated them.

3. If logging does not help, consider remote debugging.

:/

4. BTW, looking at 9.0.x

- CsrfPreventionFilter extends CsrfPreventionFilterBase
- CsrfPreventionFilterBase implements getLogger() method declared by
FilterBase with its own logger.
private final Log log = LogFactory.getLog(CsrfPreventionFilterBase.class);
- CsrfPreventionFilter does not implement getLogger(),

This should not affect you, as getLogger() is only used by FilterBase
to log misconfiguration warnings,
and that is not your use case.

Ooh, that's a good call. Let me check.

This isn't the problem, somehow. Or at least not the whole problem.

Switching to the JDK's LogManager worked.

-chris


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to