Package org.apache.log

Examples of org.apache.log.Logger


            setStatusMessage(request, "status.UPDATE_DETAILS");
        } catch (SQLException sqle) {
            getServlet().log("Connection.process", sqle);
            throw new SystemException(sqle);
        }
        Logger log=JGossipLog.getInstance().getAppLogger();
        if(log.isDebugEnabled()){
            log.debug("forward is "+forward);
        }
        return mapping.findForward(forward);
    }
View Full Code Here


        session.setAttribute(IConst.SESSION.CONFIRM_CODE, confirmcode);
        res.setContentType(IConst.JSP.JPG_CONTENT_TYPE);
        res.setHeader("Pragma", "no-cache");
        res.setHeader("Cache-Control", "no-cache");
        res.setDateHeader("Expires", 0);
        Logger log = JGossipLog.getInstance().getAppLogger();
        try {

            if (log.isDebugEnabled()) {
                log.debug("ConfirmCodeAction : image generator is started");
            }
            PictureGenerator.getInstance().generatePicture(confirmcode,
                    res.getOutputStream());
            res.flushBuffer();
            if (log.isDebugEnabled()) {
                log.debug("ConfirmCodeAction : image generator is finished");
            }
        } catch (Exception e) {
            log.error(" error in ConfirmCodeAction :", e);
            throw new SystemException(e);
        }
        return null;
    }
View Full Code Here

     *             DOCUMENT ME!
     * @throws SystemException
     */
    public void load(ServletContext servletContext) throws SQLException,
            IOException, SystemException {
        Logger log=JGossipLog.getInstance().getAppLogger();
        if (log.isDebugEnabled()) {
            log.debug("try to load app.properties");
        }

        InputStream is = servletContext
                .getResourceAsStream("/WEB-INF/classes/org/jresearch/gossip/resources/app.properties");

        try {
            this.props.load(is);
            is.close();
        } catch (IOException e1) {
            if (log.isErrorEnabled()) {
                log.error("Loading of jGossip's configuration failed "
                        + e1.getMessage());
            }

            throw e1;
        }

        if (log.isDebugEnabled()) {
            log.debug("try to load configuration from Data Base");
        }

        Connection conn = this.dataSource.getConnection();

        PreparedStatement st = conn.prepareStatement(dbDriver.getQueries()
                .getForumQueries().getSql_GET_CONSTANTS());
        Statement st2 = conn.createStatement();
        ResultSet rs = null;

        try {
            rs = (ResultSet) st.executeQuery();

            while (rs.next()) {
                if (log.isDebugEnabled()) {
                    log.debug(rs.getString("c_name") + " is loaded");
                }

                this.props.put(rs.getString("c_name"), rs.getString("c_value"));
            }

            // refresh all sessions(drop all entries)
            st2.executeUpdate(dbDriver.getQueries().getForumQueries()
                    .getSql_DELETE_ALL_ENTRIES());
        } catch (SQLException e) {
            if (log.isErrorEnabled()) {
                log.error("Loading of jGossip's configuration failed "
                        + e.getMessage());
            }

            throw e;
        } finally {
View Full Code Here

      md.update(password.getBytes("UTF8"));
      byte[] bytes = md.digest();
      return byteArrayToHexString(bytes);
    } catch (Exception e) {
      try {
        Logger log = JGossipLog.getInstance().getAppLogger();
        if (log.isFatalErrorEnabled()) {
          log.fatalError("Can't calculate MD5 hash.", e);
        }
      } catch (SystemException e1) { /*Ignore this exception.*/}
      return null;
    }
  }
View Full Code Here

     * @see org.apache.struts.action.PlugIn#init(org.apache.struts.action.ActionServlet,
     *      org.apache.struts.config.ModuleConfig)
     */
    public void init(ActionServlet servlet, ModuleConfig moduleconfig)
            throws ServletException {
        Logger log = null;
        try {
            log = JGossipLog.getInstance().getAppLogger();
        } catch (SystemException e) {
            throw new ServletException(e);
        }
        if (log.isInfoEnabled()) {
            log.info("init is started");
        }
        ServletContext app = servlet.getServletContext();
        app.setAttribute(IConst.CONTEXT.LAST_UPDATE_DATE, new Date());
        app.setAttribute(IConst.CONTEXT.MAIL_QUEUE, new MailQueue(
                new MailProcessor()));
        DataSource ds;
        //Setting Up Datasource
        try {
            ds = setupDataSource();
            ForumDAO dao = ForumDAO.getInstance();
            dao.setDataSource(ds);
            UserDAO udao = UserDAO.getInstance();
            udao.setDataSource(ds);
        } catch (IOException e) {
            throw new ServletException(e);
        } catch (Exception e) {
            throw new ServletException(e);
        }
        //Setting up MessageProcessor
        MessageProcessor.setEmoticonsMap(ResourceBundle
                .getBundle("org/jresearch/gossip/resources/emoticon"));
        //Load configuration parameters
        Configurator conf = Configurator.getInstance();
        conf.setDataSource(ds);
        try {
            conf.load(app);
        } catch (SQLException e) {
            if (log.isErrorEnabled()) {
                log.error("jGossip Configurator is not loaded");
            }
            throw new ServletException(e);
        } catch (IOException e) {
            if (log.isErrorEnabled()) {
                log.error("jGossip Configurator is not loaded");
            }
            throw new ServletException(e);
        } catch (SystemException e) {
            throw new ServletException(e);
        }
View Full Code Here

     * @throws SystemException
     *             TODO
     */
    public static HashMap retrieveStrutsActionMapping(ServletContext app)
            throws SystemException {
        Logger log = JGossipLog.getInstance().getAppLogger();
        if (actionMappingMap == null) {
            mConfig = (ModuleConfig) app.getAttribute(Globals.MODULE_KEY
                    + Configurator.getInstance().get(CONFIG.MODULE_PREFIX));

            if (mConfig != null) {
                actionMappingMap = new HashMap();
                ActionConfig[] acfg = mConfig.findActionConfigs();
                for (int i = 0; i < acfg.length; i++) {
                    ActionConfig actionConfig = acfg[i];
                    if (actionConfig instanceof StrutsPermissionMapping) {

                        StrutsPermissionMapping amp = (StrutsPermissionMapping) actionConfig;
                        actionMappingMap.put(amp.getPath(), amp);
                        if (log.isDebugEnabled()) {
                            log.debug(amp.getPath()
                                    + " permission mapping is loaded");
                        }
                    }
                }
            } else {
                if (log.isErrorEnabled()) {
                    log.error("NO MAPPINGS RETRIEVED");
                }
            }
        }
        return actionMappingMap;
    }
View Full Code Here

     * @param t
     */
    public static void audit(LogLevel level, String message, Throwable t) {
        bindLogContext(" ", " ", " ");
        try {
            Logger logger = JGossipLog.getInstance().auditLogger;
            switch (level.getLevel()) {
            case LogLevel.ERROR_INT:
                logger.error(message, t);
                break;
            case LogLevel.WARN_INT:
                logger.warn(message, t);
                break;
            case LogLevel.INFO_INT:
                logger.info(message, t);
                break;
            default:
                logger.debug(message, t);
            }
        } catch (SystemException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

    }

    private static final void audit(LogLevel level, String message) {
        System.out.println(message);
        try {
            Logger logger = JGossipLog.getInstance().auditLogger;
            switch (level.getLevel()) {
            case LogLevel.ERROR_INT:
                logger.error(message);
                break;
            case LogLevel.WARN_INT:
                logger.warn(message);
                break;
            case LogLevel.INFO_INT:
                logger.info(message);
                break;
            default:
                logger.debug(message);
            }
        } catch (SystemException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

                             "(%{uri}) %{thread}/%{class:short}: %{message}\\n%{throwable}" );

        servTarget.setFormatter(formatter);
        Hierarchy.getDefaultHierarchy().setDefaultLogTarget(servTarget);
        Hierarchy.getDefaultHierarchy().setDefaultPriority(logPriority);
        final Logger logger = Hierarchy.getDefaultHierarchy().getLoggerFor("");
        final DefaultLogKitManager logKitManager = new DefaultLogKitManager(Hierarchy.getDefaultHierarchy());
        logKitManager.setLogger(logger);
        final DefaultContext subcontext = new DefaultContext(this.appContext);
        subcontext.put("servlet-context", this.servletContext);
        if (this.servletContextPath == null) {
            File logSCDir = new File(this.workDir, "log");
            logSCDir.mkdirs();
            if (logger.isWarnEnabled()) {
                logger.warn("Setting servlet-context for LogKit to " + logSCDir);
            }
            subcontext.put("context-root", logSCDir.toString());
        } else {
            subcontext.put("context-root", this.servletContextPath);
        }
View Full Code Here

        final InputStream is = this.servletContext.getResourceAsStream(imConfig);
        final DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
        final Configuration conf = builder.build(is);

        // Get the logger for the instrument manager
        Logger imLogger =
            this.logKitManager.getLogger(conf.getAttribute( "logger", "core.instrument" ));

        // Set up the Instrument Manager
        DefaultInstrumentManager instrumentManager = new DefaultInstrumentManager();
        instrumentManager.enableLogging(new LogKitLogger(imLogger));
View Full Code Here

TOP

Related Classes of org.apache.log.Logger

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.