> I must be missing something obvious, but I cannot get a Category of mine
to
> log to a location other than that of the rootCategory. Can someone point
out
> what I'm missing?
>
> The behaviour I'd like is for all loggers to output to a file, except for
> one category, which should log to the console. I've defined "A1" and "A2"
as
> my appenders and both are functional, in that if I assign the root
category
> to go there, everything goes where it's instructed to go.
>
> But if I assign my category, umn.edu.cidrap.admin.ContentBean, to use one
or
> the other or both, it doesn't. The output goes where the rootCategory is
> defined to go.
>
> Any help would be appreciated. I think I've covered all the documentation,
> but if it's there, I'm not seeing it.

Everything inherits from root unless you tell it otherwise.
With your setup umn.edu.cidrap.admin.ContentBean will
go to both A1 and A2.  To stop this turn additivity off, like

log4j.additivity.umn.edu.cidrap.admin.ContentBean = false

It is in the manual.  Inheritance is very well documented and
a key feature of log4j.  Additivity flag is pretty obscure but it is
in the docs.

BTW, since you are in the umn.edu domain you should be naming
your packages like edu.umn.
- Dan

> # define which appenders to use for our categories/loggers
> log4j.rootCategory=DEBUG, A1
> log4j.category.umn.edu.cidrap.admin.ContentBean=, A2
>
>
> # A1 is set to be a ConsoleAppender which outputs to System.out.
> log4j.appender.A2=org.apache.log4j.ConsoleAppender
>
> log4j.appender.A1=org.apache.log4j.FileAppender
> log4j.appender.A1.File=log4j-test.log
>
>
> # A1 uses PatternLayout; so does A2
> log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> log4j.appender.A2.layout=org.apache.log4j.PatternLayout
>
> # The conversion pattern uses format specifiers. Both the same.
> log4j.appender.A1.layout.ConversionPattern=%-4r %-5p [%t] %37c %3x - %m%n
> log4j.appender.A2.layout.ConversionPattern=%-4r %-5p [%t] %37c %3x - %m%n



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

Reply via email to