Hi,

I've written a very simple wrapper class around log4j.  It basically has
a STATIC instance of the root Category.  There are static logging
methods that basically call the corresponding log method of the root
Category instance.  I will attach several appenders to this single root
instance through the configuration file.  Now while I know that I'm not
using log4j to its fullest capabilities (i.e. category hierarchies),
does anyone see a problem with my simple Logging class ?  Keep in mind
that I will basically use this simple logging class in every component
of my application by simply calling:

        LogService.logDebug("This is a debug message");

Some questions/concerns I have include:  Will there be an issue with
synchronization ?  thread issues ?  I'm not familiar enough with the
underlying implementation of log4j to answer these questions.  So far in
development, it seems to work fine.  But I was worried that if a bigger
load hits this logger, that I would have a problem.  Please help.  I've
included the class below.

Thanks,

Jamie

public class LogService {

    /**
     * Private static instance of a log4j Category object.  Every
logging request
     * will be handled by this root Category.
     */
    private static Category cat = Category.getInstance("");

    static {
        
PropertyConfigurator.configure("c:\\bea\\wlserver6.0sp1\\config\\mydomai
n\\properties\\logservice.properties");
    }

    public static void logDebug(String message)
    {
        cat.debug(message);
    }

    public static void logInfo(String message)
    {
        cat.info(message);
    }

    public static void logWarn(String message)
    {
        cat.warn(message);
    }

    public static void logError(String message)
    {
        cat.error(message);
    }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to