struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eddie Bush <ekb...@swbell.net>
Subject Re: Accessing the Commons Logging Interface
Date Wed, 25 Sep 2002 15:26:42 GMT
Before You Start

    If you're planning to use Log4J as your logging implementation, grab 
a fresh copy of commons-logging from the commons site and install it. 
 There were issues with the JAR included in the 1.1 bx distributions 
that cause ... problems :-)

Doing the Nasty With commons-logging:

package com.foo;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class Bar
{
    private static Log log = LogFactory.getLog(Bar.class);

    public void baz()
    {
        ...
        if (log.isDebugEnabled())
            log.debug("W0000000000T!");
    }
}

That really is it.  There is some property config you could possibly 
need if you're using Log4J under JDK1.4.  You didn't say much about your 
environment, so I'll leave this out for now.

Tal Rotbart wrote:

>Hi all,
>
>In Struts 1.1b2, how do I access the Commons Logging Interface from withing
>a Struts Plug-In?
>1. The chapter in the User Guide is still [TO DO]
>2. It seems that the "log" static member field from within "ActionServlet"
>is not public.
>3. I have not found any "getLog" member function anywhere... Seems like a
>missing feature...
>
>Any ideas?
>
>Thanks!
>Tal Rotbart
>

-- 
Eddie Bush




--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message