Search in sources :

Example 1 with LCEngine

use of com.cosylab.logging.engine.ACS.LCEngine in project ACS by ACS-Community.

the class LoggingClientText method initialize.

/**
 * Insert the method's description here.
 * Creation date: (11/2/2001 10:43:03 AM)
 */
private void initialize(String accessType) throws LogEngineException {
    rrct = new RemoteResponseCallbackText();
    lct = new LCEngine();
    lct.addLogConnectionListener(rrct);
    lct.addLogListener(rrct);
    lct.setAccessType("ACS");
    lct.connect();
    try {
        Thread.sleep(20000);
    } catch (Exception e) {
    }
    System.out.println("Attemping to destroy...");
    lct.disconnect();
}
Also used : LCEngine(com.cosylab.logging.engine.ACS.LCEngine) LogEngineException(com.cosylab.logging.engine.LogEngineException)

Example 2 with LCEngine

use of com.cosylab.logging.engine.ACS.LCEngine in project ACS by ACS-Community.

the class LogReceiver method initialize.

/**
     * Variant of {@link #initialize()} which takes an existing ORB and manager reference.
     * <p>
     * This method attempts to wait for successful initialization for up to <code>timeoutSeconds</code> seconds.
     * If initialization did not happen within this time, <code>false</code> is returned, otherwise true.
     * 
     * @param theORB  the fully functional ORB object to reuse, or <code>null</code> if an ORB should be created 
     * @param manager  reference to the acs manager, or <code>null</code> if this reference should be created
     * @param timeoutSeconds  timeout for awaiting the successful initialization. 
     * @return true if initialization was successful within at most <code>timeoutSeconds</code> seconds. 
     * @throws LogEngineException In case of error instantiating the {@link LCEngine}
     */
public boolean initialize(ORB theORB, Manager manager, int timeoutSeconds) throws LogEngineException {
    boolean ret = false;
    if (verbose) {
        System.out.println("Attempting to connect to Log channel...");
    }
    logDelayQueue = new DelayQueue<DelayedLogEntry>();
    statusReports = new ArrayList<String>();
    rrc = new MyRemoteResponseCallback(logDelayQueue, statusReports);
    rrc.setVerbose(verbose);
    rrc.setDelayMillis(sortingDelayMillis);
    lct = new LCEngine();
    lct.addLogConnectionListener(rrc);
    lct.addLogListener(rrc);
    lct.setAccessType("ACS");
    lct.connect(theORB, manager);
    try {
        ret = rrc.awaitConnection(timeoutSeconds, TimeUnit.SECONDS);
    } catch (InterruptedException ex) {
        ex.printStackTrace();
    }
    return ret;
}
Also used : LCEngine(com.cosylab.logging.engine.ACS.LCEngine)

Example 3 with LCEngine

use of com.cosylab.logging.engine.ACS.LCEngine in project ACS by ACS-Community.

the class EngineFilteringTest method setUp.

/**
	 * Setup the environment by creating the engine with a null set of filters.
	 * The engine is disconnected because some of the tests do not need the
	 * connection alive.
	 * 
	 * @see alma.acs.component.client.ComponentClientTestCase#setUp()
	 */
@Override
protected void setUp() throws Exception {
    super.setUp();
    receivedLogs = new Vector<ILogEntry>();
    assertNotNull(receivedLogs);
    receivedLogs.clear();
    xmlLogsCount = new AtomicInteger(0);
    xmlInfos = 0;
    assertNotNull(m_logger);
    AcsLogger acsLogger = m_logger;
    LogConfig config = new LogConfig();
    acsLogger.configureLogging(config);
    engine = new LCEngine();
    assertNotNull(engine);
    engine.addLogErrorListener(this);
    engine.addLogConnectionListener(this);
    engine.addLogListener(this);
    engine.addRawLogListener(this);
}
Also used : ILogEntry(com.cosylab.logging.engine.log.ILogEntry) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) LCEngine(com.cosylab.logging.engine.ACS.LCEngine) AcsLogger(alma.acs.logging.AcsLogger) LogConfig(alma.acs.logging.config.LogConfig)

Example 4 with LCEngine

use of com.cosylab.logging.engine.ACS.LCEngine in project ACS by ACS-Community.

the class XmlFileStoreLoggerImpl method connectToLoggingChannel.

/**
	 * 
	 * @param logFilePath
	 * @param fileMax
	 * @param fileSizeLimit
	 * @throws ComponentLifecycleException
	 */
private void connectToLoggingChannel(String logFilePath, int fileMax, int fileSizeLimit) throws ComponentLifecycleException {
    try {
        // connect to LoggingChannel
        QueueFileHandler queueFileHandler = new QueueFileHandler(cs, logFilePath, fileMax, fileSizeLimit, "log", "Logging");
        engine = new LCEngine(queueFileHandler);
        engine.connect(cs.getAdvancedContainerServices().getORB(), null);
        engine.enableAutoReconnection(true);
    } catch (Throwable e) {
        m_logger.severe("Could not initialize connection to logging channel.");
        cs.getAlarmSource().setAlarm("Logging", cs.getName(), 2, true);
        throw new ComponentLifecycleException(e);
    }
}
Also used : QueueFileHandler(alma.acs.xmlfilestore.common.QueueFileHandler) ComponentLifecycleException(alma.acs.component.ComponentLifecycleException) LCEngine(com.cosylab.logging.engine.ACS.LCEngine)

Example 5 with LCEngine

use of com.cosylab.logging.engine.ACS.LCEngine in project ACS by ACS-Community.

the class LoggingClient method getEngine.

/**
	 * Returns the LCEngine property value.
	 * @return com.cosylab.logging.LCEngine
	 */
public LCEngine getEngine() {
    if (engine == null) {
        try {
            engine = new LCEngine();
            engine.addLogConnectionListener(this);
            engine.addLogListener(this);
            engine.addLogErrorListener(this);
            engine.setDiscardLevel(LogTypeHelper.fromLogTypeDescription((String) toolBar.getDiscardLevelCB().getSelectedItem()));
            if (logFrame != null) {
                engine.addLogConnectionListener(logFrame);
            }
        } catch (java.lang.Throwable ivjExc) {
            handleException(ivjExc);
        }
    }
    return engine;
}
Also used : LCEngine(com.cosylab.logging.engine.ACS.LCEngine)

Aggregations

LCEngine (com.cosylab.logging.engine.ACS.LCEngine)5 ComponentLifecycleException (alma.acs.component.ComponentLifecycleException)1 AcsLogger (alma.acs.logging.AcsLogger)1 LogConfig (alma.acs.logging.config.LogConfig)1 QueueFileHandler (alma.acs.xmlfilestore.common.QueueFileHandler)1 LogEngineException (com.cosylab.logging.engine.LogEngineException)1 ILogEntry (com.cosylab.logging.engine.log.ILogEntry)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1