简体   繁体   中英

Aspose words logging on tomcat

I'm using aspose.words (JAVA) in version 13.8.0

I'm not able to forward the log output to Tomcats (7) console. 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:

# 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.

Seems like a log4j configuration issue to me.

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. The log messages are created in the log file, but not on the console output. It worked when I called the configure() method.

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