当前位置: 首页>>代码示例>>Java>>正文


Java Log.isDebugEnabled方法代码示例

本文整理汇总了Java中org.apache.ibatis.logging.Log.isDebugEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Log.isDebugEnabled方法的具体用法?Java Log.isDebugEnabled怎么用?Java Log.isDebugEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ibatis.logging.Log的用法示例。


在下文中一共展示了Log.isDebugEnabled方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LoadPair

import org.apache.ibatis.logging.Log; //导入方法依赖的package包/类
private LoadPair(final String property, MetaObject metaResultObject, ResultLoader resultLoader) {
  this.property = property;
  this.metaResultObject = metaResultObject;
  this.resultLoader = resultLoader;

  /* Save required information only if original object can be serialized. */
  if (metaResultObject != null && metaResultObject.getOriginalObject() instanceof Serializable) {
    final Object mappedStatementParameter = resultLoader.parameterObject;

    /* @todo May the parameter be null? */
    if (mappedStatementParameter instanceof Serializable) {
      this.mappedStatement = resultLoader.mappedStatement.getId();
      this.mappedParameter = (Serializable) mappedStatementParameter;

      this.configurationFactory = resultLoader.configuration.getConfigurationFactory();
    } else {
      Log log = this.getLogger();
      if (log.isDebugEnabled()) {
        log.debug("Property [" + this.property + "] of ["
                + metaResultObject.getOriginalObject().getClass() + "] cannot be loaded "
                + "after deserialization. Make sure it's loaded before serializing "
                + "forenamed object.");
      }
    }
  }
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:27,代码来源:ResultLoaderMap.java

示例2: getConnection

import org.apache.ibatis.logging.Log; //导入方法依赖的package包/类
protected Connection getConnection(Log statementLog) throws SQLException {
  Connection connection = transaction.getConnection();
  if (statementLog.isDebugEnabled()) {
    return ConnectionLogger.newInstance(connection, statementLog, queryStack);
  } else {
    return connection;
  }
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:9,代码来源:BaseExecutor.java

示例3: getConnection

import org.apache.ibatis.logging.Log; //导入方法依赖的package包/类
protected Connection getConnection(Log statementLog) throws SQLException {
  // 源码解析: 从事务获取数据库连接
  Connection connection = transaction.getConnection();
  if (statementLog.isDebugEnabled()) {
    // 源码解析: debug模式下, 返回connection的包装对象
    return ConnectionLogger.newInstance(connection, statementLog, queryStack);
  } else {
    return connection;
  }
}
 
开发者ID:txazo,项目名称:mybatis,代码行数:11,代码来源:BaseExecutor.java

示例4: getCount

import org.apache.ibatis.logging.Log; //导入方法依赖的package包/类
/**
     * 查询总纪录数
     * @param sql             SQL语句
     * @param connection      数据库连接
     * @param mappedStatement mapped
     * @param parameterObject 参数
     * @param boundSql        boundSql
     * @return 总记录数
     * @throws SQLException sql查询错误
     */
    public static int getCount(final String sql, final Connection connection,
    							final MappedStatement mappedStatement, final Object parameterObject,
    							final BoundSql boundSql, Log log) throws SQLException {
        final String countSql = "select count(1) from (" + sql + ") tmp_count";
//        final String countSql = "select count(1) " + removeSelect(removeOrders(sql));
        Connection conn = connection;
        PreparedStatement ps = null;
        ResultSet rs = null;
        try {
        	if (log.isDebugEnabled()) {
                log.debug("COUNT SQL: " + StringUtils.replaceEach(countSql, new String[]{"\n", "\t"}, new String[]{" ", " "}));
            }
        	if (conn == null){
        		conn = mappedStatement.getConfiguration().getEnvironment().getDataSource().getConnection();
            }
        	ps = conn.prepareStatement(countSql);
            BoundSql countBS = new BoundSql(mappedStatement.getConfiguration(), countSql,
                    boundSql.getParameterMappings(), parameterObject);
            SQLHelper.setParameters(ps, mappedStatement, countBS, parameterObject);
            rs = ps.executeQuery();
            int count = 0;
            if (rs.next()) {
                count = rs.getInt(1);
            }
            return count;
        } finally {
            if (rs != null) {
                rs.close();
            }
            if (ps != null) {
            	ps.close();
            }
            if (conn != null) {
            	conn.close();
            }
        }
    }
 
开发者ID:EleTeam,项目名称:Shop-for-JavaWeb,代码行数:48,代码来源:SQLHelper.java

示例5: getConnection

import org.apache.ibatis.logging.Log; //导入方法依赖的package包/类
protected Connection getConnection(Log statementLog) throws SQLException {
  Connection connection = transaction.getConnection();
  if (statementLog.isDebugEnabled()) {
    //如果需要打印Connection的日志,返回一个ConnectionLogger(代理模式, AOP思想)
    return ConnectionLogger.newInstance(connection, statementLog, queryStack);
  } else {
    return connection;
  }
}
 
开发者ID:shurun19851206,项目名称:mybaties,代码行数:10,代码来源:BaseExecutor.java

示例6: debug

import org.apache.ibatis.logging.Log; //导入方法依赖的package包/类
public void debug(Log statementLogger, String msg) {
    if (statementLogger.isDebugEnabled()) {
        statementLogger.debug(msg);
    } else {
        pLogger.debug(msg);
    }
}
 
开发者ID:naver,项目名称:pinpoint,代码行数:8,代码来源:BindingLogPlugin32.java

示例7: getCount

import org.apache.ibatis.logging.Log; //导入方法依赖的package包/类
/**
 * 查询总纪录数
 *
 * @param sql             SQL语句
 * @param connection      数据库连接
 * @param mappedStatement mapped
 * @param parameterObject 参数
 * @param boundSql        boundSql
 * @return 总记录数
 * @throws SQLException sql查询错误
 */
public static int getCount(final String sql, final Connection connection, final MappedStatement mappedStatement,
                           final Object parameterObject, final BoundSql boundSql, Log log) throws SQLException {
    String dbName = Global.getConfig("jdbc.type");
    final String countSql;
    if ("oracle".equals(dbName)) {
        countSql = "select count(1) from (" + sql + ") tmp_count";
    } else {
        countSql = "select count(1) from (" + removeOrders(sql) + ") tmp_count";
        // countSql = "select count(1) " + removeSelect(removeOrders(sql));
    }
    Connection conn = connection;
    PreparedStatement ps = null;
    ResultSet rs = null;
    try {
        if (log.isDebugEnabled()) {
            log.debug("COUNT SQL: "
                    + StringUtils.replaceEach(countSql, new String[]{"\n", "\t"}, new String[]{" ", " "}));
        }
        if (conn == null) {
            conn = mappedStatement.getConfiguration().getEnvironment().getDataSource().getConnection();
        }
        ps = conn.prepareStatement(countSql);
        BoundSql countBS = new BoundSql(mappedStatement.getConfiguration(), countSql,
                boundSql.getParameterMappings(), parameterObject);
        // 解决MyBatis 分页foreach 参数失效 start
        if (Reflections.getFieldValue(boundSql, "metaParameters") != null) {
            MetaObject mo = (MetaObject) Reflections.getFieldValue(boundSql, "metaParameters");
            Reflections.setFieldValue(countBS, "metaParameters", mo);
        }
        // 解决MyBatis 分页foreach 参数失效 end
        SQLHelper.setParameters(ps, mappedStatement, countBS, parameterObject);
        rs = ps.executeQuery();
        int count = 0;
        if (rs.next()) {
            count = rs.getInt(1);
        }
        return count;
    } finally {
        if (rs != null) {
            rs.close();
        }
        if (ps != null) {
            ps.close();
        }
        if (conn != null) {
            conn.close();
        }
    }
}
 
开发者ID:ansafari,项目名称:melon,代码行数:61,代码来源:SQLHelper.java

示例8: isDebugEnable

import org.apache.ibatis.logging.Log; //导入方法依赖的package包/类
public boolean isDebugEnable(Log statementLogger) {
    return statementLogger.isDebugEnabled() || pLogger.isDebugEnabled();
}
 
开发者ID:naver,项目名称:pinpoint,代码行数:4,代码来源:BindingLogPlugin32.java


注:本文中的org.apache.ibatis.logging.Log.isDebugEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。