public void addAppenderEvent ( final Category cat , final Appender appender ) { updateDefaultLayout ( appender ) ; if ( appender instanceof FoundationFileRollingAppender ) { final FoundationFileRollingAppender timeSizeRollingAppender = ( FoundationFileRollingAppender ) appender ; // update the appender with default vales such as logging pattern, file size etc. //updateDefaultTimeAndSizeRollingAppender(timeSizeRollingAppender); // read teh proeprties and determine if archiving should be enabled. updateArchivingSupport ( timeSizeRollingAppender ) ; // by default add the rolling file listener to enable application // state. timeSizeRollingAppender . setFileRollEventListener ( FoundationRollEventListener . class . getName ( ) ) ; boolean rollOnStartup = true ; if ( FoundationLogger . log4jConfigProps != null && FoundationLogger . log4jConfigProps . containsKey ( FoundationLoggerConstants . Foundation_ROLL_ON_STARTUP . toString ( ) ) ) { rollOnStartup = Boolean . valueOf ( FoundationLogger . log4jConfigProps . getProperty ( FoundationLoggerConstants . Foundation_ROLL_ON_STARTUP . toString ( ) ) ) ; } timeSizeRollingAppender . setRollOnStartup ( rollOnStartup ) ; // refresh the appender timeSizeRollingAppender . activateOptions ( ) ; // timeSizeRollingAppender.setOriginalLayout(); //So application state will not make any problems } else if ( ! ( appender instanceof FoundationFileRollingAppender ) && ( appender instanceof TimeAndSizeRollingAppender ) ) { //TimeAndSizeRollingAppender final TimeAndSizeRollingAppender timeSizeRollingAppender = ( TimeAndSizeRollingAppender ) appender ; // update the appender with default vales such as logging pattern, file size etc. updateDefaultTimeAndSizeRollingAppender ( timeSizeRollingAppender ) ; // read teh proeprties and determine if archiving should be enabled. updateArchivingSupport ( timeSizeRollingAppender ) ; // by default add the rolling file listener to enable application // state. timeSizeRollingAppender . setFileRollEventListener ( FoundationRollEventListener . class . getName ( ) ) ; boolean rollOnStartup = true ; if ( FoundationLogger . log4jConfigProps != null && FoundationLogger . log4jConfigProps . containsKey ( FoundationLoggerConstants . Foundation_ROLL_ON_STARTUP . toString ( ) ) ) { rollOnStartup = Boolean . valueOf ( FoundationLogger . log4jConfigProps . getProperty ( FoundationLoggerConstants . Foundation_ROLL_ON_STARTUP . toString ( ) ) ) ; } timeSizeRollingAppender . setRollOnStartup ( rollOnStartup ) ; // refresh the appender timeSizeRollingAppender . activateOptions ( ) ; // timeSizeRollingAppender.setOriginalLayout(); } if ( ! ( appender instanceof org . apache . log4j . AsyncAppender ) ) initiateAsyncSupport ( appender ) ; }
In this method perform the actual override in runtime .