logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JOSE L MARTINEZ-AVIAL <jlm...@gmail.com>
Subject Re: log4j:ERROR Could not parse file
Date Wed, 08 Feb 2012 23:09:17 GMT
Well, the references to *nullWEB-INF* seems pretty suspicious. I would
check the vAlue of prefix on the class Log4jInit.

2012/2/8 siv99 <sivaswamy99@gmail.com>

>
> Hi,
>   I am trying to use log4j in my application and i am getting following
> error. Thanks a lot for the help in advance.
>
>
> log4j:ERROR Could not parse file [nullWEB-INF/logging/log4j.xml].
> java.io.FileNotFoundException:
> /app/ENP/user_projects/domains/Domain2/nullWEB-INF/logging/log4j.xml (No
> such file or directory)
>        at java.io.FileInputStream.open(Native Method)
>        at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:106)
>        at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:66)
>        at
>
> sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
>        at
>
> sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
>        at java.net.URL.openStream(URL.java:1010)
>        at oracle.xml.parser.v2.XMLReader.openURL(XMLReader.java:2650)
>        at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:253)
>        at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:222)
>        at
> oracle.xml.jaxp.JXDocumentBuilder.parse(JXDocumentBuilder.java:155)
>        at
>
> weblogic.xml.jaxp.RegistryDocumentBuilder.parse(RegistryDocumentBuilder.java:163)
>        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:208)
>        at
> org.apache.log4j.xml.DOMConfigurator$1.parse(DOMConfigurator.java:749)
>        at
> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:866)
>        at
> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:755)
>        at
> org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:891)
>        at gov.cms.esrd.qip.utilities.Log4jInit.init(Log4jInit.java:16)
>        at javax.servlet.GenericServlet.init(GenericServlet.java:241)
>        at
>
> weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
>        at
>
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
>        at
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
>        at
>
> weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
>        at
>
> weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
>        at
>
> weblogic.servlet.internal.StubLifecycleHelper.&lt;init&gt;(StubLifecycleHelper.java:48)
>        at
>
> weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
>        at
>
> weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985)
>        at
>
> weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959)
>        at
>
> weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878)
>        at
>
> weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
>        at
>
> weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
>
>
>
> Here is my web.xml code
>
>   &lt;servlet&gt;
>      &lt;servlet-name&gt;log4j-init&lt;/servlet-name&gt;
>
>
>
> &lt;servlet-class&gt;gov.cms.esrd.qip.utilities.Log4jInit&lt;/servlet-class&gt;
>
>      &lt;init-param&gt;
>         &lt;param-name&gt;log4j-init-file&lt;/param-name&gt;
>
>         &lt;param-value&gt;WEB-INF/logging/log4j.xml&lt;/param-value&gt;
>      &lt;/init-param&gt;
>
>      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
>   &lt;/servlet&gt;
>
>
>
>
> configuration file (Log4jInit)code
>
> package gov.cms.esrd.qip.utilities;
>
>
>
> import javax.servlet.http.HttpServlet;
>
> import javax.servlet.http.HttpServletRequest;
>
> import javax.servlet.http.HttpServletResponse;
>
> import org.apache.log4j.xml.DOMConfigurator;
>
>
>
> public class Log4jInit extends HttpServlet {
>
>
>    public void init() {
>
>      String prefix = getServletContext().getRealPath("/");
>
>      String file = getInitParameter("log4j-init-file");
>
> // if the log4j-init-file is not set, then no point in trying
>
>        if (file != null) {
>
>            DOMConfigurator.configure(prefix + file);
>       }
>
>    }
>
>
>    public void doGet(HttpServletRequest req,
>  HttpServletResponse res) {
>
>    }
>
> }
>
>
>
> Log4j.xml file
>
> &lt;?xml version="1.0" encoding="UTF-8" ?&gt;
>
> &lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"&gt;
>
> &lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"&gt;
>  &lt;appender name="console" class="org.apache.log4j.ConsoleAppender"&gt;
>
>    &lt;param name="Target" value="System.out"/&gt;
>
>    &lt;layout class="org.apache.log4j.PatternLayout"&gt;
>      &lt;param name="ConversionPattern" value="%-5p %c{1} - %m%n"/&gt;
>
>    &lt;/layout&gt;
>  &lt;/appender&gt;
>  &lt;appender name="WeblogicAppender"
> class="gov.cms.esrd.qip.logging.WeblogicAppender"&gt;
>
>    &lt;layout class="org.apache.log4j.PatternLayout"&gt;&lt;/layout&gt;
>  &lt;/appender&gt;
>
>  &lt;appender name="RD"
> class="org.apache.log4j.DailyRollingFileAppender"&gt;
>  &lt;param name="file" value="logs/RD.BPM.log" /&gt;
>
>  &lt;param name="DatePattern" value="'.'yyy-MM-dd" /&gt;
>    &lt;layout class="org.apache.log4j.PatternLayout"&gt;
>
>      &lt;!-- Print the date in ISO 8601 format --&gt;
>
>      &lt;param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n"/&gt;
>
>    &lt;/layout&gt;
>
>  &lt;/appender&gt;
>  &lt;root&gt;
>
>    &lt;priority value="debug"/&gt;
>    &lt;appender-ref ref="RD"/&gt;
>  &lt;/root&gt;
>
> &lt;/log4j:configuration&gt;
>
>
> Thanks.
> --
> View this message in context:
> http://old.nabble.com/log4j%3AERROR-Could-not-parse-file-tp33289799p33289799.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message