public class JiraAppender extends AppenderSkeleton {
protected void append(LoggingEvent loggingEvent) {
if (loggingEvent.getLevel().toString().equalsIgnoreCase("INFO")) {
System.out.println("INFO invoked!");
}
}
public boolean requiresLayout() {
return false;
}
public void close() {
}
}
2) Modify the log4j.properties file located at
/carbon-platform-2.0.1/carbondistribution/carbon-home/lib/log4j.properties
a) Add the following entry to the log4j.properties file.
# CARBON_JIRA is set to be a MemoryAppender using a PatternLayout.
log4j.appender.CARBON_JIRA=org.wso2.carbon.utils.JiraAppender
log4j.appender.CARBON_JIRA.layout=org.apache.log4j.PatternLayout
log4j.appender.CARBON_JIRA.layout.ConversionPattern=[%d] %5p - %x %m%n
log4j.appender.CARBON_JIRA.threshold=DEBUG
b) Update the log4j.properties file with the following entry.
log4j.rootLogger=INFO, CARBON_CONSOLE, CARBON_LOGFILE, CARBON_MEMORY, CARBON_SYS_LOG, CARBON_JIRA
log4j.logger.org.apache.axis2.wsdl.codegen.writer.PrettyPrinter=ERROR, CARBON_LOGFILE, CARBON_MEMORY, CARBON_JIRA
log4j.logger.org.apache.axis2.clustering=DEBUG, CARBON_CONSOLE, CARBON_LOGFILE, CARBON_JIRA
log4j.logger.org.apache=INFO, CARBON_LOGFILE, CARBON_MEMORY, CARBON_JIRA
log4j.logger.org.apache.catalina=WARN
log4j.logger.org.apache.tiles=WARN
log4j.logger.org.apache.coyote=WARN
log4j.logger.org.hibernate=ERROR, CARBON_LOGFILE, CARBON_MEMORY, CARBON_JIRA
log4j.logger.org.mortbay=ERROR, CARBON_LOGFILE, CARBON_MEMORY, CARBON_JIRA
log4j.logger.net.sf=ERROR
log4j.logger.org.wso2=INFO
log4j.logger.org.apache.axis2.enterprise=FATAL, CARBON_LOGFILE, CARBON_MEMORY, CARBON_JIRA
log4j.logger.de.hunsicker.jalopy.io=FATAL, CARBON_LOGFILE, CARBON_MEMORY, CARBON_JIRA
No comments:
Post a Comment