-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Konstantin,

On 11/7/19 00:02, Konstantin Kolinko wrote:
> чт, 7 нояб. 2019 г. в 05:44, Christopher Schultz
> <ch...@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?

Yes. As I said, when using System.err.println() instead log
log.trace(), I do get logging (to stderr).

> 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.) )

I'm using bin/catalina.sh start to launch Tomcat on Macos. The 'ps'
command shows the following partial command-line:

[...]
- -Djava.util.logging.config.file=${CATALINA_BASE}/conf/logging.properties
- -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager [...]

The file ${CATALINA_BASE}/conf/logging.properties does indeed have the
changes below.

>> 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.

I did that in desparation after FINEST wasn't getting the job done.

> 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?

So... what else should I check?

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl3EJeAACgkQHPApP6U8
pFj2ABAAjtESHJSSUFIaoNzrC6bJQTCOMYCMfxAV7s7Kz4/L/Be1NCQo7IAeLnj2
TIvW78j8IX7EUZ9iFu16kJS+JU5Fpukug4gUtj2BRyh3g/PyLg7dVD98pAyaQ9dK
qsomH7HUBCUhU+dw0ibT4PxtH7d2DZ5sM/iZmhk6IVsCBgfCwzP353NEpOTRnr1B
VnXOM1LGSHmttJpUiiNFrN8Yz490Q4N4g+YOaA0jR33m2WokZl3kB82PH+sWcfPI
TCD/vj90u0MFcprR8WpR5dz2z5pfnhFdSluY8nbqUWciwI0xfcGy0HcI1kbw5Kcz
plUdWi7O4nYT1EcDKQO6F/NdJlSMQ9EC70DUdTinblz2Bih4KbF9OQY4lMMw/Ha8
c/3OVv7TDRes94DoNjT/wDgNROy5mm57CI+HTpsoWoYDSObJcwLYAEQJc00vMEq9
pMuBxcI8B4D9S6QiepLWNVggwGjJ/Q6ax2hqBCS3aElI+limL5mQyW57Z9snwN0V
WwxwGOoX0KUa6YnYRL3UVN9q6X0CHDT5hBF5x0+aMWjjrzQRaOKpaOI8yKOGFWmr
ijZuwkDiR4die2mt7OtFydsTDLcCdkUFQGMqFxS01glB0RIX7yy1ITHkwdfI6qnj
RoteOJh9HZ41/GFd2uQFHP52W3hKtMzXfHaK4chBWIbyyVtpkh4=
=shca
-----END PGP SIGNATURE-----

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

Reply via email to