Package org.apache.geronimo.logging

Examples of org.apache.geronimo.logging.SystemLog$SearchResults


        ManagementHelper helper = getManagementHelper(request);
        return helper.getGBeanDescription(objectName);
    }

    public static SystemLog getCurrentSystemLog(PortletRequest request) {
        SystemLog log = (SystemLog) request.getPortletSession(true).getAttribute(SYSTEM_LOG_KEY, PortletSession.APPLICATION_SCOPE);
        if (log == null) {
            ManagementHelper helper = getManagementHelper(request);
            log = helper.getSystemLog(getCurrentJVM(request));
            request.getPortletSession().setAttribute(SYSTEM_LOG_KEY, log, PortletSession.APPLICATION_SCOPE);
        }
View Full Code Here


    protected void doView(RenderRequest renderRequest,
            RenderResponse renderRespose) throws PortletException, IOException {
        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
            return;
        }
        SystemLog log = PortletManager.getCurrentSystemLog(renderRequest);
        renderRequest.setAttribute("configFile", log.getConfigFileName());
//        renderRequest.setAttribute("configuration", LogHelper.getConfiguration());
        renderRequest.setAttribute("logLevel", log.getRootLoggerLevel());
        try{
            renderRequest.setAttribute("refreshPeriod", Integer.valueOf(log.getRefreshPeriodSeconds()));
        }catch(NumberFormatException e){
            //ignore
        }

        normalView.include(renderRequest, renderRespose);
View Full Code Here

        super.init(portletConfig);
    }

    public void processAction(ActionRequest actionRequest,
            ActionResponse actionResponse) throws PortletException, IOException {
        SystemLog log = PortletManager.getCurrentSystemLog(actionRequest);

        String action = actionRequest.getParameter("action");
        String logLevel = actionRequest.getParameter("logLevel");
        String configFile = actionRequest.getParameter("configFile");
        //String configuration = actionRequest.getParameter("append");
        String refreshPeriod = actionRequest.getParameter("refreshPeriod");
        String currentLevel = log.getRootLoggerLevel();

        if ("update".equals(action)) {
            if (refreshPeriod != null) {
                int refreshPeriodInt = 0;
                try{
                    refreshPeriodInt = Integer.parseInt(refreshPeriod);
                }catch(NumberFormatException e){
                    //ignore
                }
                if (refreshPeriodInt != log.getRefreshPeriodSeconds()) {
                    log.setRefreshPeriodSeconds(refreshPeriodInt);
                }
            }
            if (!log.getConfigFileName().equals(configFile)) {
                log.setConfigFileName(configFile);
            }
            if (!currentLevel.equals(logLevel)) {
                log.setRootLoggerLevel(logLevel);
            }
        }
    }
View Full Code Here

        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
            return;
        }
        String action = renderRequest.getParameter("action");

        SystemLog log = PortletManager.getCurrentSystemLog(renderRequest);
        String[] logFiles = log.getLogFileNames();
        LogFile[] files = new LogFile[logFiles.length];
        for (int i = 0; i < files.length; i++) {
            files[i] = new LogFile(logFiles[i]);
        }
        Criteria criteria = (Criteria) renderRequest.getPortletSession(true).getAttribute(CRITERIA_KEY, PortletSession.PORTLET_SCOPE);

        if(criteria != null) {
            // Check if criteria.logFile is in the logFileNames of current logging configuration
            boolean found = false;
            for(String logFile: logFiles) {
                if(criteria.logFile.equals(logFile)) {
                    found = true;
                    break;
                }
            }
            if(!found) {
                // This arises when log4j properties file is changed dynamically using LogManagerPortlet
                // and the earlier log file is no longer in the current logging configuration.
                // Change the log file to any one in the current logging configuration so that LogViewer
                // won't run into errors.
                criteria.logFile = logFiles[0];
            }
        }
        if (criteria == null || (action != null && !"refresh".equals(action))) {
            if(criteria == null)
                criteria = new Criteria();
            String startPos = renderRequest.getParameter("startPos");
            String endPos = renderRequest.getParameter("endPos");
            String maxRows = renderRequest.getParameter("maxRows");
            String logLevel = renderRequest.getParameter("logLevel");
            String searchString = renderRequest.getParameter("searchString");
            String stackTraces = renderRequest.getParameter("stackTraces");
            String logFile = renderRequest.getParameter("logFile");
            if(logFile == null || logFile.equals("")) {
                logFile = logFiles[0];
            }

            criteria.level = logLevel == null || logLevel.equals("") ? criteria.level : logLevel;
            try{
                criteria.max = maxRows == null || maxRows.equals("") ? criteria.max : Integer.parseInt(maxRows);
            }catch(NumberFormatException e){
                //ignore
            }
            try{
                criteria.start = startPos == null || startPos.equals("") ? null : new Integer(startPos);
            }catch(NumberFormatException e){
            //ignore
            }
            try{
                criteria.stop = endPos == null || endPos.equals("") ? null : new Integer(endPos);
            }catch(NumberFormatException e){
                //ignore
                }
            criteria.logFile = logFile;
            criteria.stackTraces = stackTraces != null && !stackTraces.equals("");

            criteria.text = searchString == null || searchString.equals("") ? null : searchString;
            renderRequest.getPortletSession(true).setAttribute(CRITERIA_KEY, criteria, PortletSession.PORTLET_SCOPE);
        }

        SystemLog.SearchResults results = log.getMatchingItems(criteria.logFile, criteria.start, criteria.stop,
                        criteria.level, criteria.text, criteria.max, criteria.stackTraces);
        renderRequest.setAttribute("searchResults", results.getResults());
        renderRequest.setAttribute("lineCount", Integer.valueOf(results.getLineCount()));
        renderRequest.setAttribute("startPos", criteria.start);
        renderRequest.setAttribute("endPos", criteria.stop);
View Full Code Here

    protected void doView(RenderRequest renderRequest,
            RenderResponse renderRespose) throws PortletException, IOException {
        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
            return;
        }
        SystemLog log = PortletManager.getCurrentSystemLog(renderRequest);
        renderRequest.setAttribute("configFile", log.getConfigFileName());
//        renderRequest.setAttribute("configuration", LogHelper.getConfiguration());
        renderRequest.setAttribute("logLevel", log.getRootLoggerLevel());
        try{
            renderRequest.setAttribute("refreshPeriod", new Integer(log.getRefreshPeriodSeconds()));
        }catch(NumberFormatException e){
            //ignore
        }

        normalView.include(renderRequest, renderRespose);
View Full Code Here

        super.init(portletConfig);
    }

    public void processAction(ActionRequest actionRequest,
            ActionResponse actionResponse) throws PortletException, IOException {
        SystemLog log = PortletManager.getCurrentSystemLog(actionRequest);

        String action = actionRequest.getParameter("action");
        String logLevel = actionRequest.getParameter("logLevel");
        String configFile = actionRequest.getParameter("configFile");
        String configuration = actionRequest.getParameter("append");
        String refreshPeriod = actionRequest.getParameter("refreshPeriod");
        String currentLevel = log.getRootLoggerLevel();

        if ("update".equals(action)) {
            if (refreshPeriod != null) {
                int refreshPeriodInt = 0;
                try{
                    refreshPeriodInt = Integer.parseInt(refreshPeriod);
                }catch(NumberFormatException e){
                    //ignore
                }
                if (refreshPeriodInt != log.getRefreshPeriodSeconds()) {
                    log.setRefreshPeriodSeconds(refreshPeriodInt);
                }
            }
            if (!log.getConfigFileName().equals(configFile)) {
                log.setConfigFileName(configFile);
            }
            if (!currentLevel.equals(logLevel)) {
                log.setRootLoggerLevel(logLevel);
            }
        }
    }
View Full Code Here

        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
            return;
        }
        String action = renderRequest.getParameter("action");

        SystemLog log = PortletManager.getCurrentSystemLog(renderRequest);
        String[] logFiles = log.getLogFileNames();
        LogFile[] files = new LogFile[logFiles.length];
        for (int i = 0; i < files.length; i++) {
            files[i] = new LogFile(logFiles[i]);
        }
        Criteria criteria = (Criteria) renderRequest.getPortletSession(true).getAttribute(CRITERIA_KEY, PortletSession.PORTLET_SCOPE);
       
        if(criteria != null) {
            // Check if criteria.logFile is in the logFileNames of current logging configuration
            boolean found = false;
            for(String logFile: logFiles) {
                if(criteria.logFile.equals(new File(logFile))) {
                    found = true;
                    break;
                }
            }
            if(!found) {
                // This arises when log4j properties file is changed dynamically using LogManagerPortlet
                // and the earlier log file is no longer in the current logging configuration.
                // Change the log file to any one in the current logging configuration so that LogViewer
                // won't run into errors.
                criteria.logFile = logFiles[0];
            }
        }
        if (criteria == null || (action != null && !"refresh".equals(action))) {
            if(criteria == null)
                criteria = new Criteria();
            String startPos = renderRequest.getParameter("startPos");
            String endPos = renderRequest.getParameter("endPos");
            String maxRows = renderRequest.getParameter("maxRows");
            String logLevel = renderRequest.getParameter("logLevel");
            String searchString = renderRequest.getParameter("searchString");
            String stackTraces = renderRequest.getParameter("stackTraces");
            String logFile = renderRequest.getParameter("logFile");
            if(logFile == null || logFile.equals("")) {
                logFile = logFiles[0];
            }
           
            criteria.level = logLevel == null || logLevel.equals("") ? criteria.level : logLevel;
            try{
                criteria.max = maxRows == null || maxRows.equals("") ? criteria.max : Integer.parseInt(maxRows);
            }catch(NumberFormatException e){
                //ignore
            }
            try{
                criteria.start = startPos == null || startPos.equals("") ? null : new Integer(startPos);
            }catch(NumberFormatException e){
            //ignore
            }
            try{
                criteria.stop = endPos == null || endPos.equals("") ? null : new Integer(endPos);
            }catch(NumberFormatException e){
                //ignore
                }
            criteria.logFile = logFile;
            criteria.stackTraces = stackTraces != null && !stackTraces.equals("");
           
            criteria.text = searchString == null || searchString.equals("") ? null : searchString;
            renderRequest.getPortletSession(true).setAttribute(CRITERIA_KEY, criteria, PortletSession.PORTLET_SCOPE);
        }

        SystemLog.SearchResults results = log.getMatchingItems(criteria.logFile, criteria.start, criteria.stop,
                        criteria.level, criteria.text, criteria.max, criteria.stackTraces);
        renderRequest.setAttribute("searchResults", results.getResults());
        renderRequest.setAttribute("lineCount", new Integer(results.getLineCount()));
        renderRequest.setAttribute("startPos", criteria.start);
        renderRequest.setAttribute("endPos", criteria.stop);
View Full Code Here

        ManagementHelper helper = getManagementHelper(request);
        return helper.getGBeanDescription(objectName);
    }

    public static SystemLog getCurrentSystemLog(PortletRequest request) {
        SystemLog log = (SystemLog) request.getPortletSession(true).getAttribute(SYSTEM_LOG_KEY, PortletSession.APPLICATION_SCOPE);
        if (log == null) {
            ManagementHelper helper = getManagementHelper(request);
            log = helper.getSystemLog(getCurrentJVM(request));
            request.getPortletSession().setAttribute(SYSTEM_LOG_KEY, log, PortletSession.APPLICATION_SCOPE);
        }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.logging.SystemLog$SearchResults

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.