You'll be fine.  You're giving up some of the nicer features of Log4j, of
course, but you're safe for threads and the like.

-Jim Moore

-----Original Message-----
From: Jamie Tsao [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 19, 2001 3:45 PM
To: [EMAIL PROTECTED]
Subject: RE: Using only the root Category (is this a problem ?)


Hi,

I hate to resend this, but can anyone give me a quick answer.  It seems
as though my simple wrapper class should be sufficient, but I am really
worried about thread/synchronization issues.

Anyone ?

- Jamie
-----Original Message-----
From: Jamie Tsao 
Sent: Thursday, June 14, 2001 5:07 PM
To: [EMAIL PROTECTED]
Subject: Using only the root Category (is this a problem ?)




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]

application/ms-tnef

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

Reply via email to