我希望使用log4j
将所有信息,错误等保存到文本文件中为此,我已经配置了log4j并将其添加到我的函数中。
这里的问题是当我这样做时,这个控制台只显示我:
public class MainApp {
public static void main(String[] args) {
XMLValidationsFunctions objLog4JCoreJavaSample = new XMLValidationsFunctions();
objLog4JCoreJavaSample.callMeInAppInfo("Log4JCoreJavaSample by Info");
objLog4JCoreJavaSample.callMeInAppDebug("Log4JCoreJavaSample by Debug");
}
}
作为一个例子,当我执行该代码时,我希望它向服务器显示信息和控制台中的所有内容,并将其外部保存到.txt文件中
13:15:58,881 INFO [org.docx4j.jaxb.Context] (http-localhost/127.0.0.1:8080-
vfs:/C:/Users/burkilic/EAP-6.3.0/jboss-eap-6.3/standalone/deployments/epo-
transformer.war/WEB-INF/lib/jaxb-core-2.2.7.jar/META-INF/MANIFEST.MF
13:15:58,881 INFO [org.docx4j.jaxb.Context] (http-localhost/127.0.0.1:8080-
1) Implementation-Title : JAXB Reference Implementation
13:15:58,881 INFO [org.docx4j.jaxb.Context] (http-localhost/127.0.0.1:8080-
1) Implementation-Version : 2.2.7
13:15:58,881 INFO [org.docx4j.jaxb.Context] (http-localhost/127.0.0.1:8080-
1) Class-Path : jaxb-api.jar
13:15:58,881 INFO [org.docx4j.jaxb.Context] (http-localhost/127.0.0.1:8080-
1) Manifest-Version : 1.0
13:15:58,882 INFO [org.docx4j.jaxb.Context] (http-localhost/127.0.0.1:8080-
1) Specification-Vendor : Oracle Corporation
13:15:58,882 INFO [org.docx4j.jaxb.Context] (http-localhost/127.0.0.1:8080-
1) Created-By : 1.6.0_32-b05 (Sun Microsystems Inc.)
13:15:58,882 INFO [org.docx4j.jaxb.Context] (http-localhost/127.0.0.1:8080-
文本文件正在保存错误一切似乎都很好但我无法将日志文件与我想要保存的所有信息集成。