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

Nick,

On 5/20/13 12:48 PM, Nick Williams wrote:
> 
> On May 20, 2013, at 10:56 AM, Christopher Schultz wrote:
> 
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>> 
>> Nick,
>> 
>> On 5/19/13 11:25 AM, Nick Williams wrote:
>>> Unfortunately, requiring users to call System.gc() before 
>>> shutdown for logging to work properly is no better than
>>> requiring users to register a listener in a web application for
>>> logging to work properly. Surely there's a better way...
>> 
>> Do you initialize your logging system in a
>> ServletContextListener (or similar)? If so, then you should
>> destroy it at the same level.
>> 
>> If you aren't initializing your logging system in a 
>> ServletContextListener... then how are you initializing it?
>> 
>> Long ago, I abandoned log4j's auto-initialization primarily
>> because it sometimes guesses wrong.
> 
> First, remember that this is Log4j 2, so things are obviously 
> different.

It's different, but it's the same.

> Log4j initializes with the first call to LogManager#getLogger(), 
> whenever that occurs. In my case loggers are static, so it happens
>  when the classes are initialized. In the specific case of the 
> replication project attached to the issue, it happens on the first
>  request to the only Servlet in the application.

Right. What I'm saying is that you should take full control over the
initialization (and destruction) of the logging system. Your
ServletContextListeners should be invoked before your servlet classes
are loader.

> Unfortunately, I've just about given up on it being possible to
> make logging work "right" without a ServletContextListener. Man oh
> man did I want to avoid that...

You act like a ServletContextListener is some evil hack that should be
avoided at all costs. Instead, it's exactly the right mechanism to do
what you are trying to do: configure something at webapp launch and
de-configure it when the webapp is stopped.

Some things just aren't appropriate to do with @Annotations. Sorry.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRmoCoAAoJEBzwKT+lPKRYEkgQALHbPr3SPqsDmIdYWa4Cb2VF
gZubG1MRsupGK2Kqlsq4HDTQMYjM5Twyig8McaVaxmqeUn9pWnSm2VgJCqeP0D8n
kGAsu9LZFoyEqkpO8+6xHwtvkPNCbj3qMrMRuqgXuV11VrlUL4N1q8pMYK3m0c5l
8iytqXUHk7R5MPjwZS4e3zC2jGnMhiIENWwfZa/ulNhmWCpLcC5tIU3Ka1s4VoFT
7S92vWG0CoveGkfVbtl9G9LPrdEYig0PFXeCvALFVE4Ff4rWP/jJiN+fE3GeTBSI
rR4eWpgvHM5BwvgFvSB6dzkaSQJaqX0GV1CJUdR3lvzh6jtRkeAlMzdA7DFFfQD3
pY/J/B+0ZeJzHDLrlYa528NaufA46vbhIr3l/fQqdMO5nHJePzv6bQIUOFu9zcHO
chwXohDvF9rQDAQE1H/DeVuDy7izQqn1k25PbsKDa/Ju86yk4V+ak/AcSzqKIm9o
zPLvHN4v3qPJ5QXElrX8aeXi7HUZEHjsVzvQmWpqpWd1aelNkn6FMSbrF59XpYkh
hTGXYz91gIbpshnwxpE5GQVv/1GwOFICi/HsT54ru0rEKmIDmTu9lu7ByzKp3Idv
U5dxMRUVzx+pJ2hfq2Mcqdy/LbYr9SX1uC3njtwdu2yuWWkbgC/Vnrns1hlDdpw/
+X1XT/+ZnfqzAQ66rger
=w+w1
-----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