org.apache.ibatis.logging.LogFactory Java Examples

The following examples show how to use org.apache.ibatis.logging.LogFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GossipLogModule.java    From gossip with MIT License 6 votes vote down vote up
@Override
public void configure(Binder binder) {
    // Set jboss logging component to use slf4j, it's a shit hard coding
    System.setProperty("org.jboss.logging.provider", "slf4j");

    // Set MyBatis to use slf4j
    LogFactory.useSlf4jLogging();

    // Set druid to use slf4f
    System.setProperty("druid.logType", "slf4j");

    // Netty would first use slf4j, no need to config
    // MySQL's logger is configurable through its jdbc properties, no need to config here

    // Make logback load external config file
    initializeLogback();
}
 
Example #2
Source File: MappedStatement.java    From mybaties with Apache License 2.0 6 votes vote down vote up
public Builder(Configuration configuration, String id, SqlSource sqlSource, SqlCommandType sqlCommandType) {
  mappedStatement.configuration = configuration;
  mappedStatement.id = id;
  mappedStatement.sqlSource = sqlSource;
  mappedStatement.statementType = StatementType.PREPARED;
  mappedStatement.parameterMap = new ParameterMap.Builder(configuration, "defaultParameterMap", null, new ArrayList<ParameterMapping>()).build();
  mappedStatement.resultMaps = new ArrayList<ResultMap>();
  mappedStatement.timeout = configuration.getDefaultStatementTimeout();
  mappedStatement.sqlCommandType = sqlCommandType;
  mappedStatement.keyGenerator = configuration.isUseGeneratedKeys() && SqlCommandType.INSERT.equals(sqlCommandType) ? new Jdbc3KeyGenerator() : new NoKeyGenerator();
  String logId = id;
  if (configuration.getLogPrefix() != null) {
    logId = configuration.getLogPrefix() + id;
  }
  mappedStatement.statementLog = LogFactory.getLog(logId);
  mappedStatement.lang = configuration.getDefaultScriptingLanuageInstance();
}
 
Example #3
Source File: MappedStatement.java    From mybatis with Apache License 2.0 6 votes vote down vote up
public Builder(Configuration configuration, String id, SqlSource sqlSource, SqlCommandType sqlCommandType) {
  mappedStatement.configuration = configuration;
  mappedStatement.id = id;
  mappedStatement.sqlSource = sqlSource;
  mappedStatement.statementType = StatementType.PREPARED;
  mappedStatement.parameterMap = new ParameterMap.Builder(configuration, "defaultParameterMap", null, new ArrayList<ParameterMapping>()).build();
  mappedStatement.resultMaps = new ArrayList<ResultMap>();
  mappedStatement.timeout = configuration.getDefaultStatementTimeout();
  mappedStatement.sqlCommandType = sqlCommandType;
  mappedStatement.keyGenerator = configuration.isUseGeneratedKeys() && SqlCommandType.INSERT.equals(sqlCommandType) ? new Jdbc3KeyGenerator() : new NoKeyGenerator();
  String logId = id;
  if (configuration.getLogPrefix() != null) {
    logId = configuration.getLogPrefix() + id;
  }
  mappedStatement.statementLog = LogFactory.getLog(logId);
  mappedStatement.lang = configuration.getDefaultScriptingLanuageInstance();
}
 
Example #4
Source File: Configuration.java    From Shop-for-JavaWeb with MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void setLogImpl(Class<?> logImpl) {
	if (logImpl != null) {
		this.logImpl = (Class<? extends Log>) logImpl;
		LogFactory.useCustomLogging(this.logImpl);
	}
}
 
Example #5
Source File: Configuration.java    From mybaties with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void setLogImpl(Class<?> logImpl) {
  if (logImpl != null) {
    this.logImpl = (Class<? extends Log>) logImpl;
    LogFactory.useCustomLogging(this.logImpl);
  }
}
 
Example #6
Source File: Configuration.java    From mybatis with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void setLogImpl(Class<?> logImpl) {
  if (logImpl != null) {
    this.logImpl = (Class<? extends Log>) logImpl;
    LogFactory.useCustomLogging(this.logImpl);
  }
}
 
Example #7
Source File: MybatisLog.java    From sumk with Apache License 2.0 4 votes vote down vote up
public static void enableMybatisLog() {
	LogFactory.useCustomLogging(MybatisLog.class);
}
 
Example #8
Source File: LoggingCache.java    From mybaties with Apache License 2.0 4 votes vote down vote up
public LoggingCache(Cache delegate) {
  this.delegate = delegate;
  this.log = LogFactory.getLog(getId());
}
 
Example #9
Source File: ResultLoaderMap.java    From mybaties with Apache License 2.0 4 votes vote down vote up
private Log getLogger() {
  if (this.log == null) {
    this.log = LogFactory.getLog(this.getClass());
  }
  return this.log;
}
 
Example #10
Source File: LoggingCache.java    From mybatis with Apache License 2.0 4 votes vote down vote up
public LoggingCache(Cache delegate) {
  this.delegate = delegate;
  this.log = LogFactory.getLog(getId());
}
 
Example #11
Source File: ResultLoaderMap.java    From mybatis with Apache License 2.0 4 votes vote down vote up
private Log getLogger() {
  if (this.log == null) {
    this.log = LogFactory.getLog(this.getClass());
  }
  return this.log;
}
 
Example #12
Source File: ProcessInstanceModificationInTransactionTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Before
public void init() {
  LogFactory.useSlf4jLogging();
}