Bob,
Bob Herrmann wrote:
>
> Just so I get an idea of the scale of changes.. Tomcat has a lot of code
> that uses a pattern like this;
>
> private void log(String message) {
> Logger logger = null;
> if (container != null)
> logger = container.getLogger();
> if (logger != null) {
> logger.log(getName() + "[" + container.getName() + "]: "
> + message);
> } else {
> String containerName = null;
> if (container != null)
> containerName = container.getName();
>
> System.out.println(getName() + "[" + containerName
> + "]: " + message);
> }
> }
>
> Would the 5.0 logging look more like this ?? ( I am just changing the
> System.out calls to instead defer to a commons-logging logger. )
>
> private void log(String message) {
> Logger logger = null;
>
> if (container != null)
> logger = container.getLogger();
>
> if (logger != null) {
> logger.log(getName() + "[" + container.getName() + "]: "
> + message);
> } else {
> String containerName = null;
> if (container != null)
> containerName = container.getName();
>
> //import org.apache.commons.logging.Log;
> //import org.apache.commons.logging.LogFactory;
>
> Log log = LogFactory.getLog( containerName );
>
> log.info( getName() + "[" + containerName
> + "]: " + message);
> }
> }
>
> (Note that commons-logging is going to record the log method (and not
> the caller's) method in the logging output)
>
+1 for this type of change. Even though commons-logging will record the
log method, IMHO this is an incremental improvement over using
System.out directly.
Patrick
--
________________________________________________________________
Patrick Luby Email: [EMAIL PROTECTED]
Sun Microsystems Phone: 408-276-7471
901 San Antonio Road, USCA14-303
Palo Alto, CA 94303-4900
________________________________________________________________
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>