简体   繁体   English

设置登录tomcat的单词

[英]Aspose words logging on tomcat

I'm using aspose.words (JAVA) in version 13.8.0 我在版本13.8.0中使用aspose.words(JAVA)

I'm not able to forward the log output to Tomcats (7) console. 我无法将日志输出转发到Tomcats(7)控制台。 At least I think so: 至少我是这样认为的:

com.aspose.words.Document word = new com.aspose.words.Document(content);
word.getMailMerge().setUseNonMergeFields(true);
org.w3c.dom.Document workObjectXml = createXml(root, "root", "MM.dd.yyyy");
word.getMailMerge().executeWithRegions(new XmlMailMergeDataSet(workObjectXml));

does not produce any log output with the following log4j.properties: 使用以下log4j.properties不会产生任何日志输出:

# Comment this line and uncomment the following to allow log writing to a local file
log4j.rootLogger=INFO, A
# log4j.rootLogger=INFO, A, local.file

log4j.appender.A=org.apache.log4j.ConsoleAppender

log4j.appender.A.layout=org.apache.log4j.PatternLayout
log4j.appender.A.layout.ConversionPattern=%d{ISO8601} %-5p %-85.85c - %m%n

## Project
log4j.logger.com.aspose.words=DEBUG

I found a similar issue for aspose.pdf here: http://www.aspose.com/community/forums/thread/495783/log4j-logging-package-issue-in-aspose.pdf.aspx But according to the post, this was fixed in aspose.pdf earlier than the release date of my library so my assumption is, that the issue I'm facing is not the same but in a different library. 我在这里找到了一个与aspose.pdf类似的问题: http : //www.aspose.com/community/forums/thread/495783/log4j-logging-package-issue-in-aspose.pdf.aspx但根据该帖子,此问题早于我的库的发布日期已在aspose.pdf中修复,因此我的假设是,我面临的问题并不相同,而是在另一个库中。

Seems like a log4j configuration issue to me. 对我来说似乎是一个log4j配置问题。

Try adding the following line at any initial stage of your program and see if it works. 尝试在程序的任何初始阶段添加以下行,并查看其是否有效。

BasicConfigurator.configure();

I did not test it in a web/Tomcat app, but I have the same issue in a console application. 我没有在Web / Tomcat应用程序中对其进行测试,但是在控制台应用程序中却存在相同的问题。 The log messages are created in the log file, but not on the console output. 日志消息在日志文件中创建,但不在控制台输出中。 It worked when I called the configure() method. 当我调用configure()方法时,它起作用了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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