简体   繁体   中英

How do I configure log4j.xml for a web app?

I am trying to run a java application on webLogic and I use log4j. I put the log4j.xml in WebContent/WEB-INF both eclipse and webLogic server(when i try to run the application on the server and eclipse in problems) say that A DOCTYPE is not allowed in content. I understand the problem comes from the log4j.xml containing the first line below:

<element><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"></element>
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
...
</log4j:configuration>

. Is the log4j.xml not supposed to be placed in WebContent folder? is there another way to configure log4j not using !DOCTYPE?

Your XML is not really XML (so you don't even need to look at the log4j stuff).

Doctypes must be declared before the body of the XML document. You have it in the middle of the "element" tag. By placing the doctype in the middle of a tag, the document "becomes" not XML.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM