Most of the examples show the 'programmatic' use of Log4j. In most real
applications, the logging is integrated into the code and the controlled
externally via the configuration.

In any event, this is how I typically use loggers in my classes:

package com.mystuff;

public class MyClass
{
    private static final Logger log = Logger.getLogger(MyClass.class);

    public void foo()
    {
        log.info("I am doing something here");
    }
    ...
}

Since this code goes into an enterprise appliation run in Weblogic, we
control the logging behavior externally through our xml configuration file
so that we can dial up or down the logging verbosity, determine logging
destinations, etc.

-----Original Message-----
From: Vikas Phonsa [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 29, 2003 17:19
To: '[EMAIL PROTECTED]'
Subject: basic question from a newbie


Hi guys,

I started with log4j couple of hrs ago and I'm reading thru the
documentation and its making sense. I have gone too far into it, but one
basic thing is confusing me. What exactly is a logger.

When u say

Logger log1 = Logger.getLogger("com.foo.Bar");

What is com.foo.Bar, is that some object that is automatically generated or
what ?

The basic examples don't require the creation of any such class or object.
Then what is it ?

When I really start using log4j, then would I be required to create any such
"logger" classes/objects. 

Can't figure out what's going on here.


Thanks

Vikas


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

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

Reply via email to