How to enable logging in a custom jar file

Topic : Ephesoft has a built in logging functionality. When setting System.out.println in the scripts, Ephesoft doesn’t have any control over printing these statements and will always print them to the logs which can cause the logs to grow large very quickly. By using the built in log4j logger, the scripts will only print to the logs based on the logging level specified in the log4j.xml file. You will need to replace the messages to match your specific logging alerts.

Applicable Ephesoft versions:

All Versions

 

Instructions:

  1. When creating your custom script, it is advisable to use the sample below for creating logs for the script to print to the stdout and dcma-all log files.
public Object execute(Document document, String methodName, String docIdentifier) {
Exception exception = null;
try {
LOGGER.info("************* Inside ExportScript scripts.");

LOGGER.info("************* Start execution of the ExportScript scripts.");

if (null == document) {
LOGGER.error("Input document is null.");
return null;
}
LOGGER.info("************* End execution of the ScriptExport scripts.");
} catch (Exception e) {
LOGGER.error("************* Error occurred in scripts." + e.getMessage());
exception = e;
}
return null;
}

 

| Documentation Main Page | How To Articles | Downloads and Updates |

Was this article helpful to you?

J.D. Abbey

Comments are closed.