KB-1120 How to create custom log files in Appian

This article outlines the process to create a custom log file in Appian. The custom file can have logs from specific Java classes which may or may not be included in the application server logs. This will help if troubleshooting a specific issues or logs containing sensitive data is required.

This can be achieved by using custom appenders in log4j that control specific classes to generate logs. These appenders can be used to write logs to a new file and can also remove them from application server logs. Please follow the steps as described below:

  1. On the application server machine, open /ear/suite.ear/resources/appian_log4j.properties.
  2. Add the following lines to the end of the file:
    ########### Custom Appenders 
    log4j.logger.=DEBUG, CUSTOM_LOGGING
    log4j.additivity.=false
    ###### Custom Logging file appender log4j.appender.CUSTOM_LOGGING=org.apache.log4j.RollingFileAppender log4j.appender.CUSTOM_LOGGING.layout=org.apache.log4j.PatternLayout log4j.appender.CUSTOM_LOGGING.layout.ConversionPattern=%d [%t] %-5p %c - %m%n log4j.appender.CUSTOM_LOGGING.File=${AE_LOGS}/.log log4j.appender.CUSTOM_LOGGING.MaxFileSize=10MB log4j.appender.CUSTOM_LOGGING.MaxBackupIndex=1000 log4j.appender.CUSTOM_LOGGING.encoding=UTF-8
    Note: In order to include the above logs in the default application server logs, change the value of log4j.additivity.<JAVA_CLASS_NAME> to true.
  3. Save the changes, and wait for 2-3 minutes for the changes to be picked up by the application server.

To disable these logs, update the log4j.logger.<JAVA_CLASS_NAME> line to OFF, CUSTOM_LOGGING:

log4j.logger.<JAVA_CLASS_NAME> line to OFF, CUSTOM_LOGGING

Wait for 2-3 minutes for the changes to applied again.

Note: Completely removing the lines in order to disable the logging is not recommended.

Affected Versions

This article applies to all versions of Appian.

Last Reviewed: February 2017

Related
Recommended