...
Java logging and Log4j Integration
Include Page
.log
files at the same time using two I/O streams. The latter will lead to log files getting corrupted. Furthermore, on Windows operating systems as file writing is a slower operation, the chance of log file corruption may be higher.Therefore, as a result of this integration in Carbon 4.2.0, only the Log4j appenders will write to the log files. If the Java Logging Handlers have logs, these logs will be delegated to the log events of the corresponding Log4j appenders. A Pub/Sub registry pattern implementation has been used in the latter mentioned scenario to plug the handlers and appenders.
Default Log4j in the log4j.properties
file appenders, such as ConsoleAppender
and DailyRollingAppender
have been extended to carryout this implementation as shown below.
Old Property | New Property |
---|---|
org.apache.log4j.ConsoleAppender | org.wso2.carbon.logging.appenders.CarbonConsoleAppender |
org.apache.log4j.DailyRollingFileAppender | org.wso2.carbon.logging.appenders.CarbonDailyRollingFileAppender |
Remedies for log growth
Log growth can be managed by the following configurations in the <PRODUCT_HOME>/repository/conf/
log4j.properties
file.
...