Search in sources :

Example 11 with AcsJIllegalArgumentEx

use of alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx in project ACS by ACS-Community.

the class AcsContainer method set_logLevels.

/**
	 * Sets log levels for a particular named logger. If levels.useDefault is
	 * true, then the logger will be reset to using default levels; otherwise it
	 * will use the supplied local and remote levels.
	 */
public void set_logLevels(String logger_name, LogLevels levels) throws LoggerDoesNotExistEx, IllegalLogLevelsEx {
    tryToWaitForContainerStart();
    if (levels.useDefault) {
        logConfig.clearNamedLoggerConfig(logger_name);
    } else {
        try {
            UnnamedLogger config = AcsLogLevelDefinition.createXsdLogLevelsFromIdl(levels);
            logConfig.setNamedLoggerConfig(logger_name, config);
        } catch (AcsJIllegalArgumentEx ex) {
            //throw ex.toIllegalArgumentEx();
            IllegalLogLevelsEx ille = new IllegalLogLevelsEx(ex.getErrorDesc());
            throw ille;
        }
    }
}
Also used : IllegalLogLevelsEx(alma.Logging.IllegalLogLevelsEx) UnnamedLogger(alma.maci.loggingconfig.UnnamedLogger) LockableUnnamedLogger(alma.acs.logging.config.LogConfig.LockableUnnamedLogger) AcsJIllegalArgumentEx(alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx)

Example 12 with AcsJIllegalArgumentEx

use of alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx in project ACS by ACS-Community.

the class LaserComponent method set_default_logLevels.

/**
	 * Sets the log levels of the default logging configuration. These levels
	 * are used by all loggers that have not been configured individually.
	 */
public void set_default_logLevels(LogLevels levels) throws IllegalLogLevelsEx {
    try {
        logConfig.setDefaultMinLogLevel(AcsLogLevelDefinition.fromInteger(levels.minLogLevel));
        logConfig.setDefaultMinLogLevelLocal(AcsLogLevelDefinition.fromInteger(levels.minLogLevelLocal));
    } catch (AcsJIllegalArgumentEx ex) {
        //throw ex.toIllegalArgumentEx();
        IllegalLogLevelsEx ille = new IllegalLogLevelsEx(ex.getErrorDesc());
        throw ille;
    }
}
Also used : IllegalLogLevelsEx(alma.Logging.IllegalLogLevelsEx) AcsJIllegalArgumentEx(alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx)

Example 13 with AcsJIllegalArgumentEx

use of alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx in project ACS by ACS-Community.

the class HibernateWDALImpl method set_default_logLevels.

/**
	 * Sets the log levels of the default logging configuration. These levels
	 * are used by all loggers that have not been configured individually.
	 */
public void set_default_logLevels(LogLevels levels) throws IllegalLogLevelsEx {
    try {
        logConfig.setDefaultMinLogLevel(AcsLogLevelDefinition.fromInteger(levels.minLogLevel));
        logConfig.setDefaultMinLogLevelLocal(AcsLogLevelDefinition.fromInteger(levels.minLogLevelLocal));
    } catch (AcsJIllegalArgumentEx ex) {
        //throw ex.toIllegalArgumentEx();
        IllegalLogLevelsEx ille = new IllegalLogLevelsEx(ex.getErrorDesc());
        throw ille;
    }
}
Also used : IllegalLogLevelsEx(alma.Logging.IllegalLogLevelsEx) AcsJIllegalArgumentEx(alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx)

Example 14 with AcsJIllegalArgumentEx

use of alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx in project ACS by ACS-Community.

the class AcsContainer method ping.

/**
	 * Replies with <code>true</code> so that Manager sees that this container is alive.
	 * <p>
	 * Prints a message to System.out, so that it's visible on the local console that the container is doing ok. Does
	 * not log anything, because a failure to reply would show up remotely anyway.
	 * <p>
	 * No message is printed if the container log level is above INFO, see http://jira.alma.cl/browse/COMP-1736.
	 * 
	 * @see si.ijs.maci.ClientOperations#ping()
	 */
public boolean ping() {
    // we cannot use m_logger.isLoggable because only the stdout log level should be considered,
    // and it would be even worse a hack to go from the logger to its stdout handler to ask for the level there.
    AcsLogLevelDefinition stdoutLevel;
    try {
        stdoutLevel = AcsLogLevelDefinition.fromXsdLogLevel(logConfig.getNamedLoggerConfig(m_containerName).getMinLogLevelLocal());
    } catch (AcsJIllegalArgumentEx ex) {
        stdoutLevel = AcsLogLevelDefinition.DEBUG;
        ex.printStackTrace();
    }
    if (stdoutLevel.compareTo(AcsLogLevelDefinition.DEBUG) <= 0) {
        Runtime rt = Runtime.getRuntime();
        long totalMemKB = rt.totalMemory() / 1024;
        long usedMemKB = totalMemKB - rt.freeMemory() / 1024;
        String memStatus = "Memory usage " + usedMemKB + " of " + totalMemKB + " kB ";
        long maxMem = rt.maxMemory();
        if (maxMem < Long.MAX_VALUE) {
            long maxMemKB = maxMem / 1024;
            memStatus += "(= " + (usedMemKB * 1000 / maxMemKB) / 10.0 + "% of JVM growth limit " + maxMemKB + " kB) ";
        }
        String timestamp = IsoDateFormat.formatCurrentDate();
        System.out.println(timestamp + " [" + m_containerName + "] ping received, container alive. " + memStatus);
    }
    return true;
}
Also used : AcsLogLevelDefinition(alma.acs.logging.level.AcsLogLevelDefinition) AcsJIllegalArgumentEx(alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx)

Example 15 with AcsJIllegalArgumentEx

use of alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx in project ACS by ACS-Community.

the class NCSubscriber method createConnectionAction.

protected void createConnectionAction(EventDispatcher evtDispatcher, ErrorReporter errRep, SCInstance scInstance, Collection<TriggerEvent> derivedEvents) throws AcsJStateMachineActionEx {
    super.createConnectionAction(evtDispatcher, errRep, scInstance, derivedEvents);
    try {
        // Register callback for subscribed events
        if (corbaRef == null) {
            corbaObj = new OSPushConsumerPOATie(NCSubscriber.this);
            corbaRef = OSPushConsumerHelper.narrow(helper.getContainerServices().activateOffShoot(corbaObj));
        }
        // Register callback for reconnection requests
        channelReconnectionCallback = new AcsNcReconnectionCallback(NCSubscriber.this, logger);
        // if the factory is null, the reconnection callback is not registered
        channelReconnectionCallback.registerForReconnect(services, helper.getNotifyFactory());
        proxySupplier.connect_structured_push_consumer(org.omg.CosNotifyComm.StructuredPushConsumerHelper.narrow(corbaRef));
    } catch (AcsJContainerServicesEx e) {
        LOG_NC_SubscriptionConnect_FAIL.log(logger, channelName, getNotificationFactoryName());
        throw new AcsJStateMachineActionEx(e);
    } catch (org.omg.CosEventChannelAdmin.AlreadyConnected e) {
        throw new AcsJStateMachineActionEx(new AcsJIllegalStateEventEx(e));
    } catch (org.omg.CosEventChannelAdmin.TypeError ex) {
        LOG_NC_SubscriptionConnect_FAIL.log(logger, channelName, getNotificationFactoryName());
        throw new AcsJStateMachineActionEx(ex);
    } catch (AcsJIllegalArgumentEx ex) {
        throw new AcsJStateMachineActionEx(ex);
    }
    // Create the thread responsible for checking the connection and reconnect
    createConCheckerThread();
    LOG_NC_SubscriptionConnect_OK.log(logger, channelName, getNotificationFactoryName());
}
Also used : AcsJIllegalStateEventEx(alma.ACSErrTypeCommon.wrappers.AcsJIllegalStateEventEx) OSPushConsumerPOATie(alma.acsnc.OSPushConsumerPOATie) AcsJIllegalArgumentEx(alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx) AcsJStateMachineActionEx(alma.ACSErrTypeCommon.wrappers.AcsJStateMachineActionEx) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx)

Aggregations

AcsJIllegalArgumentEx (alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx)21 IllegalLogLevelsEx (alma.Logging.IllegalLogLevelsEx)12 UnnamedLogger (alma.maci.loggingconfig.UnnamedLogger)6 AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)3 AcsJException (alma.acs.exceptions.AcsJException)2 LogConfig (alma.acs.logging.config.LogConfig)2 ReconnectionCallback (NotifyExt.ReconnectionCallback)1 ReconnectionRegistry (NotifyExt.ReconnectionRegistry)1 AcsJCORBAProblemEx (alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)1 AcsJGenericErrorEx (alma.ACSErrTypeCommon.wrappers.AcsJGenericErrorEx)1 AcsJIllegalStateEventEx (alma.ACSErrTypeCommon.wrappers.AcsJIllegalStateEventEx)1 AcsJStateMachineActionEx (alma.ACSErrTypeCommon.wrappers.AcsJStateMachineActionEx)1 LogLevels (alma.Logging.LoggingConfigurablePackage.LogLevels)1 ComponentLifecycleException (alma.acs.component.ComponentLifecycleException)1 AcsLogLevel (alma.acs.logging.AcsLogLevel)1 LockableUnnamedLogger (alma.acs.logging.config.LogConfig.LockableUnnamedLogger)1 AcsLogLevelDefinition (alma.acs.logging.level.AcsLogLevelDefinition)1 OSPushConsumerPOATie (alma.acsnc.OSPushConsumerPOATie)1 LogTypeHelper (com.cosylab.logging.engine.log.LogTypeHelper)1 Date (java.util.Date)1