Search in sources :

Example 1 with LogReceiver

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

the class ComponentClientTestCase method getLogReceiver.

/**
	 * Gets a {@link LogReceiver} which can be used 
	 * to verify log messages from both local and remote processes.
	 * The returned <code>LogReceiver</code> is already initialized.
	 * If initialization fails, an exception is thrown.
	 * <p>
	 * To receive logs from the log service, use either 
	 * {@link LogReceiver#getLogQueue()} or {@link LogReceiver#startCaptureLogs(java.io.PrintWriter)}.
	 *  
	 * @throws AcsJContainerServicesEx if the LogReceiver fails to initialize within 20 seconds.
	 */
protected LogReceiver getLogReceiver() throws AcsJContainerServicesEx {
    if (logReceiver == null) {
        boolean initOk = false;
        try {
            logReceiver = new LogReceiver();
            // logReceiver.setVerbose(true);
            initOk = logReceiver.initialize(acsCorba.getORB(), m_acsManagerProxy.getManager(), 20);
        } catch (Throwable thr) {
            AcsJContainerServicesEx ex = new AcsJContainerServicesEx(thr);
            ex.setContextInfo("Failed to obtain an initialized LogReceiver.");
            throw ex;
        }
        if (!initOk) {
            AcsJContainerServicesEx ex = new AcsJContainerServicesEx();
            ex.setContextInfo("LogReceiver failed to initialize within 20 seconds.");
            throw ex;
        }
    }
    return logReceiver;
}
Also used : AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx) LogReceiver(alma.acs.logging.engine.LogReceiver)

Aggregations

AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)1 LogReceiver (alma.acs.logging.engine.LogReceiver)1