Hi,
I found info is very clear, But I would like to know
1. where to find the keys and how to name them ( javadoc says to find in
propertyconfigurator
class but i could not)? Or are these predifined if yes where can i find ?

2. I am using log4j in webapplication and configured log4j properties file
   in it under web-inf\classes dir. I have a statement in mylog.props file
        log4j.appender.A2.file=service.log
  when i run the webapplication the service.log file is created under
tomcat4\bin
  directory default , Can I specify file in desired location not under bin?

3. As log4j documents say to keep log4j.props file under web-inf\classes
directory
   to be identified by servlet, but when the log4j.props file is changed
that changes
will not be affected unless tomcat is restarted. Can i keep log4j.props
under webapps/mywebapp
directory if so how can i access it in servlet?

TIA
</rayaku>

-----Original Message-----
From: Richard Doust [mailto:[EMAIL PROTECTED]]
Sent: Monday, 8 July 2002 6:41 AM
To: Log4J Users List
Subject: RE: options and different loggers


I would hazard a guess that you haven't read much of the material available
on how to use log4j. Loggers inherit their behavior from a runtime hierarchy
based on their names. java.util is the parent of java.util.foo and java.util
is an ancestor of java.util.foo.bar where those dot separated names are
names of loggers, paramters passed to Logger.getLogger(). Each logger can be
configured with different appenders and all kinds of stuff. An appender
knows where its output goes. If your client and your service reside in
different packages, as one would hope they might, setting them up to log to
different log files is as simple as setting them up with different
appenders. Say you have com.rob.client.foo and com.rob.service.bar. By
establishing loggers in your properties file for com.rob.client and
com.rob.service, classes from those two packages down to the root (i.e.,
com.rob.service.bar.ClassA and com.rob.client.ClassB) will log to different
logfiles if you configure them with different appenders.
In your properties file, set up as follows:

log4j.logger.com.rob.service=WARN, A2
log4j.appender.A2=org.apache.log4j.RollingFileAppender
log4j.appender.A2.file=log/service.log
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

log4j.logger.com.rob.client=WARN, A3
log4j.appender.A3=org.apache.log4j.RollingFileAppender
log4j.appender.A3.file=log/client.log
log4j.appender.A3.layout=org.apache.log4j.PatternLayout
log4j.appender.A3.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

That's about it.
Rich

-----Original Message-----
From: Robert Mark Bram [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 07, 2002 6:29 AM
To: Log4J Users List
Subject: RE: options and different loggers


Howdy Richard!

> It means .. <snip>
> Does that help?

Yes it does, thank you - may I press you for some further help with my
second question?

>
> I am constructing a Jini application - I will have a client and
> service that
> will (in the completed application) reside on different machines. For now,
> however, they will both run on the same machine, but from within different
> JVM's (communicating via RMI).
>
> How can I make them create different log files?
>
> Should I create different log4j.properties files?
>
> These are the primary configurations I have set in my properties file:
>
> # I don't know what this one means
> log4j.rootLogger=DEBUG, A1
>
> # Sets the primary handler to be one that writes to a file
> log4j.appender.A1=org.apache.log4j.FileAppender
>
> # Sets the primary handler to be one that writes html output
> log4j.appender.A1.layout=org.apache.log4j.HTMLLayout
>


Thanks!

Rob

:)
:-}
;->


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


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


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

Reply via email to