Package io.fabric8.insight.log

Examples of io.fabric8.insight.log.LogResults


                        break;
                    }
                }
            }
        }
        LogResults results = new LogResults();
        results.setEvents(list);
        if (from < Long.MAX_VALUE) {
            results.setFromTimestamp(from);
        }
        if (to > Long.MIN_VALUE) {
            results.setToTimestamp(to);
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("Requested " + maxCount + " logging items. returning "
                    + results.getEvents().size() + " event(s) from a possible " + getEvents().size());

        }
        return results;
    }
View Full Code Here


        return MavenCoordinates.getMavenCoordinates(bundleId);
    }

    @Override
    public LogResults getLogResults(int count) throws IOException {
        LogResults events = getLogEventList(count, null);
        return events;
    }
View Full Code Here

        }
        return getLogEventList(count, predicate);
    }

    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;
        VmLogAppender a = getAppender();
        if (a != null) {
            LruList events = a.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;
    }
View Full Code Here

        } catch (Throwable e) {
            testLog.error("Expected exception for testing: " + e, e);
        }

        // now lets find the error
        LogResults results = logQuery.allLogResults();
        List<LogEvent> logEvents = Log4jTest.assertNotEmpty(results);
        LogEvent log = logEvents.get(0);
        assertNotNull("Should have a log event", log);

        List<String> list = Arrays.asList(log.getException());
View Full Code Here

        filter.setAfterTimestamp(time);
        return queryLogResults(filter);
    }

    public String getLogEvents(int maxCount) throws IOException {
        LogResults results = getLogResults(maxCount);
        return toJSON(results);
    }
View Full Code Here

        return toJSON(results);
    }

    @Override
    public String filterLogEvents(String jsonFilter) throws IOException {
        LogResults results = jsonQueryLogResults(jsonFilter);
        return toJSON(results);
    }
View Full Code Here

        assertLogQuery(logQuery);
    }

    protected void assertLogQuery(LogQuerySupportMBean mBean) throws Exception {
        LogResults results = mBean.allLogResults();
        List<LogEvent> logEvents = assertNotEmpty(results);

        assertMatches(logEvents, messagePredicate("INFO", info1));
        assertMatches(logEvents, messagePredicate("INFO", info2));
        assertMatches(logEvents, messagePredicate("ERROR", error1));
View Full Code Here

            Fabric8JMXPlugin.getLogger().warning(ex);
          return null;
        }
        final Set<ObjectName> queryNames = connection.queryNames(insightObjectName, null);
        for (ObjectName insightObjectName : queryNames) {
          LogQuerySupportMBean logQuerySupportMBean = MBeanServerInvocationHandler.newProxyInstance(connection, insightObjectName, LogQuerySupportMBean.class, true);
          return callback.doWithLogQuerySupportMBean(logQuerySupportMBean);
        }
        return null;
      }
    });
View Full Code Here

        indexer.setCacheDirectory(new File(targetDir(), "mavenIndexer"));
        indexer.start();

        List<Repository> repos = Aether.defaultRepositories();
        repos.add(new Repository("ea.repository.jboss.org", "http://repository.jboss.org/nexus/content/groups/ea"));
        aether = new Aether(Aether.USER_REPOSITORY, repos);
    }
View Full Code Here

        this.xsdDir = xsdDir;
    }

    protected void downloadArtifact(ArtifactDTO artifact, String version) {
        try {
            AetherResult result = aether.resolve(artifact.getGroupId(), artifact.getArtifactId(), version, "jar", null);
            if (result != null) {
                List<File> files = result.getResolvedFiles();
                if (files != null && files.size() > 0) {
                    File file = files.get(0);
                    //for (File file : files) {
                    File newFile = new File(archetypeDir, file.getName());
                    FileInputStream input = new FileInputStream(file);
View Full Code Here

TOP

Related Classes of io.fabric8.insight.log.LogResults

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.