13
March
2015
How to enable log4j as the logging provider for Docmosis
Docmosis is configured by default to use an internal logging provider. However, many production systems use Java Util Logging (juli) or Log4j as the primary logging mechanism.
This article outlines the steps to enable log4j as the logging provider for Docmosis.
Enabling logging for Docmosis may assist you when investigating licensing or other runtime issues.
Also refer to the default docmosis properties file "docmosisdefault.properties" packaged in the docmosis library file (docmosis.jar) for a full set of properties.
$ jar tvf docmosis.jar | grep docmosisdefault 22746 Tue Jan 20 12:05:34 WST 2015 docmosis/defaults/docmosisdefault.properties
Configuration
1 Create or update log4j properties with docmosis logging categories
1.1 Sample log4j.properties snippet
log4j.debug=true log4j.rootLogger=DEBUG, CONSOLE log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.layout=\ org.apache.log4j.ExtendedPatternLayout log4j.appender.CONSOLE.layout.ConversionPattern=\ %d{ISO8601} %-5p [%t][%c{1}:%L] %m%n # Docmosis log4j.logger.com.docmosis=INFO, CONSOLE
1.2 Sample log4j.xml snippet
<?xml version="1.0"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true"> <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.EnhancedPatternLayout"> <param name="ConversionPattern" value="%d{ISO8601} %-5p [%t][%c{1}:%L] %m%n" /> </layout> </appender> <category name="com.docmosis"> <priority value="INFO" /> </category> <root> <priority value="INFO" /> <appender-ref ref="CONSOLE" /> </root> </log4j:configuration>
2 Deploy log4j library file "log4j.jar" to application class path
% cp log4j.jar /opt/myapp/lib
3 Deploy log4j configuration file "log4j.properties" or "log4j.xml" to application class path
3.1 Sample deploy "log4j.properties" configuration file
% cp log4j.properties /opt/myapp/lib
3.2 Sample deploy "log4j.xml" configuration file
% cp log4j.xml /opt/myapp/lib
Usage
1 Start Java desktop or web application
2 Review console (aka. terminal) or log file(s) for docmosis log entries
07:50:56,406 INFO [SystemManager:173] Docmosis version [3.3.0_5264] initialising 07:50:56,410 INFO [SystemManager:173] Using properties for key. 07:50:56,415 INFO [F:173] License key override in place 07:50:56,421 INFO [F:173] License details Docmosis - expires==15 Mar 2015 Docmosis - Maximum parallel converters=3 Docmosis - Performance Rating=high Docmosis - Free Trial License Docmosis - Updates valid until:Wed Jan 27 00:00:00 GMT 2016 License details Docmosis - expires==15 Mar 2015 Docmosis - Maximum parallel converters=3 Docmosis - Performance Rating=high Docmosis - Free Trial License Docmosis - Updates valid until:Wed Jan 27 00:00:00 GMT 2016 07:50:58,445 INFO [LocalOpenOfficeConverter:173] DocX conversion not enabled 07:50:58,446 INFO [ConverterPool:173] Default converter group:embeddedConverters 07:50:58,447 INFO [SystemManager:173] Using properties for key. 07:50:58,447 INFO [F:173] License key override in place 07:50:58,448 INFO [F:173] License details Docmosis - expires==15 Mar 2015 Docmosis - Maximum parallel converters=3 Docmosis - Performance Rating=high Docmosis - Free Trial License Docmosis - Updates valid until:Wed Jan 27 00:00:00 GMT 2016 License details Docmosis - expires==15 Mar 2015 Docmosis - Maximum parallel converters=3 Docmosis - Performance Rating=high Docmosis - Free Trial License Docmosis - Updates valid until:Wed Jan 27 00:00:00 GMT 2016 07:50:58,458 INFO [TemplateStoreFactory:173] Template store location:/tmp/docmosisstore 07:50:58,470 INFO [SystemManager:173] Docmosis initialised in 2066 ms
References
Short introduction to log4j: Ceki Gülcü, March 2002