чт, 7 нояб. 2019 г. в 05:44, Christopher Schultz <chris@christopherschultz.net>:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> All,
>
> I can't believe I'm having trouble with this, but I'm struggling with
> enabling logging.
>
> I'm experimenting with the CsrfPreventionFilter, which currently has
> zero logging at all in it. So, first I modified the code to add:
>
> + private final Log log =
> LogFactory.getLog(CsrfPreventionFilter.class);
>
> and, later
>
> if (nonceCache == null || previousNonce == null ||
> !nonceCache.contains(previousNonce)) {
> + log.trace("nonceCache=" + (null == nonceCache ? "(null)" :
> nonceCache.cache));
> + log.trace("previousNonce=" + previousNonce);
> + log.trace("nonceCache.contains=" + (null == nonceCache ?
> "(null)" : nonceCache.contains(previousNonce)));
>
> res.sendError(getDenyStatus());
> return;
> }
Are you modifying the correct file?
(1. At build time it is copied to the output directory. Are you
modifying the source or the copy?
2. The configuration file is enabled via
-Djava.util.logging.config.file= system property that is set by
catalina script. If you run Tomcat in some other way, that system
property may be not set at all. (E.g. when running Tomcat from within
Eclipse IDE.)
)
> Finally, I modified these lines in $CATALINA_BASE/conf/logging.propertie
> s:
> - - java.util.logging.ConsoleHandler.level = FINE
> + java.util.logging.ConsoleHandler.level = ALL
>
> ...
>
> + org.apache.catalina.filters.level=ALL
Looks OK. Personally I never use 'ALL', but it should be OK. I prefer
to use FINE, FINER or FINEST.
https://docs.oracle.com/javase/7/docs/api/java/util/logging/Level.html#ALL
> When running, I see no logging when I'm expecting to see things in
> catalina.out. I changed these lines from log.trace() to
> System.err.println() and they do indeed show up.
>
> What am I missing?
>
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
|