At 05:06 PM 10/20/2006, you wrote:
>Hi,
>Logging seems to be working now, but I did notice the duplicate entries
>
>Does "re-declare the appender" refer to the stdout section?
>### direct log messages to stdout ###
>

What I mean by "duplicate entries" is...

log4j.rootLogger=info, R
log4j.logger.org.apache.struts.action.ActionServlet=debug,R

In the above, the "R" appender is assigned to the root logger. It is also assigned to the ActionServlet logger, which inherits from the root logger. Since you already defined the "R" appender to the root logger, the ActionServlet logger already has "R", but then you define it explicitly on the ActionServlet again. What this does is create two instances of the "R" appender so for any ActionServlet logging, you will get two messages; one for each instance of the "R" appender. To correct this, you should use...

log4j.rootLogger=info, R
log4j.logger.org.apache.struts.action.ActionServlet=debug

Notice that the "R" appender is no longer explicitly declared on the ActionServlet logger. This same concept should be applied to all loggers which inherit the appender from a parent.


Jake

>
>-----Original Message-----
>From: Jacob Kjome [mailto:[EMAIL PROTECTED]
>Sent: Friday, October 20, 2006 2:06 PM
>To: Log4J Users List
>Subject: RE: Struts 1.2.9 INFO logging
>
>
>Where do you put this config file?  Is it deployed with your webapp or in
>CATALINA_HOME/common/classes?
>
>BTW, unless you turn off additivity for a particular logging hierarchy, you
>shouldn't re-declare the appender on the logger when it already exists on
>the
>rootLogger.  You'll end up with duplicate entries with the way your file is
>written ATM.
>
>Jake
>
>Quoting Dave Kennedy <[EMAIL PROTECTED]>:
>
>> Here is the Log4j.properties file
>> ### Tomcat
>> #log4j.rootLogger=debug, R
>> log4j.rootLogger=info, R
>> log4j.appender.R=org.apache.log4j.RollingFileAppender
>> log4j.appender.R.File=${catalina.home}/logs/tomcat.log
>> log4j.appender.R.MaxFileSize=10MB
>> log4j.appender.R.MaxBackupIndex=10
>> log4j.appender.R.layout=org.apache.log4j.PatternLayout
>> log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
>> log4j.logger.org.apache.catalina=info, R
>> log4j.logger.org.apache.catalina.core.ApplicationContext=info,R
>> log4j.logger.org.apache.struts.action.ActionServlet=debug,R
>> #log4j.logger.org.apache.catalina=DEBUG, R
>> ### direct log messages to stdout ###
>> 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.logger.org.hibernate=info
>> ### log JDBC bind parameters ###
>> log4j.logger.org.hibernate.type=info
>> ### log schema export/update ###
>> log4j.logger.org.hibernate.tool.hbm2ddl=debug
>>
>> -----Original Message-----
>> From: Dave Kennedy [mailto:[EMAIL PROTECTED]
>> Sent: Friday, October 20, 2006 12:06 PM
>> To: log4j-user@logging.apache.org
>> Subject: Struts 1.2.9 INFO logging
>>
>> Hi,
>> ENV: Struts 1.2.9, Tomcat 5.5, Eclipse 3.2.0, Hibernate 3.2, Log4j
>>
>> Struts is using JCL and JCL is configured to use log4j everything should
>be
>> fine.
>> Struts is configured to output INFO logging,
>>
>> INFO: action:   Creating new Action instance
>> Oct 20, 2006 10:40:07 AM org.apache.catalina.core.ApplicationContext log
>> INFO: action: Processing a POST for /cancel
>>
>> but the statements are not written to the Tomcat log file in the above
>ENV?
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>
>--
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.1.408 / Virus Database: 268.13.8/489 - Release Date: 10/20/2006
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]


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

Reply via email to