Search in sources :

Example 1 with LogEngineException

use of com.cosylab.logging.engine.LogEngineException 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 LogEngineException

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

the class ACSLogRetrieval method start.

/**
	 * Init the file and the parser
	 *
	 */
public void start() throws LogEngineException {
    try {
        parser = ACSLogParserFactory.getParser();
    } catch (Exception pce) {
        throw new LogEngineException("Error starting the ACSLogRetrieval", pce);
    }
    cache.start();
    thread = new Thread(this, "ACSLogRetrieval");
    thread.setDaemon(true);
    thread.start();
    timerThread = new Timer("ACSLogretrieval.RateUpdater", true);
    timerThread.schedule(new RateUpdater(), 1000, 1000);
}
Also used : LogEngineException(com.cosylab.logging.engine.LogEngineException) Timer(java.util.Timer) LogEngineException(com.cosylab.logging.engine.LogEngineException)

Example 3 with LogEngineException

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

the class CacheUtils method fromCacheString.

/**
	 * Build a log out of its string representation
	 * 
	 * @param str The string representing a log
	 * @return The log
	 */
public static synchronized ILogEntry fromCacheString(String str) throws LogEngineException {
    String[] strs = str.split(SEPARATOR);
    long millis = 0;
    try {
        synchronized (dateFormat) {
            millis = dateFormat.parse(strs[0]).getTime();
        }
    } catch (ParseException e) {
        System.err.println("Error parsing the date: " + strs[0]);
        throw new LogEngineException(e);
    }
    Integer entrytype = new Integer(strs[1]);
    String srcObject = null;
    if (strs.length > 2) {
        srcObject = strs[2];
    }
    String fileNM = null;
    if (strs.length > 3) {
        fileNM = strs[3];
    }
    Integer line = null;
    if (strs.length > 4 && strs[4].length() != 0) {
        line = new Integer(strs[4]);
    }
    String routine = null;
    if (strs.length > 5) {
        routine = strs[5];
    }
    String host = null;
    if (strs.length > 6) {
        host = strs[6];
    }
    String process = null;
    if (strs.length > 7) {
        process = strs[7];
    }
    String context = null;
    if (strs.length > 8) {
        context = strs[8];
    }
    String thread = null;
    if (strs.length > 9) {
        thread = strs[9];
    }
    String logid = null;
    if (strs.length > 10) {
        logid = strs[10];
    }
    Integer priority = null;
    if (strs.length > 11 && strs[11].length() > 0) {
        priority = new Integer(strs[11]);
    }
    String uri = null;
    if (strs.length > 12) {
        uri = strs[12];
    }
    String stackid = null;
    if (strs.length > 13) {
        stackid = strs[13];
    }
    Integer stacklevel = null;
    if (strs.length > 14 && strs[14].length() > 0) {
        Integer.parseInt(strs[14]);
    }
    String logmessage = null;
    if (strs.length > 15) {
        logmessage = strs[15];
    }
    String audience = null;
    if (strs.length > 16) {
        audience = strs[16];
    }
    String array = null;
    if (strs.length > 17) {
        array = strs[17];
    }
    String antenna = null;
    if (strs.length > 18) {
        antenna = strs[18];
    }
    Vector<ILogEntry.AdditionalData> addDatas = null;
    if (strs.length > LogField.values().length) {
        addDatas = new Vector<ILogEntry.AdditionalData>();
        for (int t = LogField.values().length; t < strs.length; t += 2) {
            addDatas.add(new AdditionalData(strs[t], strs[t + 1]));
        }
    }
    return new LogEntry(millis, entrytype, fileNM, line, routine, host, process, context, thread, logid, priority, uri, stackid, stacklevel, logmessage, srcObject, audience, array, antenna, addDatas);
}
Also used : AdditionalData(com.cosylab.logging.engine.log.ILogEntry.AdditionalData) LogEngineException(com.cosylab.logging.engine.LogEngineException) ParseException(java.text.ParseException) ILogEntry(com.cosylab.logging.engine.log.ILogEntry) LogEntry(com.cosylab.logging.engine.log.LogEntry)

Aggregations

LogEngineException (com.cosylab.logging.engine.LogEngineException)3 LCEngine (com.cosylab.logging.engine.ACS.LCEngine)1 ILogEntry (com.cosylab.logging.engine.log.ILogEntry)1 AdditionalData (com.cosylab.logging.engine.log.ILogEntry.AdditionalData)1 LogEntry (com.cosylab.logging.engine.log.LogEntry)1 ParseException (java.text.ParseException)1 Timer (java.util.Timer)1