You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Pat Farrell <pf...@pfarrell.com> on 2009/09/28 01:23:44 UTC
everything is logged to "root" as well as where I want it.
I think my configuration is a bit off. While the loggers for the
specific classes work fine, everything is also being logged to the root
logger, and I have "additivity" off.
Or at least, I think its off properly.
Could someone take a look and see what I'm doing wrong?
Thanks
Pat
== log4j.properties ====
# in app
### direct log messages to stdout ###
log4j.additivity.default=false
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L
- %m%n
log4j.appender.base=org.apache.log4j.FileAppender
log4j.appender.base.File=/tmp/root.log
log4j.appender.base.layout=org.apache.log4j.PatternLayout
log4j.appender.base.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
%m%n
log4j.appender.fnfbookfile=org.apache.log4j.FileAppender
log4j.appender.fnfbookfile.File=/tmp/fnfbook.log
log4j.appender.fnfbookfile.layout=org.apache.log4j.PatternLayout
log4j.appender.fnfbookfile.layout.ConversionPattern=%d{ABSOLUTE} %5p
%c{1}:%L - %m%n
log4j.additivity.fnfbookfile=false
log4j.appender.pat=org.apache.log4j.FileAppender
log4j.appender.pat.File=/tmp/pat.log
log4j.appender.pat.layout=org.apache.log4j.PatternLayout
log4j.appender.pat.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.additivity.pat=false
log4j.rootLogger=INFO, stdout, base
#log4j.rootLogger=DEBUG, stdout, base
log4j.rootLogger.layout=org.apache.log4j.PatternLayout
log4j.rootLogger.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.logger.com.fnfbook=DEBUG, stdout, fnfbookfile
log4j.logger.com.pfarrell=DEBUG, stdout, pat
log4j.logger.org.bibeault=DEBUG, stdout, pat
#log4j.logger.org.bibeault=INFO, stdout, base
--
Pat Farrell
http://www.pfarrell.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: everything is logged to "root" as well as where I want it.
Posted by Pat Farrell <pf...@pfarrell.com>.
Jacob Kjome wrote:
> You're already inheriting the "stdout" and "base" appenders from the
> root logger. Don't re-define these on your child loggers unless
> additivity is turned off, which it is not. Additivity does not apply to
> appenders, it applies to loggers, e.g.,....
>
> log4j.additivity.com.fnfbook=false
>
> I would think twice about additivity, though. Why do you need it? I
> think you are using it here in a desperate attempt to get logging going
> to the right places without really understanding what it is to be used
> for.
You are correct. I've put them there in an attempt to make things split.
I want things to be split, go to specific log if its defined, and only
to root.log when nothing else "catches" the log requrest
> Just don't define "stdout" and "base" on your child loggers and
> see how things go before attempting to use additivity.
I'll try that, thanks
--
Pat Farrell
http://www.pfarrell.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: everything is logged to "root" as well as where I want it.
Posted by Jacob Kjome <ho...@visi.com>.
You're already inheriting the "stdout" and "base" appenders from the root
logger. Don't re-define these on your child loggers unless additivity is
turned off, which it is not. Additivity does not apply to appenders, it
applies to loggers, e.g.,....
log4j.additivity.com.fnfbook=false
I would think twice about additivity, though. Why do you need it? I think
you are using it here in a desperate attempt to get logging going to the right
places without really understanding what it is to be used for. Just don't
define "stdout" and "base" on your child loggers and see how things go before
attempting to use additivity. I would guess that right now you are getting
each logger statement logged twice because of the duplicate appender
definitions. I think that's the real issue you are trying to get rid of here,
no?
Jake
On Sun, 27 Sep 2009 19:23:44 -0400
Pat Farrell <pf...@pfarrell.com> wrote:
> I think my configuration is a bit off. While the loggers for the
> specific classes work fine, everything is also being logged to the root
> logger, and I have "additivity" off.
>
> Or at least, I think its off properly.
>
> Could someone take a look and see what I'm doing wrong?
>
> Thanks
> Pat
>
> == log4j.properties ====
> # in app
> ### direct log messages to stdout ###
> log4j.additivity.default=false
>
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.Target=System.out
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L
> - %m%n
>
> log4j.appender.base=org.apache.log4j.FileAppender
> log4j.appender.base.File=/tmp/root.log
> log4j.appender.base.layout=org.apache.log4j.PatternLayout
> log4j.appender.base.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
> %m%n
>
> log4j.appender.fnfbookfile=org.apache.log4j.FileAppender
> log4j.appender.fnfbookfile.File=/tmp/fnfbook.log
> log4j.appender.fnfbookfile.layout=org.apache.log4j.PatternLayout
> log4j.appender.fnfbookfile.layout.ConversionPattern=%d{ABSOLUTE} %5p
> %c{1}:%L - %m%n
> log4j.additivity.fnfbookfile=false
>
> log4j.appender.pat=org.apache.log4j.FileAppender
> log4j.appender.pat.File=/tmp/pat.log
> log4j.appender.pat.layout=org.apache.log4j.PatternLayout
> log4j.appender.pat.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
> log4j.additivity.pat=false
>
> log4j.rootLogger=INFO, stdout, base
> #log4j.rootLogger=DEBUG, stdout, base
> log4j.rootLogger.layout=org.apache.log4j.PatternLayout
> log4j.rootLogger.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
>
>
> log4j.logger.com.fnfbook=DEBUG, stdout, fnfbookfile
> log4j.logger.com.pfarrell=DEBUG, stdout, pat
> log4j.logger.org.bibeault=DEBUG, stdout, pat
> #log4j.logger.org.bibeault=INFO, stdout, base
>
> --
> Pat Farrell
> http://www.pfarrell.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: everything is logged to "root" as well as where I want it.
Posted by Pat Farrell <pf...@pfarrell.com>.
Brett Randall wrote:
> On Mon, Sep 28, 2009 at 9:23 AM, Pat Farrell <pf...@pfarrell.com> wrote:
>> I think my configuration is a bit off. While the loggers for the
>> specific classes work fine, everything is also being logged to the root
>> logger, and I have "additivity" off.
> When you say it is going to the root logger, are you saying that you are
> seeing the entries appended to /tmp/root.log? Or something else?
Yes, I mean everything is going to /tmp/root.log
as well as to the specific log that it is supposed to go to.
I want things to be split, go to specific log if its defined, and only
to root.log when nothing else "catches" the log requrest
Thanks
--
Pat Farrell
http://www.pfarrell.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: everything is logged to "root" as well as where I want it.
Posted by Brett Randall <ja...@gmail.com>.
On Mon, Sep 28, 2009 at 9:23 AM, Pat Farrell <pf...@pfarrell.com> wrote:
> I think my configuration is a bit off. While the loggers for the
> specific classes work fine, everything is also being logged to the root
> logger, and I have "additivity" off.
>
> Or at least, I think its off properly.
>
> Could someone take a look and see what I'm doing wrong?
>
> Thanks
> Pat
>
> == log4j.properties ====
> # in app
> ### direct log messages to stdout ###
> log4j.additivity.default=false
>
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.Target=System.out
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L
> - %m%n
>
> log4j.appender.base=org.apache.log4j.FileAppender
> log4j.appender.base.File=/tmp/root.log
> log4j.appender.base.layout=org.apache.log4j.PatternLayout
> log4j.appender.base.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
> %m%n
>
> log4j.appender.fnfbookfile=org.apache.log4j.FileAppender
> log4j.appender.fnfbookfile.File=/tmp/fnfbook.log
> log4j.appender.fnfbookfile.layout=org.apache.log4j.PatternLayout
> log4j.appender.fnfbookfile.layout.ConversionPattern=%d{ABSOLUTE} %5p
> %c{1}:%L - %m%n
> log4j.additivity.fnfbookfile=false
>
> log4j.appender.pat=org.apache.log4j.FileAppender
> log4j.appender.pat.File=/tmp/pat.log
> log4j.appender.pat.layout=org.apache.log4j.PatternLayout
> log4j.appender.pat.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
> %m%n
> log4j.additivity.pat=false
>
> log4j.rootLogger=INFO, stdout, base
> #log4j.rootLogger=DEBUG, stdout, base
> log4j.rootLogger.layout=org.apache.log4j.PatternLayout
> log4j.rootLogger.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
>
>
> log4j.logger.com.fnfbook=DEBUG, stdout, fnfbookfile
> log4j.logger.com.pfarrell=DEBUG, stdout, pat
> log4j.logger.org.bibeault=DEBUG, stdout, pat
> #log4j.logger.org.bibeault=INFO, stdout, base
>
> --
> Pat Farrell
> http://www.pfarrell.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
Pat
When you say it is going to the root logger, are you saying that you are
seeing the entries appended to /tmp/root.log? Or something else?
Brett