Package com.googlecode.psiprobe.tools.logging

Examples of com.googlecode.psiprobe.tools.logging.LogDestination


            List uniqueList = new LinkedList();
            Comparator cmp = new LogDestinationComparator(all);

            Collections.sort(allAppenders, cmp);
            for (int i = 0; i < allAppenders.size(); i++) {
                LogDestination dest = (LogDestination) allAppenders.get(i);
                if (Collections.binarySearch(uniqueList, dest, cmp) < 0) {
                    if (all || dest.getFile() == null || dest.getFile().exists()) {
                        uniqueList.add(new DisconnectedLogDestination(dest));
                    }
                }
            }
            return uniqueList;
View Full Code Here


    public List getLogSources(File logFile) {
        List filtered = new LinkedList();
        List sources = getLogSources();
        for (int i = 0; i < sources.size(); i++) {
            LogDestination dest = (LogDestination) sources.get(i);
            if (logFile.equals(dest.getFile())) {
                filtered.add(dest);
            }
        }
        return filtered;
    }
View Full Code Here

        if (allAppenders != null) {
            Comparator cmp = new LogSourceComparator();

            Collections.sort(allAppenders, cmp);
            for (int i = 0; i < allAppenders.size(); i++) {
                LogDestination dest = (LogDestination) allAppenders.get(i);
                if (Collections.binarySearch(sources, dest, cmp) < 0) {
                    sources.add(new DisconnectedLogDestination(dest));
                }
            }
        }
View Full Code Here

        public LogDestinationComparator(boolean all) {
            this.all = all;
        }

        public int compare(Object o1, Object o2) {
            LogDestination d1 = (LogDestination) o1;
            LogDestination d2 = (LogDestination) o2;
            File f1 = d1.getFile();
            File f2 = d2.getFile();
            String name1 = (f1 == null ? "" : f1.getAbsolutePath());
            String name2 = (f2 == null ? "" : f2.getAbsolutePath());
            if (all) {
                Application a1 = d1.getApplication();
                Application a2 = d2.getApplication();
            if (a1 == null || a2 == null) {
                a1 = null;
                a2 = null;
            }
                String appName1 = (a1 == null ? "" : a1.getName());
                String appName2 = (a2 == null ? "" : a2.getName());
                String context1 = (d1.isContext() ? "is" : "not");
                String context2 = (d2.isContext() ? "is" : "not");
                String root1 = (d1.isRoot() ? "is" : "not");
                String root2 = (d2.isRoot() ? "is" : "not");
                String logType1 = d1.getLogType();
                String logType2 = d1.getLogType();
                char delim = '!';
                name1 = appName1 + delim + context1 + delim + root1 + delim + logType1 + delim + name1;
                name2 = appName2 + delim + context2 + delim + root2 + delim + logType2 + delim + name2;
View Full Code Here

                DefaultAccessor da2 = (DefaultAccessor) o2;
                if (da1.getTarget() == da2.getTarget()) {
                    return 0;
                }
            }
            LogDestination d1 = (LogDestination) o1;
            LogDestination d2 = (LogDestination) o2;
            File f1 = d1.getFile();
            File f2 = d2.getFile();
            String filename1 = (f1 == null ? "" : f1.getAbsolutePath());
            String filename2 = (f2 == null ? "" : f2.getAbsolutePath());
            Application a1 = d1.getApplication();
            Application a2 = d2.getApplication();
            if (a1 == null || a2 == null) {
                a1 = null;
                a2 = null;
            }
            String appName1 = (a1 == null ? "" : a1.getName());
            String appName2 = (a2 == null ? "" : a2.getName());
            String logType1 = d1.getLogType();
            String logType2 = d1.getLogType();
            String context1 = (d1.isContext() ? "is" : "not");
            String context2 = (d2.isContext() ? "is" : "not");
            String root1 = (d1.isRoot() ? "is" : "not");
            String root2 = (d2.isRoot() ? "is" : "not");
            String logName1 = d1.getName();
            String logName2 = d2.getName();
            //String logIndex1 = d1.getIndex();
            //String logIndex2 = d2.getIndex();
            char delim = '!';
            String name1 = appName1 + delim + logType1 + delim + context1 + delim + root1 + delim + logName1 + delim + filename1;
            String name2 = appName2 + delim + logType2 + delim + context2 + delim + root2 + delim + logName2 + delim + filename2;
View Full Code Here

    public LogDestination getDestination() {
        return destination;
    }

    public void visit(Log4JLoggerAccessor accessor) {
        LogDestination dest = accessor.getAppender(logIndex);
        if (dest != null) {
            destination = dest;
        }
    }
View Full Code Here

            destination = dest;
        }
    }

    public void visit(Jdk14LoggerAccessor accessor) {
        LogDestination dest = accessor.getHandler(logIndex);
        if (dest != null) {
            destination = dest;
        }
    }
View Full Code Here

        boolean context = ServletRequestUtils.getBooleanParameter(request, "context", false);
        boolean root = ServletRequestUtils.getBooleanParameter(request, "root", false);
        String logName = ServletRequestUtils.getStringParameter(request, "logName");
        String logIndex = ServletRequestUtils.getStringParameter(request, "logIndex");

        LogDestination dest = logResolver.getLogDestination(logType, webapp, context, root, logName, logIndex);

        if (dest != null) {
            if (dest.getFile() != null && dest.getFile().exists()) {
                modelAndView = handleLogFile(request, response, dest);
                logFound = true;
            } else {
                logger.error(dest.getFile() + ": file not found");
            }
        } else {
            logger.error(logType + (root ? " root" : "") + " log" + (root ? "" : " \"" + logName + "\"") + " not found");
        }
        if (!logFound) {
View Full Code Here

TOP

Related Classes of com.googlecode.psiprobe.tools.logging.LogDestination

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.