You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Bob Herrmann <bo...@jadn.com> on 2002/07/30 16:16:07 UTC
Re: [5.0] mbean-names [logging]
On Mon, 2002-07-29 at 23:04, costinm@covalent.net wrote:
> On 29 Jul 2002, Bob Herrmann wrote:
>
> >
> > > Same should happen for Log, assuming we get the commons-logging
> > > to support JMX and add a wrapper for JDK1.4 ( for log4j
> > > we should just use their mbean ). I assume we all agree on
> > > moving to commons-logging as API, and keeping the old Logging
> > > interface only for backward compat.
> >
> > I just reviewed the tomcat 5.0 proposal, and I didn't notice anything
> > about logging changing in 5.0
> >
> > Just so I understand this, the current use of <Logger .../> element
> > "will/should/encouraged to" disappear in 5.0 and instead modules will
> > directly call the commons-logging interface? So if I want to log a
> > particular context/webapp or Host or Engine, I will have to figure out
> > what "domain" it logged to and get the underlying logging system (log4j,
> > JDK1.4, logkit) to filter out the webapp/Host/Engine I am interested in?
>
> This has been discussed separately, and AFAIK nobody objected to the
> idea of using commons-logging in 5.0. It was proposed and accepted
> officially for jk and coyote, and even if no formal vote was made
> for 5.0 and jasper2 I assume it'll get a majority.
>
> The <Logger> element and interfaces will not disapear - it'll remain
> for backward compat, just like the realm stuff. I assume the attributes
> will be passed to the commons-logging impl.
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)
>
> My understanding is that we'll gradually start using commons-logging
> inside tomcat/jasper. So all components will use commons-logging,
> and we'll have a mechanism to configure it per/webapplication ( or
> host, engine ). Ceki already has some support in log4j to support
> this, and we can try to do something similar in the jdk1.4 wrapper.
>
> The details for configuration are not yet clear - it depends a lot
> on the overal scheme and I assume on what we do for users, since the
> problem is very similar.
ok.
>
> I like Craig's proposal for separate Users - and the Log can work the
> same. If you have ideas/sugestions about how to manage the loggers -
> please post them. 5.0 is still at an early stage, but those things
> should be discussed sooner rather than later.
>
> Of course, that's my understanding - I may be wrong.
>
>
> Costin
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [5.0] mbean-names [logging]
Posted by Patrick Luby <pa...@sun.com>.
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: patrick.luby@sun.com
Sun Microsystems Phone: 408-276-7471
901 San Antonio Road, USCA14-303
Palo Alto, CA 94303-4900
________________________________________________________________
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>