Package com.cisco.oss.foundation.logging.appender

Examples of com.cisco.oss.foundation.logging.appender.FoundationFileRollingAppender


  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(FondationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())) {
        rollOnStartup = Boolean.valueOf(FoundationLogger.log4jConfigProps.getProperty(FondationLoggerConstants.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(FondationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())) {
        rollOnStartup = Boolean.valueOf(FoundationLogger.log4jConfigProps.getProperty(FondationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString()));
      }

      timeSizeRollingAppender.setRollOnStartup(rollOnStartup);

      // refresh the appender
      timeSizeRollingAppender.activateOptions();

     
    //  timeSizeRollingAppender.setOriginalLayout();
    }
    if ( ! (appender instanceof org.apache.log4j.AsyncAppender))
View Full Code Here


  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))
View Full Code Here

TOP

Related Classes of com.cisco.oss.foundation.logging.appender.FoundationFileRollingAppender

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.