Package it.eng.spagobi.commons.bo

Examples of it.eng.spagobi.commons.bo.CustomJDBCAppender


   * @throws Exception the exception
   */
  public static void updateAudit(Connection jdbcConnection,IEngUserProfile profile, String  action_code, String info)
  throws Exception {
    logger.debug("IN");
    CustomJDBCAppender ja = null;
    boolean updateDB= false;
    SingletonConfig serverConfig = SingletonConfig.getInstance();
    String dbTimestampFormat = serverConfig.getConfigValue("SPAGOBI.DB-TIMESTAMP-FORMAT.format");
    String updateDBConf = serverConfig.getConfigValue("SPAGOBI.DB_LOG.value");
    if(updateDBConf!=null && updateDBConf.equalsIgnoreCase("true")){
      updateDB=true;
    }

    String userName = "";
    String userRoles = "";
    if(profile!=null){
      userName = ((UserProfile)profile).getUserId().toString();

      Collection roles = ((UserProfile)profile).getRolesForUse();

      userRoles = createRolesString(roles);
    }

    if(jdbcConnection!=null){
      ja = new CustomJDBCAppender(jdbcConnection);     
      if(updateDB && action_code!=null){
        String sqlInsert = "INSERT INTO SBI_ACTIVITY_MONITORING (ACTION_TIME, USERNAME, USERGROUP, LOG_LEVEL, ACTION_CODE, INFO)";
        sqlInsert += "VALUES('%d{"+dbTimestampFormat+"}','"+userName+"','"+userRoles+"','%5p','"+action_code+"','"+(info!=null?info:"")+"')";
        logger.debug("SQL INSERT:"+sqlInsert);
        ja.setSql(sqlInsert);
        audit_logger.addAppender(ja);
      }
    }
    // These messages with Priority >= setted priority will be logged to the database.
    audit_logger.info("activity_info: USERNAME="+userName+"; USERGROUP="+userRoles+" ACTION_CODE="+action_code+"");
View Full Code Here

TOP

Related Classes of it.eng.spagobi.commons.bo.CustomJDBCAppender

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.