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 ha...@asconeducation.com on 2005/04/12 17:14:48 UTC

RE: Log4j failed to initialize in Jbuilder 2005 web run/debug

Hi Jacob, thanks for the reply. 

I tried your suggestion but the problem persisted. Like you (and James,
thanks for your comment btw) I reckoned that there was a problem with
Tomcat as it obviously wasn't starting up, however I had the cause down
to Log4j because that was where it was sticking and other apps start n
debug fine. To rule out the built in TC I tried pointing JBuilder at a
remote tomcat with similar results. I have now moved over to Eclipse and
have run up against exactly the same problem when I attempt to run
Tomcat and debug from within the IDE which suggests it's a whole
combination of things. 

I had hoped to continue messing with this and come up with a solution
which I could pass on to the list (hence taking so long to get back to
yous), but in the meantime I'm building with ant, shipping to a
standalone Tomcat and using the Logging to do my debug. I know a lot of
you prefer this route but for me it's a load of hassle in comparisson
with the 'step through and watch' scenario I'm used to. 

When I get time I'll come back and figure it out

Thanks  again
Hamish



-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com] 
Sent: 23 March 2005 16:44
To: Log4J Users List
Subject: Re: Log4j failed to initialize in Jbuilder 2005 web run/debug



The error looks like it is happening at the Tomcat level.  This probably
means that commons-logging, which Tomcat uses, is finding Log4j in the
classpath and attempting to use it.  Try putting a very simple
"log4j.xml" config file in the Tomcat common/classes directory (or
elsewhere on the classpath) with a console appender and a basic root
logger that logs at the INFO level to the console appender.  That should
remove the unnecessary chatter.

Besides that, it looks like Tomcat isn't even starting up properly.
You're getting
java.lang.ClassNotFoundException:org.apache.catalina.core.StandardServer
.  That can't be good!  Logging for your app isn't even an issue yet
because Tomcat can't even start successfully, therefore you custom
logging initialization isn't even running.  Fix the other issues before
you assume that log4j isn't working.


Jake

Quoting hamish.rose@asconeducation.com:

> Hi All
>
> I'm new to asking questions but I'll try and keep it smart. Thanks in 
> advance if anyone can help.
>
> I've inherited someone else's web project and am attmpting to set it 
> up in JBuilder 2005 as it is the IDE I am used to.
>
> My predessor has used Log4j-1.2.8
>
> Currently I can build the project in Jbuilder and copy the web module 
> to a standalone Tomcat 4.1 and it works fine, logs are created ok etc.

> However when I try to launch it 'IN' Jbuilder using either of Tomcat 
> 4.1 or 5.0 to use the debug facility I get this error :
>
> log4j:WARN No appenders could be found for logger 
> (org.apache.commons.digester.Digester).
> log4j:WARN Please initialize the log4j system properly.
> (full stack trace listed below)
>
> >From http://logging.apache.org/log4j/ I gather this means that an
> appender hasn't been specified for a logger that's being loaded, 
> however the appenders are set for the root logger (see config file 
> below) which leads me to believe that the config file isn't being read

> at all. I tried deleting it and got exactly the same error. Not proof 
> but a possibility.
>
> Log4j-1.2.8.jar is in the WEB-INF/lib directory and Logging.cfg.xml is

> in WEB-INF/conf
>
> As I understand it the config file is loaded here:
>
> public class ContextListener implements ServletContextListener {
>
> public static final String CONF_DIR				=
> "/WEB-INF/conf/";
> public static final String LOG4J_CONF_FILE		=
> "logging.cfg.xml";
> public static final String HIBERNATE_CONF_FILE	=
"hibernate.cfg.xml";
>
> private static Logger logger = 
> Logger.getLogger(ContextListener.class);
>
> public void contextInitialized(ServletContextEvent aContext) { 
> DOMConfigurator.configure(aContext.getServletContext().getRealPath(CON
> F_
> DIR + LOG4J_CONF_FILE));
>
> (it then goes on to set up hibernate)
>
> As per suggestion on the log4j site I tried placing my config file in 
> WEB-INF/classes (I also asked JBuilder to copy it so it isn't deleted 
> when the classes directory is rebuilt)
>
> I've tried a variety of values for String CONF_DIR because in the past

> I've had problems with reading and writing files where realtive paths 
> in Jbuilder debug mode are different to the live environment (never 
> understood why)
>
> Initially I had commons-loggin.jar in lib as well but have removed it 
> because various disscussion boards suggest it might be interfering
>
> Right now I'm at a loss however I know from the postings I've read 
> that others have had success using Log4j when developing in Jbuilder 
> so I know it's possible. If anyone could shed some light I'd be very 
> grateful
>
> Hamish
>
> Loggin.cfg.xml:
>
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
> 	<appender name="A1" 
> class="org.apache.log4j.DailyRollingFileAppender">
> 		<param name="File"
value="d:/orgOnline/web/logs/organization.log"/>
> 		<param name="Append" value="false"/>
> 		<param name="DatePattern" value="'.'yyyy-MM-dd"/>
> 		<layout class="org.apache.log4j.PatternLayout">
> 			<param name="ConversionPattern"
> value="%d{yyyy-MM-dd}\t%d{HH:mm:ss}\t%r\t%-5p\t%x\t%t\t%c\t%m%n"/>
> 		</layout>
> 	</appender>
>
> 	<appender name="STDOUT"
class="org.apache.log4j.ConsoleAppender">
> 		<layout class="org.apache.log4j.PatternLayout">
> 			<param name="ConversionPattern"
> value="%d{HH:mm:ss}\t%-5p\t%m%n"/>
> 		</layout>
> 	</appender>
>
> 	<logger name="net.sf.hibernate">
> 		<level value="ERROR"/>
> 	</logger>
>
> 	<logger name="org.apache">
> 		<level value="ERROR"/>
> 	</logger>
>
> 	<root>
> 		<priority value="DEBUG"/>
> 		<appender-ref ref="STDOUT"/>
> 		<appender-ref ref="A1"/>
> 	</root>
> </log4j:configuration>
>
> Stack Trace:
>
> C:\Borland\JBuilder2005\jdk1.4\bin\javaw -classpath 
> "C:\Borland\JBuilder2005\thirdparty\jakarta-tomcat-4.1.30\bin\bootstra
> p.
>
jar;D:\orgOnline\classes;C:\Borland\JBuilder2005\thirdparty\jakarta-tomc
>
at-4.1.30\common\lib\servlet.jar;C:\Borland\JBuilder2005\thirdparty\juni
>
t3.8\junit.jar;C:\Borland\JBuilder2005\lib\unittest.jar;D:\orgOnline\web
>
\WEB-INF\lib\mysql-connector-java-3.1.7-bin.jar;C:\Borland\JBuilder2005\
>
thirdparty\jakarta-struts-1.1-lib\commons-beanutils.jar;C:\Borland\JBuil
>
der2005\thirdparty\jakarta-struts-1.1-lib\commons-collections.jar;C:\Bor
>
land\JBuilder2005\thirdparty\jakarta-struts-1.1-lib\commons-digester.jar
>
;C:\Borland\JBuilder2005\thirdparty\jakarta-struts-1.1-lib\commons-fileu
>
pload.jar;C:\Borland\JBuilder2005\thirdparty\jakarta-struts-1.1-lib\comm
>
ons-lang.jar;C:\Borland\JBuilder2005\thirdparty\jakarta-struts-1.1-lib\c
>
ommons-validator.jar;C:\Borland\JBuilder2005\thirdparty\jakarta-struts-1
>
.1-lib\jakarta-oro.jar;C:\Borland\JBuilder2005\thirdparty\jakarta-struts
>
-1.1-lib\struts.jar;D:\orgOnline\lib\log4j-1.2.8.jar;D:\orgOnline\lib\hi
>
bernate2.jar;C:\Borland\JBuilder2005\lib\mail.jar;C:\Borland\JBuilder200
>
5\lib\activation.jar;D:\orgOnline\lib\wrapper.jar;D:\orgOnline\lib\mysql
>
-connector-java-3.1.7-bin.jar;C:\Borland\JBuilder2005\lib\xercesImpl.jar
>
;C:\Borland\JBuilder2005\lib\xmlParserAPIs.jar;D:\orgOnline\lib\dom4j-1.
>
4.jar;D:\orgOnline\lib\odmg-3.0.jar;D:\orgOnline\lib\cglib-full-2.0.2.ja
> r;C:\Borland\JBuilder2005\jdk1.4\lib\tools.jar"
>
"-Dcatalina.home=C:/Borland/JBuilder2005/thirdparty/jakarta-tomcat-4.1.3
> 0"  -Xdebug -Xnoagent -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,address=computer16:1589,suspend=y
> org.apache.catalina.startup.Bootstrap -config
> D:\orgOnline\Tomcat\conf\server8081.xml start
> log4j:WARN No appenders could be found for logger
> (org.apache.commons.digester.Digester). log4j:WARN Please initialize
the
> log4j system properly.
> Catalina.start: java.lang.ClassNotFoundException:
> org.apache.catalina.core.StandardServer
> java.lang.ClassNotFoundException:
> org.apache.catalina.core.StandardServer
> at
>
org.apache.commons.digester.Digester.createSAXException(Digester.java:25
> 40)
> at
>
org.apache.commons.digester.Digester.createSAXException(Digester.java:25
> 66)
> at
org.apache.commons.digester.Digester.startElement(Digester.java:1276)
>
> at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
> Source)
> at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown
> Source)
> at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement
> (U
> nknown Source)
> at
>
org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRoot
> ElementHook(Unknown Source)
> at
>
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis
> patcher.dispatch(Unknown Source)
> at
>
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkno
> wn Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.apache.commons.digester.Digester.parse(Digester.java:1548)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:449)
> at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
> at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
>
>
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org