Search in sources :

Example 6 with PaxLoggingEvent

use of org.ops4j.pax.logging.spi.PaxLoggingEvent in project cytoscape-impl by cytoscape.

the class QueueProcesser method run.

public void run() {
    while (true) {
        PaxLoggingEvent event = null;
        try {
            event = queue.take();
        } catch (InterruptedException e) {
            break;
        }
        processEvent(event);
    }
}
Also used : PaxLoggingEvent(org.ops4j.pax.logging.spi.PaxLoggingEvent)

Example 7 with PaxLoggingEvent

use of org.ops4j.pax.logging.spi.PaxLoggingEvent in project fabric8 by jboss-fuse.

the class LogQuery method getLogEventList.

public LogResults getLogEventList(int count, Predicate<PaxLoggingEvent> predicate) {
    LogResults answer = new LogResults();
    answer.setHost(getHostName());
    long from = Long.MAX_VALUE;
    long to = Long.MIN_VALUE;
    if (appender != null) {
        LruList events = appender.getEvents();
        if (events != null) {
            Iterable<PaxLoggingEvent> iterable = events.getElements();
            if (iterable != null) {
                int matched = 0;
                for (PaxLoggingEvent event : iterable) {
                    if (event != null) {
                        long timestamp = event.getTimeStamp();
                        if (timestamp > to) {
                            to = timestamp;
                        }
                        if (timestamp < from) {
                            from = timestamp;
                        }
                        if (predicate == null || predicate.matches(event)) {
                            answer.addEvent(Logs.newInstance(event));
                            matched += 1;
                            if (count > 0 && matched >= count) {
                                break;
                            }
                        }
                    }
                }
            }
        }
    } else {
        LOG.warn("No VmLogAppender available!");
    }
    answer.setFromTimestamp(from);
    answer.setToTimestamp(to);
    return answer;
}
Also used : PaxLoggingEvent(org.ops4j.pax.logging.spi.PaxLoggingEvent) LogResults(io.fabric8.insight.log.LogResults) LruList(org.apache.karaf.shell.log.LruList)

Aggregations

PaxLoggingEvent (org.ops4j.pax.logging.spi.PaxLoggingEvent)7 LogResults (io.fabric8.insight.log.LogResults)1 ArrayList (java.util.ArrayList)1 ExecutorService (java.util.concurrent.ExecutorService)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 LruList (org.apache.karaf.shell.log.LruList)1 CySwingApplication (org.cytoscape.application.swing.CySwingApplication)1 AbstractTaskFactory (org.cytoscape.work.AbstractTaskFactory)1 Task (org.cytoscape.work.Task)1 TaskIterator (org.cytoscape.work.TaskIterator)1 TaskManager (org.cytoscape.work.TaskManager)1 TaskMonitor (org.cytoscape.work.TaskMonitor)1