Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Navigate to the "[JogetFolder]\apache-tomcat-8.5.23\webapps\jw\WEB-INF\classes\log4j.properties" configuration file and check out the use of R2 tag to see how EmailTool, UserNotificationAuditTrail, and ExportFormEmailTool are writing into email.log file.

 



 

Code Block
titlelog4j.properties
linenumberstrue
log4j.logger.org.joget.apps.app.lib.EmailTool=DEBUG, R2
log4j.logger.org.joget.apps.app.lib.UserNotificationAuditTrail=DEBUG, R2
log4j.logger.org.joget.plugin.enterprise.ExportFormEmailTool=DEBUG, R2

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-5p %d{dd MMM yyyy HH:mm:ss} %c %x - %m%n

# R is set to be DailyRollingFileAppender
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=${catalina.home}/logs/joget.log
log4j.appender.R.DatePattern='.'yyyyMMdd
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%-5p %d{dd MMM yyyy HH:mm:ss} %c %x - %m%n

# R2 is set to be DailyRollingFileAppender
log4j.appender.R2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R2.File=${catalina.home}/logs/email.log
log4j.appender.R2.DatePattern='.'yyyyMMdd
log4j.appender.R2.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.R2.layout.ConversionPattern=%-5p %d{dd MMM yyyy HH:mm:ss} %-50c - %m%throwable{0}%n
 


Identifying App Origin in Log Files

...

Code Block
languagejava
linenumberstrue
public Object execute(Map properties) {
	.
	.
	AppDefinition appDef = (AppDefinition) properties.get("appDef");
	.
	.
	.
	String appInfoAndMessage = appDef.toString() + "- Something happened";
	LogUtil.error(EmailTool.class.getName(), ex, appInfoAndMessage);
	.
}

This way, we would be able to trace to the app that triggers and writes the line of message in the log file.

Info
titleWhere / How to obtain App Definition?

The object "appDef" is available in the following type of plugins.

  • Form Post Submission Processing Tool
  • Process Tool

In other plugin types, we can try to obtain the App Definition object by using the following codes.

Code Block
linenumberstrue
import org.joget.apps.app.service.AppUtil;

AppDefinition appDef = AppUtil.getCurrentAppDefinition();


Large catalina.out File

We can consider to LogRotate the log files. Please see the following links:-

...