Well, I was going to say that you could go to this
link:

http://www.vipan.com/htdocs/log4jhelp.html

but it appears to be down right now...I hope they get
it back up because it was really useful. Loggers are
part of the 1.2 release, so for 1.1.3 you should use
Categories...

HTH

Bryan

--- Modha Kumar <[EMAIL PROTECTED]> wrote:
> Hi All
> I just dowloaded Log4j and started working on some
> samples, I have these questions.
> 
> 1. There are 2 jars in distribution Log4j.jar and
> Log4j-core.jar do we need both of these. What is the
> necessity for 2 jars ?
> 
> 2. I downloaded Log4j version 1.1.3 eventhough
> documentation says that there is a Logger class
> org.apache.log4j.Logger
>    I did not find one in either of jars. There is a
> Category class which I was able to use. What version
> of jar has Logger ?
> 
> 3. Documentation says 
> " Log4j makes it easy to name loggers by software
> component. This can be accomplished by statically 
> instantiating a logger in each class, with the
> logger name equal to the fully qualified name of the
> class. "
> 
> should I put 
>       static Category logger =
> Category.getInstance(MyClass.class.getName()); 
> at the top of every class and have configuration
> read like this in say constructor
> 
>
PropertyConfigurator.configure("d:/dev-web/src/log4j.conf");
> Then it will log to all appenders in log4j.conf
> 
> Documentation :  " it is possible to configure a
> logger and then to retrieve the same instance
> somewhere else in the code without passing around
> references"
> 
> does it mean this logger is available in same class
> ,  .... I am clueless on usage
> 
> "Can anybody comment why one should require so many
> loggers one for each class"
> I can understand if one module logs to a particular
> file, why is this logger at class level.
> 
> 4.I tried to use sort1.lcf which I got from samples
> 
> log4j.rootCategory=, A1
> log4j.appender.A1=org.apache.log4j.ConsoleAppender
>
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> log4j.appender.A1.layout.ConversionPattern=%-4r %-5p
> [%t] %37c %3x - %m%n
> 
> put this line at top
> static Category logger =
> Category.getInstance(HTTPToXML.class.getName());
> 
> I have just one class in my package which extends
> extends org.xml.sax.helpers.DefaultHandler i put 2
> debug statements
> logger.debug("Entering application.");
> logger.debug("Exiting application.");
> 
> I get this as output...
> 0    DEBUG [main]     
> com.sentius.webhandler.HTTPToXML     - Entering
> application.
> 63   DEBUG [main]     
> com.sentius.webhandler.HTTPToXML     - Exiting
> application.
> 78   DEBUG [main]     
> com.sentius.webhandler.HTTPToXML     - Entering
> application.
> 78   DEBUG [main]     
> com.sentius.webhandler.HTTPToXML     - Exiting
> application.
> 
> I read about appender additivity since there is just
> one class in my package I dont know where the
> duplicates are comming from.
> Intrestingly output looks like my method ran twice
> but this is just a main method calling init() method
> a normal java standalone
> app.
> Any comments....
> 
> Replies will be greatly appreciated.
> 
> Thanks
> Modha/-
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


__________________________________________________
Do You Yahoo!?
Got something to say? Say it better with Yahoo! Video Mail 
http://mail.yahoo.com

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

Reply via email to