I am stuck creating a subclass of httpServlet that will use log4j as it's
standard logging facility. ( Instead of the default log calls ).

There are two problems.

public class Log4JHttpServlet extends HttpServlet implements nl.cmg.log.Log
{

**1) The first is i want to use the subclass's classname as the classes
**category name. But how can i access a subclasses classname form a super
**class.

    /* Log4J logging variable */
    private static Category cat =
Category.getInstance(LogLevelHttpServlet.class.getName());
    private static String classname = Log4JHttpServlet.class.getName();
    /** Initializes the servlet.

2)
**I added all of the logging level functions like cat.debug until
**cat.fatal to my log4jHttpServlet superclass, but this f*cks up the line
**numbers when logging.

    public void debug(Object Message, Throwable t) {
        cat.debug(Message,  t );        

**The reason 4 doing so is that i what to be compatible with are standard
**way of logging so that i only have to change the class that my new
**servlet extends to change the logging implementation currently used.



example using normal classes.

1public class a
2{
3private static Category cat = Category.getInstance(<<RUNTIMECLASS NAME OF
B>>);
4
5
6    public void debug(Object Message, Throwable t) { 
7cat.debug(Message,  t ); }       
8
9    
10}

1public class b extends a
2{
3   public static void main ( String[] args )
4   {
5     this.debug("damn error",someException);
6   }
7}

OUT>dam error in class a at line 7,

and i want it to print

OUT>damn error in class b at line 5 

ids,
Thankx




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

Reply via email to