Hi Matt
 
I can only assume that the initial error (when you have no log4j.properties file) is 
down to the extensions you are using being dependant on log4j - which means you need 
the properties file so it knows what to do.
 
Using the Chiki log4j sorts this out - but there are a couple of things which may be 
giving you too much detail in your logs.
 
The category definitions only affect logging messages going thru that category, so 
changing them in the properties file will only affect the messages which go thru that 
category. Then there is the debug level as detailed in your web.xml....
 
One question to consider is which category the messages are coming through (from one 
of the extensions), and then include THAT category in your log4j properties file at 
the appropriate level. You should find some mention of the Category in use in the 
extensions documentation. By using the Chiki config for log4j, the used Category isnt 
mentioned - isnt set to any level - so you're getting all the messages. By including 
it and setting the level as required will reduce the number of messages.
I'd check your web.xml too. As the one included here doesn't have debug levels set to 
zero...I'm not totally familiar with the extensions you are using (yet) but the 
messages must be coming from them if you are not using any loggin in your app yet. So 
check the docs that come with them (and examples) for any mention of the log4j 
dependancy and configuration re the Category being used..

Hope this helps

Ghoot

 
 

-----Original Message-----
From: Matt Raible [mailto:[EMAIL PROTECTED]]
Sent: 12 February 2002 23:50
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Log4J and Struts - using Chiki's log4j configuration and getting tons of 
messages



Hello,

I am trying to implement log4j in my application.  I'm using the Struts nightly build. 
 If I don't have a log4j.properties file in my WEB-INF/classes directory, I get the 
following error:

log4j:ERROR No appenders could be found for category (org.apache.commons.digester).

log4j:ERROR Please initialize the log4j system properly.

I think this is being kicked off my one of the servlets in my web.xml because I 
haven't even written any code yet, but I am using Validator, Workflow and Tiles.  

So I copied the log4j.cfg file from Chiki's WEB-INF directory, renamed and put in in 
its place.  Now I get more logging messages than I can stand, and I have changed all 
the debug and detail values in web.xml to 0.  My log file on startup is over 1000 
lines long.  

Does anyone have any idea how to configure this properly - or point me towards a 
resource that does.  A simple "search the archives" is fine as well.

Thanks,

Matt

Log4j.properties file:

log4j.rootCategory=debug, stdout, R

log4j.appender.stdout=org.apache.log4j.ConsoleAppender

log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.

log4j.appender.stdout.layout.ConversionPattern=%p [%t] [%c] %C{1}.%M(%L) | %m%n

log4j.appender.R=org.apache.log4j.RollingFileAppender

log4j.appender.R.File=onpoint.log

log4j.appender.R.MaxFileSize=100KB

# Keep one backup file

log4j.appender.R.MaxBackupIndex=1

log4j.appender.R.layout=org.apache.log4j.PatternLayout

log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

log4j.category.Init=DEBUG

log4j.category.Config=DEBUG

log4j.category.Actions=DEBUG

log4j.category.Repository=DEBUG

log4j.category.Persister=DEBUG

log4j.category.Translator=DEBUG

log4j.category.Cache=DEBUG

log4j.category.Validator=DEBUG

log4j.category.Registry=DEBUG

log4j.category.Event=DEBUG

First few lines of my log file:

DEBUG main org.apache.commons.digester - Pop org.apache.struts.action.ActionForward

DEBUG main org.apache.commons.digester - ignorableWhitespace(

                )

DEBUG main org.apache.commons.digester - endElement(,action,action)

Here are the servlets in my web.xml:

        <!-- Workflow Registry Servlet Configuration -->

        <servlet>

                <servlet-name>registry</servlet-name>

                
<servlet-class>com.onpoint.webapp.workflow.RegistryServlet</servlet-class>

                <init-param>

                        <param-name>registry</param-name>

                        <param-value>/WEB-INF/workflow.xml</param-value>

                </init-param>

                <init-param>

                        <param-name>debug</param-name>

                        <param-value>999</param-value>

                </init-param>

                <init-param>

                        <param-name>detail</param-name>

                        <param-value>999</param-value>

                </init-param>

                <load-on-startup>1</load-on-startup>

        </servlet>

        <!-- "Wizard" Activity Servlet Configuration -->

        <servlet>

                <servlet-name>wizard</servlet-name>

                
<servlet-class>org.apache.commons.workflow.web.ActivityServlet</servlet-class>

                <init-param>

                        <param-name>activity</param-name>

                        <param-value>/WEB-INF/workflow.xml</param-value>

                </init-param>

                <init-param>

                        <param-name>debug</param-name>

                        <param-value>999</param-value>

                </init-param>

                <init-param>

                        <param-name>detail</param-name>

                        <param-value>999</param-value>

                </init-param>

                <load-on-startup>1</load-on-startup>

        </servlet>

        <!-- Validator Initialization Servlet Configuration -->

        <servlet>

                <servlet-name>validator</servlet-name>

                
<servlet-class>com.wintecinc.struts.action.ValidatorServlet</servlet-class>

                <init-param>

                        <param-name>config</param-name>

                        <param-value>/WEB-INF/validator.xml</param-value>

                </init-param>

                <init-param>

                        <param-name>debug</param-name>

                        <param-value>2</param-value>

                </init-param>

                <load-on-startup>2</load-on-startup>

        </servlet>

        <!-- Action Servlet Configuration -->

        <servlet>

                <servlet-name>action</servlet-name>

                
<servlet-class>org.apache.struts.tiles.ActionComponentServlet</servlet-class>

                <init-param>

                        <param-name>definitions-config</param-name>

                        <param-value>/WEB-INF/tiles-config.xml</param-value>

                </init-param>

                <init-param>

                        <param-name>definitions-debug</param-name>

                        <param-value>1</param-value>

                </init-param>

                <init-param>

                        <param-name>definitions-parser-details</param-name>

                        <param-value>0</param-value>

                </init-param>

                <init-param>

                        <param-name>definitions-parser-validate</param-name>

                        <param-value>true</param-value>

                </init-param>

                <init-param>

                        <param-name>application</param-name>

                        <param-value>ApplicationResources</param-value>

                </init-param>

                <init-param>

                        <param-name>config</param-name>

                        <param-value>/WEB-INF/struts-config.xml</param-value>

                </init-param>

                <init-param>

                        <param-name>debug</param-name>

                        <param-value>2</param-value>

                </init-param>

                <init-param>

                        <param-name>detail</param-name>

                        <param-value>3</param-value>

                </init-param>

                <init-param>

                        <param-name>validate</param-name>

                        <param-value>true</param-value>

                </init-param>

                <load-on-startup>2</load-on-startup>

        </servlet>

Reply via email to