logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Newlander" <cnewlan...@eqtc.com>
Subject RE: log4j wrapper
Date Thu, 23 Aug 2001 17:39:24 GMT
Extending Category doesn't abstract it.

-----Original Message-----
From: Nicolas [mailto:nicolas@ice.com]
Sent: Thursday, August 23, 2001 12:34 PM
To: LOG4J Users Mailing List
Subject: Re: log4j wrapper


Why don't you just extend org.apache.log4j.Category? The FQCN would be one
of
yours, and you would not have to implement any methods.

Also, in our application, we use a CategoryFactory.getInstance(Class class)
which returns AppServerCategory.getInstance(class.getName()).

Nicolas


On Thursday 23 August 2001 13:22, you wrote:
> I also created a wrapper for Category, but instead of always calling the
> Category.getInstance() method, I instantiate the wrapper class and it
> stores a reference to the Category object.  Then uses the reference in
> implementing the various methods.  Doing it this way means that we create
> an object for each Category (we only create one instance, like log4j), but
> we don't pass the class everywhere.
>
> Advantages?  Disadvantages?
>
> -Mark
>
> -----Original Message-----
> From: Don Taylor [mailto:donald_l_taylor_jr@yahoo.com]
> Sent: Thursday, August 23, 2001 9:33 AM
> To: LOG4J Users Mailing List
> Subject: Re: log4j wrapper
>
> --- Craig Newlander <cnewlander@eqtc.com> wrote:
> > Hello,
> >
> >    I'd like to absract log4j from my appilication so I don't have to
> > do a
> > import org.apache.log4j.* throughout my source files and be dependant
> > on the
> > Category class.   What is a good method to employ here?
> >
> > Craig
>
> I created a wrapper class around Category. You're going to create your
> debug(), error(), fatal(), info(), and warn() methods in here. You'll
> also need a fully-qualified-classname of the wrapper class. So here's
> an example:
>
> class Logger {
>   private static final String FQCN = Logger.class.getName();
>
>   public static void debug(Class c, Object message) {
>     Category.getInstance(c).log(FQCN, Priority.DEBUG, message, null);
>   }
>
>   public static void debug(Class c, Object message, Throwable t) {
>     Category.getInstance(c).log(FQCN, Priority.DEBUG, message, t);
>   }
>
>   /* Continue wrapping all the others... */
> };
>
> -- Don
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message