Search in sources :

Example 11 with AcsLogger

use of alma.acs.logging.AcsLogger in project ACS by ACS-Community.

the class ComponentClientTestCase method setUp.

/**
	 * Starts CORBA in the client process and connects to the manager and logger.
     * <p>
     * <b>Subclasses that override this method must call <code>super.setUp()</code>,
     * likely before any other code in that method.</b>
	 *  
	 * @see junit.framework.TestCase#setUp()
	 */
protected void setUp() throws Exception {
    m_logger = ClientLogManager.getAcsLogManager().getLoggerForApplication(getFullName(), true);
    m_logger.info("-------------------------------");
    m_logger.info("ComponentClientTestCase#setUp()");
    POA rootPOA = null;
    try {
        acsCorba = new AcsCorba(m_logger);
        rootPOA = acsCorba.initCorbaForClient(false);
        connectToManager();
        DAL cdb = DALHelper.narrow(m_acsManagerProxy.get_service("CDB", false));
        m_threadFactory = new CleaningDaemonThreadFactory(m_namePrefix, m_logger);
        m_containerServices = new ContainerServicesImpl(m_acsManagerProxy, cdb, rootPOA, acsCorba, m_logger, m_acsManagerProxy.getManagerHandle(), this.getClass().getName(), null, m_threadFactory) {

            public AcsLogger getLogger() {
                return m_logger;
            }
        };
        managerClientImpl.setContainerServices(m_containerServices);
        initRemoteLogging();
        ACSAlarmSystemInterfaceFactory.init(m_containerServices);
    } catch (Exception ex1) {
        m_logger.log(Level.SEVERE, "failed to initialize the ORB, or connect to the ACS Manager, " + "or to set up the container services.", ex1);
        if (acsCorba != null) {
            try {
                acsCorba.shutdownORB(true, false);
                acsCorba.doneCorba();
            } catch (Exception ex2) {
                // to JUnit we want to forward the original exception ex1, 
                // not any other exception from cleaning up the orb 
                // which we would not have done without the first exception.
                // Thus we simply print ex2 but let ex1 fly
                ex2.printStackTrace();
            }
        }
        throw ex1;
    }
}
Also used : ContainerServicesImpl(alma.acs.container.ContainerServicesImpl) AcsCorba(alma.acs.container.corba.AcsCorba) POA(org.omg.PortableServer.POA) CleaningDaemonThreadFactory(alma.acs.container.CleaningDaemonThreadFactory) DAL(com.cosylab.CDB.DAL) AcsLogger(alma.acs.logging.AcsLogger)

Example 12 with AcsLogger

use of alma.acs.logging.AcsLogger in project ACS by ACS-Community.

the class MiscUtils method getPackageLogger.

/**
	 * Returns a logger for the specified class, based on
	 * the requester's package name, e.g. "alma.acs.commandcenter.engine",
	 * thus the logger will be shared by all classes in that package.
	 *  
	 * @param requester class which needs a package-wide logger
	 * @return a logger
	 */
public static AcsLogger getPackageLogger(Class<?> requester) {
    String pkg = requester.getPackage().getName();
    AcsLogger ret = ClientLogManager.getAcsLogManager().getLoggerForApplication(pkg, false);
    return ret;
}
Also used : AcsLogger(alma.acs.logging.AcsLogger)

Example 13 with AcsLogger

use of alma.acs.logging.AcsLogger in project ACS by ACS-Community.

the class HibernateLoggerHelper method getLogger.

/**
	 * @see ACSLoggerFactory#getLogger(String)
	 */
public Logger getLogger(String name) {
    if (name.equals("org.hibernate.SQL") || // there is an inconsistency in hibernate's parameter logging, where first "org.hibernate.type" is checked in NullableType#IS_VALUE_TRACING_ENABLED, but later loggers "org.hibernate.type.XYZ" get used.
    name.startsWith("org.hibernate.type") || name.equals("org.hibernate.jdbc.util.SQLStatementLogger")) {
        if (jdkAdapterSql == null) {
            AcsLogger acsLoggerDelegateSql = ClientLogManager.getAcsLogManager().getLoggerForCorba(HIBERNATE_SQL_LOGGER_NAME_PREFIX, true);
            acsLoggerDelegateSql.addLoggerClass(JDK14LoggerAdapter.class);
            jdkAdapterSql = new JDK14LoggerAdapter(acsLoggerDelegateSql);
        }
        return jdkAdapterSql;
    } else {
        if (jdkAdapterDefault == null) {
            AcsLogger acsLoggerDelegateDefault = ClientLogManager.getAcsLogManager().getLoggerForCorba(HIBERNATE_LOGGER_NAME_PREFIX, true);
            acsLoggerDelegateDefault.addLoggerClass(JDK14LoggerAdapter.class);
            jdkAdapterDefault = new JDK14LoggerAdapter(acsLoggerDelegateDefault);
        }
        return jdkAdapterDefault;
    }
}
Also used : AcsLogger(alma.acs.logging.AcsLogger)

Example 14 with AcsLogger

use of alma.acs.logging.AcsLogger in project ACS by ACS-Community.

the class TypelessPropertyImpl method publish_now.

/**
	 * @see alma.ACS.TypelessPropertyOperations#publish_now()
	 */
public void publish_now() {
    AcsLogger logger = parentComponent.getComponentContainerServices().getLogger();
    logger.warning("IDL method publish_now not yet implemented");
}
Also used : AcsLogger(alma.acs.logging.AcsLogger)

Example 15 with AcsLogger

use of alma.acs.logging.AcsLogger 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)

Aggregations

AcsLogger (alma.acs.logging.AcsLogger)20 LogConfig (alma.acs.logging.config.LogConfig)3 LogStatsInformation (alma.Logging.ACSLogStatisticsPackage.LogStatsInformation)2 LoggerDoesNotExistEx (alma.Logging.LoggerDoesNotExistEx)2 CleaningDaemonThreadFactory (alma.acs.container.CleaningDaemonThreadFactory)2 ContainerServicesImpl (alma.acs.container.ContainerServicesImpl)2 DAL (com.cosylab.CDB.DAL)2 ThreadFactory (java.util.concurrent.ThreadFactory)2 Test (org.junit.Test)2 POA (org.omg.PortableServer.POA)2 AcsJContainerEx (alma.JavaContainerError.wrappers.AcsJContainerEx)1 AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)1 AcsManagerProxy (alma.acs.container.AcsManagerProxy)1 AcsCorba (alma.acs.container.corba.AcsCorba)1 AcsJException (alma.acs.exceptions.AcsJException)1 ClientLogManager (alma.acs.logging.ClientLogManager)1 StdOutConsoleHandler (alma.acs.logging.StdOutConsoleHandler)1 JacORBFilter (alma.acs.logging.adapters.JacORBFilter)1 LogConfigException (alma.acs.logging.config.LogConfigException)1 AcsORBProfilerImplBase (alma.acs.profiling.orb.AcsORBProfilerImplBase)1