From: David C. <Dav...@di...> - 2005-07-19 16:49:31
|
Hi, there: Just follow up my previous email. If I unzip Jetty4.2.24-all package, after deploying my webapplications on its webapps directory, I did see everything is logged in logs\log4jetty.log, which means it takes extra\plus\resources\log4j.xml as log4j.configuration. However, if I unzip Jetty4.2.24.tar, and just copied the same log4j.xml and log4j.jar to ext\ directory, and run jetty as: Java -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger -Dlog4j.configuration=log4j.xml -jar start.jar etc\jetty.xml Jetty gives me warning as: log4j:WARN No appenders could be found for logger (com.xyz.myproject.web.Main). log4j:WARN Please initialize the log4j system properly. And no log file is created, nothing is logged correctly. Highly appreciated if anyone can help me on that issue. Thanks a lot in advance. David -----Original Message----- From: jet...@li... [mailto:jet...@li...] Sent: Tuesday, July 19, 2005 9:20 AM To: jet...@li... Subject: RE: [jetty-discuss] Re: How to get log4j work in Jetty4.2.24 Hi, Jan: Thank you very much for the reply. I followed what you said: a. moved log4j.xml to ext directory; b. run jetty as: java -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger -Dlog4j.configuration=log4j.xml -jar start.jar etc\jetty.xml However, I still got that problem: > log4j:WARN No appenders could be found for logger > (com.xyz.myproject.web.Main). > log4j:WARN Please initialize the log4j system properly. And the log file is not even created. Is there any problem in my log4j.xml? Thanks a lot David -----Original Message----- From: jet...@li... [mailto:jet...@li...] Sent: Tuesday, July 19, 2005 4:23 AM To: jet...@li... Subject: [jetty-discuss] Re: How to get log4j work in Jetty4.2.24 David, AFAIK, you have to tell log4j where to find it's configuration file. So you have to use something like: -Dlog4j.configuration=log4j.xml Where log4j.xml has to be on the classpath, by which I mean the same classpath as the log4j.jar. So try copying the log4j.xml file into the /ext directory. regards Jan David Chen wrote: > Hi, there: > > After using Jetty4.2.24, we have some issues on log4j. Our web > applications are using log4j for logs. Read the tutorial, so, I did > following steps: > > a. moved log4j.jar from webapplication WEB-INF\lib to ext directory; > b. run: java > -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4J > Logger > -jar start.jar etc\jetty.xml > > It gives me the warning: > log4j:WARN No appenders could be found for logger > (com.xyz.myproject.web.Main). > log4j:WARN Please initialize the log4j system properly. > > > my questions: > a. should I use log4j.properties or log4j.xml or either one will work > in Jetty4.2.24? > b. currently I put log4j.xml in > C:\jetty-4.2.24\webapps\myapplication\WEB-INF\lib, is that correct? > > Highly appreciated if any suggestions > > Thanks a lot > > David > > Here are my log4j.xml for your reference: > > <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration > SYSTEM "log4j.dtd"> > > <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" > debug="false"> > > > <!-- ============================== --> > <!-- Append messages to the console --> > <!-- ============================== --> > <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> > <param name="Threshold" value="TRACE"/> > <param name="Target" value="System.err"/> > > <layout class="org.apache.log4j.PatternLayout"> > <!-- The default pattern: Date Priority [Category] Message\n --> > <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] > %m%n"/> > </layout> > </appender> > > <appender name="FILE" class="org.apache.log4j.FileAppender"> > <param name="Threshold" value="INFO"/> > <param name="File" value="${jetty.home}/logs/WebBooker.log"/> > > <layout class="org.apache.log4j.PatternLayout"> > <!-- The default pattern: Date Priority [Category] Message\n --> > <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] > %m%n"/> > </layout> > </appender> > > > <root> > <appender-ref ref="CONSOLE"/> > <appender-ref ref="FILE"/> > </root> > > </log4j:configuration> ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ jetty-discuss mailing list jet...@li... https://lists.sourceforge.net/lists/listinfo/jetty-discuss ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ jetty-discuss mailing list jet...@li... https://lists.sourceforge.net/lists/listinfo/jetty-discuss |