You seem to be attempting to use additivity to achieve your desired results,
except your syntax is entirely wrong. You are applying additivity to the
appenders, when additivity applies to loggers.
First of all, let's generalize your requirements. Is it the case that you
merely want the "com.org.do.presentation.don" and child loggers to go to
"a.log", but are ok with said logger (along with all other loggers) showing up
in the other logs inherited from the root logger? If so, you don't need the
added complexity of additivity. Just do....
log4j.rootLogger=DEBUG, stdout, R, ALERTS
log4j.logger.com.org.do.presentation.don=DEBUG, WEB
BTW, I recommend that you set the level on the rootLogger to something like
"WARN" or, at least "INFO" to avoid massive amounts of logging from arbitrary
loggers like those in the apache commons libraries or struts that you probably
don't care about unless they are at WARN or above. If you need individual
packages (and their children) to log at a less stringent level, then you can
explicitly declare those.
If you do want to use additivity, then do...
log4j.additivity.com.org.do.presentation.don=false
Jake
On Mon, 20 Jul 2009 16:44:12 +0530 (IST)
ram <[email protected]> wrote:
Hi jocob,
Thanks, for the reply. I tried with your suggestion, but still logs are
comming in both the files
Here is the updated log4j which i tried
log4j.rootLogger=DEBUG, stdout, WEB, R, ALERTS,
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
%m%n
log4j.appender.WEB=org.apache.log4j.DailyRollingFileAppender
log4j.appender.WEB.File=C:/logs/a.log
log4j.appender.WEB.DatePattern='.'yyyy-MM-dd-a
log4j.appender.WEB.layout=org.apache.log4j.PatternLayout
log4j.appender.WEB.layout.ConversionPattern=%d %p [%t] %c.%M() - %m%n
log4j.logger.com.org.do.presentation.don =debug,WEB
log4j.additivity.WEB=false
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=C:/logs/b.log
log4j.appender.R.DatePattern='.'yyyy-MM-dd-a
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d %p [%t] %c.%M() - %m%n
log4j.logger.com.org.do.presentation.application=debug,WEB
log4j.additivity.R=false
com.org.do.presentation.application should go to b.log
log4j.logger.com.org.do.presentation.don should go to a.log
Thanks & Regards,
Ram
--- On Fri, 17/7/09, Jacob Kjome <[email protected]> wrote:
From: Jacob Kjome <[email protected]>
Subject: Re: log4j properteis set up for different packages
To: "Log4J Users List" <[email protected]>
Date: Friday, 17 July, 2009, 10:40 PM
Please correct your log4j.properties. It's got two definitions for
"rootLogger". And one has the appender before the logging level which is
wrong.
In any case, it looks like in both cases you are attempting a add, at least,
the R appender to the root logger. If you do that, then all child loggers
will inherit it and log to it. If you expect certain child loggers not to
log to it, then either can't set it at the root logger or you need to set
additivity to false for the loggers you don't want to go to the R appender.
Jake
On Fri, 17 Jul 2009 17:48:18 +0530 (IST)
Seetha Rama Krishna <[email protected]> wrote:
Hi,
I am having two war (a.war, b.war)files each one is having its one
log4j.properties. so two log files(a.log and b.log) are getting generated
Previously, these log4j.properties are there in each of the war files. so
there is no problem is generating the log files.
I have removed these two log4j.properties from made it one
log4j.proeprties and log information
has to go to with respect the package
com.org.do.presentation.don and its subsequent packages
com.org.do.presentation.don.application,
com.org.do.presentation.don.application.car like has to go a.log
com.org.do.presentation.admin.struts and its subsequent packages pacakages
to go b.log
Now the problem, log information is not populated as expected.
here is log 4j.properties
log4j.properties
log4j.rootLogger=DEBUG, stdout, WEB, R, ALERTS,
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L -
%m%n
log4j.logger.com.org.do.presentation.don =debug,WEB
log4j.appender.WEB=org.apache.log4j.DailyRollingFileAppender
log4j.appender.WEB.File=C:/logs/a.log
log4j.appender.WEB.DatePattern='.'yyyy-MM-dd-a
log4j.appender.WEB.layout=org.apache.log4j.PatternLayout
log4j.appender.WEB.layout.ConversionPattern=%d %p [%t] %c.%M() - %m%n
#log4j.additivity.WEB=false
log4j.rootLogger=R,debug
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=C:/logs/b.log
log4j.appender.R.DatePattern='.'yyyy-MM-dd-a
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d %p [%t] %c.%M() - %m%n
#log4j.additivity.R=false
-------------------------------------
# Individual Class/Package Log Settings
# -------------------------------------
log4j.logger._jsps=DEBUG
log4j.logger.com.org=DEBUG
log4j.logger.com.org.doe=DEBUG
log4j.logger.org.apache=ERROR
Can any let me know where i am doing mistake
Thanks & Regards,
Ram
See the Web's breaking stories, chosen by people like you. Check out
Yahoo! Buzz. http://in.buzz.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Love Cricket? Check out live scores, photos, video highlights and more.
Click here http://cricket.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]