本文整理汇总了Java中com.mysql.jdbc.log.LogFactory.getLogger方法的典型用法代码示例。如果您正苦于以下问题:Java LogFactory.getLogger方法的具体用法?Java LogFactory.getLogger怎么用?Java LogFactory.getLogger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mysql.jdbc.log.LogFactory
的用法示例。
在下文中一共展示了LogFactory.getLogger方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeDriverProperties
import com.mysql.jdbc.log.LogFactory; //导入方法依赖的package包/类
/**
* Initializes driver properties that come from URL or properties passed to
* the driver manager.
*
* @param info
* @throws SQLException
*/
private void initializeDriverProperties(Properties info) throws SQLException {
initializeProperties(info);
String exceptionInterceptorClasses = getExceptionInterceptors();
if (exceptionInterceptorClasses != null && !"".equals(exceptionInterceptorClasses)) {
this.exceptionInterceptor = new ExceptionInterceptorChain(exceptionInterceptorClasses);
}
this.usePlatformCharsetConverters = getUseJvmCharsetConverters();
this.log = LogFactory.getLogger(getLogger(), LOGGER_INSTANCE_NAME, getExceptionInterceptor());
if (getProfileSql() || getUseUsageAdvisor()) {
this.eventSink = ProfilerEventHandlerFactory.getInstance(getLoadBalanceSafeProxy());
}
if (getCachePreparedStatements()) {
createPreparedStatementCaches();
}
if (getNoDatetimeStringSync() && getUseTimezone()) {
throw SQLError.createSQLException("Can't enable noDatetimeStringSync and useTimezone configuration properties at the same time",
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE, getExceptionInterceptor());
}
if (getCacheCallableStatements()) {
this.parsedCallableStatementCache = new LRUCache(getCallableStatementCacheSize());
}
if (getAllowMultiQueries()) {
setCacheResultSetMetadata(false); // we don't handle this yet
}
if (getCacheResultSetMetadata()) {
this.resultSetMetadataCache = new LRUCache(getMetadataCacheSize());
}
}
示例2: FabricMySQLConnectionProxy
import com.mysql.jdbc.log.LogFactory; //导入方法依赖的package包/类
public FabricMySQLConnectionProxy(Properties props) throws SQLException {
// first, handle and remove Fabric-specific properties. once fabricShardKey et al are ConnectionProperty instances this will be unnecessary
this.fabricShardKey = props.getProperty(FabricMySQLDriver.FABRIC_SHARD_KEY_PROPERTY_KEY);
this.fabricShardTable = props.getProperty(FabricMySQLDriver.FABRIC_SHARD_TABLE_PROPERTY_KEY);
this.fabricServerGroup = props.getProperty(FabricMySQLDriver.FABRIC_SERVER_GROUP_PROPERTY_KEY);
this.fabricProtocol = props.getProperty(FabricMySQLDriver.FABRIC_PROTOCOL_PROPERTY_KEY);
this.fabricUsername = props.getProperty(FabricMySQLDriver.FABRIC_USERNAME_PROPERTY_KEY);
this.fabricPassword = props.getProperty(FabricMySQLDriver.FABRIC_PASSWORD_PROPERTY_KEY);
this.reportErrors = Boolean.valueOf(props.getProperty(FabricMySQLDriver.FABRIC_REPORT_ERRORS_PROPERTY_KEY));
props.remove(FabricMySQLDriver.FABRIC_SHARD_KEY_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_SHARD_TABLE_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_SERVER_GROUP_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_PROTOCOL_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_USERNAME_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_PASSWORD_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_REPORT_ERRORS_PROPERTY_KEY);
this.host = props.getProperty(NonRegisteringDriver.HOST_PROPERTY_KEY);
this.port = props.getProperty(NonRegisteringDriver.PORT_PROPERTY_KEY);
this.username = props.getProperty(NonRegisteringDriver.USER_PROPERTY_KEY);
this.password = props.getProperty(NonRegisteringDriver.PASSWORD_PROPERTY_KEY);
this.database = props.getProperty(NonRegisteringDriver.DBNAME_PROPERTY_KEY);
if (this.username == null) {
this.username = "";
}
if (this.password == null) {
this.password = "";
}
// add our interceptor to pass exceptions back to the `interceptException' method
String exceptionInterceptors = props.getProperty("exceptionInterceptors");
if (exceptionInterceptors == null || "null".equals("exceptionInterceptors")) {
exceptionInterceptors = "";
} else {
exceptionInterceptors += ",";
}
exceptionInterceptors += "com.mysql.fabric.jdbc.ErrorReportingExceptionInterceptor";
props.setProperty("exceptionInterceptors", exceptionInterceptors);
initializeProperties(props);
// validation check of properties
if (this.fabricServerGroup != null && this.fabricShardTable != null) {
throw SQLError.createSQLException("Server group and shard table are mutually exclusive. Only one may be provided.",
SQLError.SQL_STATE_CONNECTION_REJECTED, null, getExceptionInterceptor(), this);
}
try {
String url = this.fabricProtocol + "://" + this.host + ":" + this.port;
this.fabricConnection = new FabricConnection(url, this.fabricUsername, this.fabricPassword);
} catch (FabricCommunicationException ex) {
throw SQLError.createSQLException("Unable to establish connection to the Fabric server", SQLError.SQL_STATE_CONNECTION_REJECTED, ex,
getExceptionInterceptor(), this);
}
// initialize log before any further calls that might actually use it
this.log = LogFactory.getLogger(getLogger(), "FabricMySQLConnectionProxy", null);
setShardTable(this.fabricShardTable);
setShardKey(this.fabricShardKey);
setServerGroupName(this.fabricServerGroup);
}
示例3: initializeDriverProperties
import com.mysql.jdbc.log.LogFactory; //导入方法依赖的package包/类
/**
* Initializes driver properties that come from URL or properties passed to
* the driver manager.
*
* @param info
* @throws SQLException
*/
private void initializeDriverProperties(Properties info) throws SQLException {
initializeProperties(info);
String exceptionInterceptorClasses = getExceptionInterceptors();
if (exceptionInterceptorClasses != null && !"".equals(exceptionInterceptorClasses)) {
this.exceptionInterceptor = new ExceptionInterceptorChain(exceptionInterceptorClasses);
}
this.usePlatformCharsetConverters = getUseJvmCharsetConverters();
this.log = LogFactory.getLogger(getLogger(), LOGGER_INSTANCE_NAME, getExceptionInterceptor());
if (getProfileSql() || getUseUsageAdvisor()) {
this.eventSink = ProfilerEventHandlerFactory.getInstance(getMultiHostSafeProxy());
}
if (getCachePreparedStatements()) {
createPreparedStatementCaches();
}
if (getNoDatetimeStringSync() && getUseTimezone()) {
throw SQLError.createSQLException("Can't enable noDatetimeStringSync and useTimezone configuration properties at the same time",
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE, getExceptionInterceptor());
}
if (getCacheCallableStatements()) {
this.parsedCallableStatementCache = new LRUCache(getCallableStatementCacheSize());
}
if (getAllowMultiQueries()) {
setCacheResultSetMetadata(false); // we don't handle this yet
}
if (getCacheResultSetMetadata()) {
this.resultSetMetadataCache = new LRUCache(getMetadataCacheSize());
}
if (getSocksProxyHost() != null) {
setSocketFactoryClassName("com.mysql.jdbc.SocksProxySocketFactory");
}
}
示例4: FabricMySQLConnectionProxy
import com.mysql.jdbc.log.LogFactory; //导入方法依赖的package包/类
public FabricMySQLConnectionProxy(Properties props) throws SQLException {
// first, handle and remove Fabric-specific properties. once fabricShardKey et al are ConnectionProperty instances this will be unnecessary
this.fabricShardKey = props.getProperty(FabricMySQLDriver.FABRIC_SHARD_KEY_PROPERTY_KEY);
this.fabricShardTable = props.getProperty(FabricMySQLDriver.FABRIC_SHARD_TABLE_PROPERTY_KEY);
this.fabricServerGroup = props.getProperty(FabricMySQLDriver.FABRIC_SERVER_GROUP_PROPERTY_KEY);
this.fabricProtocol = props.getProperty(FabricMySQLDriver.FABRIC_PROTOCOL_PROPERTY_KEY);
this.fabricUsername = props.getProperty(FabricMySQLDriver.FABRIC_USERNAME_PROPERTY_KEY);
this.fabricPassword = props.getProperty(FabricMySQLDriver.FABRIC_PASSWORD_PROPERTY_KEY);
this.reportErrors = Boolean.valueOf(props.getProperty(FabricMySQLDriver.FABRIC_REPORT_ERRORS_PROPERTY_KEY));
props.remove(FabricMySQLDriver.FABRIC_SHARD_KEY_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_SHARD_TABLE_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_SERVER_GROUP_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_PROTOCOL_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_USERNAME_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_PASSWORD_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_REPORT_ERRORS_PROPERTY_KEY);
this.host = props.getProperty(NonRegisteringDriver.HOST_PROPERTY_KEY);
this.port = props.getProperty(NonRegisteringDriver.PORT_PROPERTY_KEY);
this.username = props.getProperty(NonRegisteringDriver.USER_PROPERTY_KEY);
this.password = props.getProperty(NonRegisteringDriver.PASSWORD_PROPERTY_KEY);
this.database = props.getProperty(NonRegisteringDriver.DBNAME_PROPERTY_KEY);
if (this.username == null) {
this.username = "";
}
if (this.password == null) {
this.password = "";
}
// add our interceptor to pass exceptions back to the `interceptException' method
String exceptionInterceptors = props.getProperty("exceptionInterceptors");
if (exceptionInterceptors == null || "null".equals("exceptionInterceptors")) {
exceptionInterceptors = "";
} else {
exceptionInterceptors += ",";
}
exceptionInterceptors += "com.mysql.fabric.jdbc.ErrorReportingExceptionInterceptor";
props.setProperty("exceptionInterceptors", exceptionInterceptors);
initializeProperties(props);
// validation check of properties
if (this.fabricServerGroup != null && this.fabricShardTable != null) {
throw SQLError.createSQLException("Server group and shard table are mutually exclusive. Only one may be provided.",
SQLError.SQL_STATE_CONNECTION_REJECTED, null, getExceptionInterceptor(), this);
}
try {
String url = this.fabricProtocol + "://" + this.host + ":" + this.port;
this.fabricConnection = new FabricConnection(url, this.fabricUsername, this.fabricPassword);
} catch (FabricCommunicationException ex) {
throw SQLError.createSQLException("Unable to establish connection to the Fabric server", SQLError.SQL_STATE_CONNECTION_REJECTED, ex,
getExceptionInterceptor(), this);
}
setShardTable(this.fabricShardTable);
setShardKey(this.fabricShardKey);
setServerGroupName(this.fabricServerGroup);
this.log = LogFactory.getLogger(getLogger(), "FabricMySQLConnectionProxy", null);
}
示例5: initializeDriverProperties
import com.mysql.jdbc.log.LogFactory; //导入方法依赖的package包/类
/**
* Initializes driver properties that come from URL or properties passed to
* the driver manager.
*
* @param info
* @throws SQLException
*/
private void initializeDriverProperties(Properties info) throws SQLException {
initializeProperties(info);
String exceptionInterceptorClasses = getExceptionInterceptors();
if (exceptionInterceptorClasses != null && !"".equals(exceptionInterceptorClasses)) {
this.exceptionInterceptor = new ExceptionInterceptorChain(exceptionInterceptorClasses);
}
this.usePlatformCharsetConverters = getUseJvmCharsetConverters();
this.log = LogFactory.getLogger(getLogger(), LOGGER_INSTANCE_NAME, getExceptionInterceptor());
if (getProfileSql() || getUseUsageAdvisor()) {
this.eventSink = ProfilerEventHandlerFactory.getInstance(getMultiHostSafeProxy());
}
if (getCachePreparedStatements()) {
createPreparedStatementCaches();
}
if (getNoDatetimeStringSync() && getUseTimezone()) {
throw SQLError.createSQLException("Can't enable noDatetimeStringSync and useTimezone configuration properties at the same time",
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE, getExceptionInterceptor());
}
if (getCacheCallableStatements()) {
this.parsedCallableStatementCache = new LRUCache<CompoundCacheKey, CallableStatement.CallableStatementParamInfo>(getCallableStatementCacheSize());
}
if (getAllowMultiQueries()) {
setCacheResultSetMetadata(false); // we don't handle this yet
}
if (getCacheResultSetMetadata()) {
this.resultSetMetadataCache = new LRUCache<String, CachedResultSetMetaData>(getMetadataCacheSize());
}
if (getSocksProxyHost() != null) {
setSocketFactoryClassName("com.mysql.jdbc.SocksProxySocketFactory");
}
}
示例6: FabricMySQLConnectionProxy
import com.mysql.jdbc.log.LogFactory; //导入方法依赖的package包/类
public FabricMySQLConnectionProxy(Properties props) throws SQLException {
// first, handle and remove Fabric-specific properties. once fabricShardKey et al are ConnectionProperty instances this will be unnecessary
this.fabricShardKey = props.getProperty(FabricMySQLDriver.FABRIC_SHARD_KEY_PROPERTY_KEY);
this.fabricShardTable = props.getProperty(FabricMySQLDriver.FABRIC_SHARD_TABLE_PROPERTY_KEY);
this.fabricServerGroup = props.getProperty(FabricMySQLDriver.FABRIC_SERVER_GROUP_PROPERTY_KEY);
this.fabricProtocol = props.getProperty(FabricMySQLDriver.FABRIC_PROTOCOL_PROPERTY_KEY);
this.fabricUsername = props.getProperty(FabricMySQLDriver.FABRIC_USERNAME_PROPERTY_KEY);
this.fabricPassword = props.getProperty(FabricMySQLDriver.FABRIC_PASSWORD_PROPERTY_KEY);
this.reportErrors = Boolean.valueOf(props.getProperty(FabricMySQLDriver.FABRIC_REPORT_ERRORS_PROPERTY_KEY));
props.remove(FabricMySQLDriver.FABRIC_SHARD_KEY_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_SHARD_TABLE_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_SERVER_GROUP_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_PROTOCOL_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_USERNAME_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_PASSWORD_PROPERTY_KEY);
props.remove(FabricMySQLDriver.FABRIC_REPORT_ERRORS_PROPERTY_KEY);
this.host = props.getProperty(NonRegisteringDriver.HOST_PROPERTY_KEY);
this.port = props.getProperty(NonRegisteringDriver.PORT_PROPERTY_KEY);
this.username = props.getProperty(NonRegisteringDriver.USER_PROPERTY_KEY);
this.password = props.getProperty(NonRegisteringDriver.PASSWORD_PROPERTY_KEY);
this.database = props.getProperty(NonRegisteringDriver.DBNAME_PROPERTY_KEY);
if (this.username == null) {
this.username = "";
}
if (this.password == null) {
this.password = "";
}
// add our interceptor to pass exceptions back to the `interceptException' method
String exceptionInterceptors = props.getProperty("exceptionInterceptors");
if (exceptionInterceptors == null || "null".equals("exceptionInterceptors")) {
exceptionInterceptors = "";
} else {
exceptionInterceptors += ",";
}
exceptionInterceptors += "com.mysql.fabric.jdbc.ErrorReportingExceptionInterceptor";
props.setProperty("exceptionInterceptors", exceptionInterceptors);
initializeProperties(props);
// validation check of properties
if (this.fabricServerGroup != null && this.fabricShardTable != null) {
throw SQLError.createSQLException("Server group and shard table are mutually exclusive. Only one may be provided.",
SQLError.SQL_STATE_CONNECTION_REJECTED, null, getExceptionInterceptor(), this);
}
try {
String url = this.fabricProtocol + "://" + this.host + ":" + this.port;
this.fabricConnection = new FabricConnection(url, this.fabricUsername, this.fabricPassword);
} catch (FabricCommunicationException ex) {
throw SQLError.createSQLException("Unable to establish connection to the Fabric server", SQLError.SQL_STATE_CONNECTION_REJECTED, ex,
getExceptionInterceptor(), this);
}
setShardTable(this.fabricShardTable);
setShardKey(this.fabricShardKey);
setServerGroupName(this.fabricServerGroup);
log = LogFactory.getLogger(getLogger(), "FabricMySQLConnectionProxy", null);
}
示例7: initializeDriverProperties
import com.mysql.jdbc.log.LogFactory; //导入方法依赖的package包/类
/**
* Initializes driver properties that come from URL or properties passed to
* the driver manager.
*
* @param info
* DOCUMENT ME!
* @throws SQLException
* DOCUMENT ME!
*/
private void initializeDriverProperties(Properties info)
throws SQLException {
initializeProperties(info);
String exceptionInterceptorClasses = getExceptionInterceptors();
if (exceptionInterceptorClasses != null && !"".equals(exceptionInterceptorClasses)) {
this.exceptionInterceptor = new ExceptionInterceptorChain(exceptionInterceptorClasses);
}
this.usePlatformCharsetConverters = getUseJvmCharsetConverters();
this.log = LogFactory.getLogger(getLogger(), LOGGER_INSTANCE_NAME, getExceptionInterceptor());
if (getProfileSql() || getUseUsageAdvisor()) {
this.eventSink = ProfilerEventHandlerFactory.getInstance(getLoadBalanceSafeProxy());
}
if (getCachePreparedStatements()) {
createPreparedStatementCaches();
}
if (getNoDatetimeStringSync() && getUseTimezone()) {
throw SQLError.createSQLException(
"Can't enable noDatetimeStringSync and useTimezone configuration "
+ "properties at the same time",
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE, getExceptionInterceptor());
}
if (getCacheCallableStatements()) {
this.parsedCallableStatementCache = new LRUCache(
getCallableStatementCacheSize());
}
if (getAllowMultiQueries()) {
setCacheResultSetMetadata(false); // we don't handle this yet
}
if (getCacheResultSetMetadata()) {
this.resultSetMetadataCache = new LRUCache(
getMetadataCacheSize());
}
}
示例8: initializeDriverProperties
import com.mysql.jdbc.log.LogFactory; //导入方法依赖的package包/类
/**
* Initializes driver properties that come from URL or properties passed to
* the driver manager.
*
* @param info
* @throws SQLException
*/
private void initializeDriverProperties(Properties info) throws SQLException {
initializeProperties(info);
String exceptionInterceptorClasses = getExceptionInterceptors();
if (exceptionInterceptorClasses != null && !"".equals(exceptionInterceptorClasses)) {
this.exceptionInterceptor = new ExceptionInterceptorChain(exceptionInterceptorClasses);
}
this.usePlatformCharsetConverters = getUseJvmCharsetConverters();
this.log = LogFactory.getLogger(getLogger(), LOGGER_INSTANCE_NAME, getExceptionInterceptor());
if (getProfileSql() || getUseUsageAdvisor()) {
this.eventSink = ProfilerEventHandlerFactory.getInstance(getLoadBalanceSafeProxy());
}
if (getCachePreparedStatements()) {
createPreparedStatementCaches();
}
if (getNoDatetimeStringSync() && getUseTimezone()) {
throw SQLError.createSQLException("Can't enable noDatetimeStringSync and useTimezone configuration properties at the same time",
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE, getExceptionInterceptor());
}
if (getCacheCallableStatements()) {
this.parsedCallableStatementCache = new LRUCache(getCallableStatementCacheSize());
}
if (getAllowMultiQueries()) {
setCacheResultSetMetadata(false); // we don't handle this yet
}
if (getCacheResultSetMetadata()) {
this.resultSetMetadataCache = new LRUCache(getMetadataCacheSize());
}
if (getSocksProxyHost() != null) {
setSocketFactoryClassName("com.mysql.jdbc.SocksProxySocketFactory");
}
}
示例9: initializeDriverProperties
import com.mysql.jdbc.log.LogFactory; //导入方法依赖的package包/类
/**
* Initializes driver properties that come from URL or properties passed to
* the driver manager.
*
* @param info
* DOCUMENT ME!
* @throws SQLException
* DOCUMENT ME!
*/
private void initializeDriverProperties(Properties info)
throws SQLException {
initializeProperties(info);
String exceptionInterceptorClasses = getExceptionInterceptors();
if (exceptionInterceptorClasses != null && !"".equals(exceptionInterceptorClasses)) {
this.exceptionInterceptor = new ExceptionInterceptorChain(exceptionInterceptorClasses);
this.exceptionInterceptor.init(this, info);
}
this.usePlatformCharsetConverters = getUseJvmCharsetConverters();
this.log = LogFactory.getLogger(getLogger(), LOGGER_INSTANCE_NAME, getExceptionInterceptor());
if (getProfileSql() || getUseUsageAdvisor()) {
this.eventSink = ProfilerEventHandlerFactory.getInstance(getLoadBalanceSafeProxy());
}
if (getCachePreparedStatements()) {
createPreparedStatementCaches();
}
if (getNoDatetimeStringSync() && getUseTimezone()) {
throw SQLError.createSQLException(
"Can't enable noDatetimeStringSync and useTimezone configuration "
+ "properties at the same time",
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE, getExceptionInterceptor());
}
if (getCacheCallableStatements()) {
this.parsedCallableStatementCache = new LRUCache(
getCallableStatementCacheSize());
}
if (getAllowMultiQueries()) {
setCacheResultSetMetadata(false); // we don't handle this yet
}
if (getCacheResultSetMetadata()) {
this.resultSetMetadataCache = new LRUCache(
getMetadataCacheSize());
}
}