Search in sources :

Example 1 with LoggerDoesNotExistEx

use of alma.Logging.LoggerDoesNotExistEx in project ACS by ACS-Community.

the class LogLevelSelectorPanel method loggersLbl.

/**
	 * Gets the loggers and their levels.
	 * <p>
	 * This method makes remote calls and should not be called in the event thread! 
	 * 
	 * @return
	 * @throws AcsJCORBAProblemEx In case of ORB / network failure or if remote process is unresponsive or unreachable.
	 */
private LogLevelHelper[] loggersLbl() throws AcsJCORBAProblemEx {
    List<LogLevelHelper> ret = new ArrayList<LogLevelHelper>();
    try {
        // get the logger names
        final String[] logNames = logConf.get_logger_names();
        // get the log levels for each logger
        for (String logName : logNames) {
            try {
                LogLevels logLevels = logConf.get_logLevels(logName);
                ret.add(new LogLevelHelper(logName, logLevels));
            } catch (LoggerDoesNotExistEx ex) {
                logger.warning("Failed to retrieve log levels info for logger '" + logName + "'. Will skip this logger.");
            }
        }
        return ret.toArray(new LogLevelHelper[0]);
    } catch (SystemException ex) {
        AcsJCORBAProblemEx ex2 = new AcsJCORBAProblemEx(ex);
        ex2.setInfo("Failed to retrieve logger names or levels.");
        throw ex2;
    }
}
Also used : AcsJCORBAProblemEx(alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx) SystemException(org.omg.CORBA.SystemException) ArrayList(java.util.ArrayList) LoggerDoesNotExistEx(alma.Logging.LoggerDoesNotExistEx) LogLevels(alma.Logging.LoggingConfigurablePackage.LogLevels)

Example 2 with LoggerDoesNotExistEx

use of alma.Logging.LoggerDoesNotExistEx in project ACS by ACS-Community.

the class AcsContainer method get_statistics_logger_configuration_byname.

/** 
     * Gets the names and status of statistics module of requested logger.
     * If the logger statistics module has never been configured yet, then it will provide "Undefined"
     * as elementName 
     * Throws LoggerDoesNotExistEx if a the logger is not found
     */
public LogStatsInformation get_statistics_logger_configuration_byname(String logger_name) throws alma.Logging.LoggerDoesNotExistEx {
    // Retrieve logger by logger name
    AcsLogger retrievedLogger = ClientLogManager.getAcsLogManager().getLoggerByName(logger_name);
    // Verification if logger does exist (!= null)
    if (retrievedLogger == null) {
        LoggerDoesNotExistEx inexistantLoggerEx = new LoggerDoesNotExistEx(logger_name);
        throw inexistantLoggerEx;
    }
    // Store logger statistics configuration
    LogStatsInformation statsInfo = new LogStatsInformation(retrievedLogger.stats.getStatisticsIdentification(), retrievedLogger.getName(), retrievedLogger.stats.getDisableStatistics(), retrievedLogger.stats.getStatisticsCalculationPeriod(), retrievedLogger.stats.getStatisticsGranularity());
    return statsInfo;
}
Also used : LoggerDoesNotExistEx(alma.Logging.LoggerDoesNotExistEx) LogStatsInformation(alma.Logging.ACSLogStatisticsPackage.LogStatsInformation) AcsLogger(alma.acs.logging.AcsLogger)

Example 3 with LoggerDoesNotExistEx

use of alma.Logging.LoggerDoesNotExistEx in project ACS by ACS-Community.

the class AcsContainer method set_statistics_logger_configuration_byname.

/**
     * Sets logger statistics configuration for a particular named logger.
     * Throws LoggerDoesNotExistEx if a the logger is not found 
     */
public void set_statistics_logger_configuration_byname(String logger_name, LogStatsInformation statsInformation) throws alma.Logging.LoggerDoesNotExistEx {
    // Retrieve logger by logger name
    AcsLogger retrievedLogger = ClientLogManager.getAcsLogManager().getLoggerByName(logger_name);
    // Verification if logger does exist (!= null)
    if (retrievedLogger == null) {
        LoggerDoesNotExistEx inexistantLoggerEx = new LoggerDoesNotExistEx(logger_name);
        throw inexistantLoggerEx;
    }
    // Configure logger
    retrievedLogger.stats.configureStatistics(statsInformation.statsId, statsInformation.statsStatus, statsInformation.statsPeriodConfiguration, statsInformation.statsGranularityConfiguration);
    return;
}
Also used : LoggerDoesNotExistEx(alma.Logging.LoggerDoesNotExistEx) AcsLogger(alma.acs.logging.AcsLogger)

Aggregations

LoggerDoesNotExistEx (alma.Logging.LoggerDoesNotExistEx)3 AcsLogger (alma.acs.logging.AcsLogger)2 AcsJCORBAProblemEx (alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)1 LogStatsInformation (alma.Logging.ACSLogStatisticsPackage.LogStatsInformation)1 LogLevels (alma.Logging.LoggingConfigurablePackage.LogLevels)1 ArrayList (java.util.ArrayList)1 SystemException (org.omg.CORBA.SystemException)1