Steve,

Thanks for your advice. Unfortunately it doesn't help because I forgot
to mention another requirement: I don't know what the packages are ahead
of time. I will have them in my logging code as a string beforehand
(parse the stack frame of a new Throwable() to get it). Basically, I
figure out who my caller is, and log to the logger set up for the
caller's package.

Chris

-----Original Message-----
From: Steve Ebersole [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 02, 2002 4:59 PM
To: Log4J Users List
Subject: Re: Question about setup


Say you have packages com.foo.bar.util and com.foo.bar.system.

########################################################################
####
######
# Define root logger
########################################################################
####
######
log4j.rootLogger=DEBUG, STDOUT

########################################################################
####
######
# Define non-root loggers
########################################################################
####
######
log4j.com.foo.bar.util=DEBUG, UTL_FILE
log4j.additivity.com.foo.bar.util=false

log4j.com.foo.bar.system=DEBUG, SYS_FILE
log4j.additivity.com.foo.bar.system=false

########################################################################
####
######
# Appenders
########################################################################
####
######
log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout

log4j.appender.UTL_FILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.UTL_FILE.DatePatern='.'yyyy-MM-dd
log4j.appender.UTL_FILE.File=/your/log/dir/util.txt
log4j.appender.UTL_FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.UTL_FILE.layout.ConversionPattern=%d %-5p %m%n

log4j.appender.SYS_FILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.SYS_FILE.DatePatern='.'yyyy-MM-dd
log4j.appender.SYS_FILE.File=/your/log/dir/system.txt
log4j.appender.SYS_FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.SYS_FILE.layout.ConversionPattern=%d %-5p %m%n


HTH


----- Original Message -----
From: "Christopher Randall" <[EMAIL PROTECTED]>
To: "Log4j-User (E-mail)" <[EMAIL PROTECTED]>
Sent: Wednesday, January 02, 2002 6:53 PM
Subject: Question about setup


I would appreciate if somebody could indulge me with this architectural
question I have about Log4J:

I need to setup a logging scheme with the following characteristics:

1. Each package in our Java framework should have a corresponding
logging category (i.e. com.foo.bar)
2. Each logger category will have a different FileAppender to log to a
separate file, with a filename that corresponds to its package name
(i.e. com_foo_bar.txt)

Any suggestions on what the easiest way to set this up might be? I would
like to do as little programmatic setup as possible, putting as much of
the setup into a config file.

Thanks for your time in response,
Chris

--
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