You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Fedor Karpelevitch <fe...@Barra.COM> on 2001/10/08 23:43:01 UTC

[PATCH] turbine logging before logging service is initialized

Hi!

Here is the problem: before the logging service is initialized and enabled
Turbine.java logs using standard servlet logging (which happens to be stdout
when running standalone) and TurbineServices.java logs to stdout. Sometimes
getting those few messages in the output may be annoying and sometimes is a
real problem, for example if you producing some output for another program
to pipe in and parse (which is the case for me). I believe the normal
behaviour would be to _always_ use turbine logging facilities.

So here is what this patch does:

1. Turbine.java overrides servlet's log methods and calls TurbineServices'
logging methods, so all servlet logging goes to Turbine logging

2. Changed TurbineServices' logging methods so that, when logging service is
not yet initialized the messages are cached in memory instead of being
printed to stdout. As soon as logging service is initialized and enabled all
the cached messages are dumped into the logger, so they are not lost.

3. In case we never get to successfully initialize logging service we
attempt to dump the cached messages in the finalizer of TurbineServices. I
could not find a better place to do that.

This is the cleanest solution I could come up with. I hope it is clean
enough. Let me know if there is any problem with this or if you know a
better way.
If nobody has any problem could someone please commit it or i'll commit it
in a while.

fedor.

-------------------------------
Amicus Plato amicus Aristoteles magis amica veritas