Quoting Deep Chand <[EMAIL PROTECTED]>:

> Hi,
>
> I'm trying to use Log4J for logging. I get the following error during start
> up:
> log4j:WARN No appenders could be found for logger
> (org.apache.commons.digester.Digester)
> log4j:WARN Please initialize the log4j system properly.
>
> After that it goes in some sort of loop. No idea what it is missing.
>

Not sure about the endless loop, but the first message you see happens because
Log4j default initialization which happens upon JVM startup cannot find a log4j
config file.  I suggest you put a log4j config file in (assuming you use Tomcat)
CATALINA_HOME/common/classes to avoid the error message.  This would be Tomcat's
logging.  Then either use a logger repository selector or put log4j.jar in
WEB-INF/lib of your app.  I also suggest that you put a dummy log4j.xml file in
WEB-INF/classes to avoid warnings like the above just before you do your manual
configuration... or just rename your config file "log4j.xml" and let default
initializtion do its work.  You aren't doing anything special in your
configuration, so there is no reason to do it manually.

Jake

> Below is the configuration details:
>
> log4j-1.2.12.jar is in \common\lib directory. commons-logging.jar is also
> there.
>
> InitializationServlet which loads on start up has the following code.
> I don't see any exceptions in this code.
>           String prefix =  getServletContext().getRealPath("/");
>           String file = prefix+getInitParameter("log4j-init-file");
>           // if the log4j-init-file is not set, then no point in trying
>           if(file != null) {
>             DOMConfigurator.configure(file);
>             }
>
>
> log4jconfig.xml placed in \WEB-INF\classes directory is as follows:
>
>       <appender name="A1" class="org.apache.log4j.FileAppender">
>             <param name="File"   value="D:\dgworld.log" />
>             <param name="Append" value="false" />
>             <layout class="org.apache.log4j.PatternLayout">
>               <param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/>
>             </layout>
>       </appender>
>
>       <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
>               <layout class="org.apache.log4j.PatternLayout">
>                    <param name="ConversionPattern"
>                         value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
>               </layout>
>       </appender>
>       <category name="com.dgworld">
>         <priority value="debug" />
>         <appender-ref ref="A1" />
>       </category>
>
>       <root>
>          <priority value ="debug" />
>          <appender-ref ref="STDOUT" />
>       </root>
>
> ---------------------------------------------------------------------
> 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