com.mysql.cj.log.Log Java Examples
The following examples show how to use
com.mysql.cj.log.Log.
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: ResultSetScannerInterceptor.java From FoxTelem with GNU General Public License v3.0 | 6 votes |
@Override public QueryInterceptor init(MysqlConnection conn, Properties props, Log log) { String regexFromUser = props.getProperty(PNAME_resultSetScannerRegex); if (regexFromUser == null || regexFromUser.length() == 0) { throw ExceptionFactory.createException(WrongArgumentException.class, Messages.getString("ResultSetScannerInterceptor.0")); } try { this.regexP = Pattern.compile(regexFromUser); } catch (Throwable t) { throw ExceptionFactory.createException(WrongArgumentException.class, Messages.getString("ResultSetScannerInterceptor.1"), t); } return this; }
Example #2
Source File: XAsyncSocketConnection.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public void connect(String hostName, int portNumber, PropertySet propSet, ExceptionInterceptor excInterceptor, Log log, int loginTimeout) { this.port = portNumber; this.host = hostName; this.propertySet = propSet; this.socketFactory = new AsyncSocketFactory(); // TODO reuse PNAME_socketFactory try { this.channel = this.socketFactory.connect(hostName, portNumber, propSet.exposeAsProperties(), loginTimeout); } catch (CJCommunicationsException e) { throw e; } catch (IOException | RuntimeException ex) { throw new CJCommunicationsException(ex); } }
Example #3
Source File: LoadBalancedAutoCommitInterceptor.java From FoxTelem with GNU General Public License v3.0 | 6 votes |
@Override public QueryInterceptor init(MysqlConnection connection, Properties props, Log log) { this.conn = (JdbcConnection) connection; String autoCommitSwapThresholdAsString = props.getProperty(PropertyKey.loadBalanceAutoCommitStatementThreshold.getKeyName(), "0"); try { this.matchingAfterStatementThreshold = Integer.parseInt(autoCommitSwapThresholdAsString); } catch (NumberFormatException nfe) { // nothing here, being handled in LoadBalancedConnectionProxy. } String autoCommitSwapRegex = props.getProperty(PropertyKey.loadBalanceAutoCommitStatementRegex.getKeyName(), ""); if (!"".equals(autoCommitSwapRegex)) { this.matchingAfterStatementRegex = autoCommitSwapRegex; } return this; }
Example #4
Source File: XAsyncSocketConnection.java From FoxTelem with GNU General Public License v3.0 | 6 votes |
@Override public void connect(String hostName, int portNumber, PropertySet propSet, ExceptionInterceptor excInterceptor, Log log, int loginTimeout) { this.port = portNumber; this.host = hostName; this.propertySet = propSet; this.socketFactory = new AsyncSocketFactory(); // TODO reuse PNAME_socketFactory try { this.channel = this.socketFactory.connect(hostName, portNumber, propSet, loginTimeout); } catch (CJCommunicationsException e) { throw e; } catch (IOException | RuntimeException ex) { throw new CJCommunicationsException(ex); } }
Example #5
Source File: CoreSession.java From lams with GNU General Public License v2.0 | 6 votes |
public CoreSession(HostInfo hostInfo, PropertySet propSet) { this.connectionCreationTimeMillis = System.currentTimeMillis(); this.hostInfo = hostInfo; this.propertySet = propSet; this.gatherPerfMetrics = getPropertySet().getBooleanReadableProperty(PropertyDefinitions.PNAME_gatherPerfMetrics); this.characterEncoding = getPropertySet().getModifiableProperty(PropertyDefinitions.PNAME_characterEncoding); this.useOldUTF8Behavior = getPropertySet().getBooleanReadableProperty(PropertyDefinitions.PNAME_useOldUTF8Behavior); this.disconnectOnExpiredPasswords = getPropertySet().getBooleanReadableProperty(PropertyDefinitions.PNAME_disconnectOnExpiredPasswords); this.cacheServerConfiguration = getPropertySet().getBooleanReadableProperty(PropertyDefinitions.PNAME_cacheServerConfiguration); this.autoReconnect = getPropertySet().<Boolean> getModifiableProperty(PropertyDefinitions.PNAME_autoReconnect); this.autoReconnectForPools = getPropertySet().getBooleanReadableProperty(PropertyDefinitions.PNAME_autoReconnectForPools); this.maintainTimeStats = getPropertySet().getBooleanReadableProperty(PropertyDefinitions.PNAME_maintainTimeStats); this.log = LogFactory.getLogger(getPropertySet().getStringReadableProperty(PropertyDefinitions.PNAME_logger).getStringValue(), Log.LOGGER_INSTANCE_NAME); if (getPropertySet().getBooleanReadableProperty(PropertyDefinitions.PNAME_profileSQL).getValue() || getPropertySet().getBooleanReadableProperty(PropertyDefinitions.PNAME_useUsageAdvisor).getValue()) { ProfilerEventHandlerFactory.getInstance(this); } }
Example #6
Source File: LoadBalancedAutoCommitInterceptor.java From lams with GNU General Public License v2.0 | 6 votes |
public QueryInterceptor init(MysqlConnection connection, Properties props, Log log) { this.conn = (JdbcConnection) connection; String autoCommitSwapThresholdAsString = props.getProperty(PropertyDefinitions.PNAME_loadBalanceAutoCommitStatementThreshold, "0"); try { this.matchingAfterStatementThreshold = Integer.parseInt(autoCommitSwapThresholdAsString); } catch (NumberFormatException nfe) { // nothing here, being handled in LoadBalancedConnectionProxy. } String autoCommitSwapRegex = props.getProperty(PropertyDefinitions.PNAME_loadBalanceAutoCommitStatementRegex, ""); if (!"".equals(autoCommitSwapRegex)) { this.matchingAfterStatementRegex = autoCommitSwapRegex; } return this; }
Example #7
Source File: CoreSession.java From FoxTelem with GNU General Public License v3.0 | 6 votes |
public CoreSession(HostInfo hostInfo, PropertySet propSet) { this.connectionCreationTimeMillis = System.currentTimeMillis(); this.hostInfo = hostInfo; this.propertySet = propSet; this.gatherPerfMetrics = getPropertySet().getBooleanProperty(PropertyKey.gatherPerfMetrics); this.characterEncoding = getPropertySet().getStringProperty(PropertyKey.characterEncoding); this.disconnectOnExpiredPasswords = getPropertySet().getBooleanProperty(PropertyKey.disconnectOnExpiredPasswords); this.cacheServerConfiguration = getPropertySet().getBooleanProperty(PropertyKey.cacheServerConfiguration); this.autoReconnect = getPropertySet().getBooleanProperty(PropertyKey.autoReconnect); this.autoReconnectForPools = getPropertySet().getBooleanProperty(PropertyKey.autoReconnectForPools); this.maintainTimeStats = getPropertySet().getBooleanProperty(PropertyKey.maintainTimeStats); this.log = LogFactory.getLogger(getPropertySet().getStringProperty(PropertyKey.logger).getStringValue(), Log.LOGGER_INSTANCE_NAME); if (getPropertySet().getBooleanProperty(PropertyKey.profileSQL).getValue() || getPropertySet().getBooleanProperty(PropertyKey.useUsageAdvisor).getValue()) { ProfilerEventHandlerFactory.getInstance(this); } }
Example #8
Source File: ExceptionInterceptorChain.java From lams with GNU General Public License v2.0 | 5 votes |
public ExceptionInterceptor init(Properties properties, Log log) { if (this.interceptors != null) { Iterator<ExceptionInterceptor> iter = this.interceptors.iterator(); while (iter.hasNext()) { iter.next().init(properties, log); } } return this; }
Example #9
Source File: ResultSetScannerInterceptor.java From lams with GNU General Public License v2.0 | 5 votes |
public QueryInterceptor init(MysqlConnection conn, Properties props, Log log) { String regexFromUser = props.getProperty(PropertyDefinitions.PNAME_resultSetScannerRegex); if (regexFromUser == null || regexFromUser.length() == 0) { throw ExceptionFactory.createException(WrongArgumentException.class, Messages.getString("ResultSetScannerInterceptor.0")); } try { this.regexP = Pattern.compile(regexFromUser); } catch (Throwable t) { throw ExceptionFactory.createException(WrongArgumentException.class, Messages.getString("ResultSetScannerInterceptor.1"), t); } return this; }
Example #10
Source File: ExceptionInterceptorChain.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
public ExceptionInterceptor init(Properties properties, Log log) { if (this.interceptors != null) { Iterator<ExceptionInterceptor> iter = this.interceptors.iterator(); while (iter.hasNext()) { iter.next().init(properties, log); } } return this; }
Example #11
Source File: TracingExceptionInterceptor.java From brave with Apache License 2.0 | 5 votes |
@Override public ExceptionInterceptor init(Properties properties, Log log) { String queryInterceptors = properties.getProperty("queryInterceptors"); if (queryInterceptors == null || !queryInterceptors.contains(TracingQueryInterceptor.class.getName())) { throw new IllegalStateException( "TracingQueryInterceptor must be enabled to use TracingExceptionInterceptor."); } return new TracingExceptionInterceptor(); }
Example #12
Source File: TracingQueryInterceptor.java From brave with Apache License 2.0 | 5 votes |
@Override public QueryInterceptor init(MysqlConnection mysqlConnection, Properties properties, Log log) { String exceptionInterceptors = properties.getProperty("exceptionInterceptors"); TracingQueryInterceptor interceptor = new TracingQueryInterceptor(); interceptor.connection = mysqlConnection; interceptor.interceptingExceptions = exceptionInterceptors != null && exceptionInterceptors.contains(TracingExceptionInterceptor.class.getName()); if (!interceptor.interceptingExceptions) { log.logWarn("TracingExceptionInterceptor not enabled. It is highly recommended to " + "enable it for error logging to Zipkin."); } return interceptor; }
Example #13
Source File: ReadAheadInputStream.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
public ReadAheadInputStream(InputStream toBuffer, int bufferSize, boolean debug, Log logTo) { this.underlyingStream = toBuffer; this.buf = new byte[bufferSize]; this.doDebug = debug; this.log = logTo; }
Example #14
Source File: ReadAheadInputStream.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
public ReadAheadInputStream(InputStream toBuffer, boolean debug, Log logTo) { this(toBuffer, DEFAULT_BUFFER_SIZE, debug, logTo); }
Example #15
Source File: NoSubInterceptorWrapper.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
public QueryInterceptor init(MysqlConnection conn, Properties props, Log log) { this.underlyingInterceptor.init(conn, props, log); return this; }
Example #16
Source File: ServerStatusDiffInterceptor.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
@Override public QueryInterceptor init(MysqlConnection conn, Properties props, Log l) { this.connection = (JdbcConnection) conn; this.log = l; return this; }
Example #17
Source File: ExceptionInterceptorChain.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
public ExceptionInterceptorChain(String interceptorClasses, Properties props, Log log) { this.interceptors = Util.<ExceptionInterceptor> loadClasses(interceptorClasses, "Connection.BadExceptionInterceptor", this).stream() .map(o -> o.init(props, log)).collect(Collectors.toList()); }
Example #18
Source File: BaseQueryInterceptor.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
public QueryInterceptor init(MysqlConnection conn, Properties props, Log log) { return this; }
Example #19
Source File: TracingPacketSender.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
public TracingPacketSender(MessageSender<NativePacketPayload> packetSender, Log log, String host, long serverThreadId) { this.packetSender = packetSender; this.host = host; this.serverThreadId = serverThreadId; this.log = log; }
Example #20
Source File: TestLifecycleInterceptor.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
public ConnectionLifecycleInterceptor init(MysqlConnection conn, Properties props, Log log) { return this; }
Example #21
Source File: NativeProtocol.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
public NativeProtocol(Log logger) { this.log = logger; this.metricsHolder = new BaseMetricsHolder(); }
Example #22
Source File: NativeProtocol.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
public static NativeProtocol getInstance(Session session, SocketConnection socketConnection, PropertySet propertySet, Log log, TransactionEventHandler transactionManager) { NativeProtocol protocol = new NativeProtocol(log); protocol.init(session, socketConnection, propertySet, transactionManager); return protocol; }
Example #23
Source File: TracingPacketReader.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
public TracingPacketReader(MessageReader<NativePacketHeader, NativePacketPayload> packetReader, Log log) { this.packetReader = packetReader; this.log = log; }
Example #24
Source File: AsyncMessageReaderTest.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
@Override public void connect(String host, int port, PropertySet propertySet, ExceptionInterceptor exceptionInterceptor, Log log, int loginTimeout) { }
Example #25
Source File: SimplePacketReaderTest.java From FoxTelem with GNU General Public License v3.0 | 4 votes |
public void connect(String host, int port, PropertySet propertySet, ExceptionInterceptor exceptionInterceptor, Log log, int loginTimeout) { }
Example #26
Source File: MySQLQueryInterceptor.java From core-ng-project with Apache License 2.0 | 4 votes |
@Override public QueryInterceptor init(MysqlConnection connection, Properties properties, Log log) { return this; }
Example #27
Source File: TracingPacketSender.java From lams with GNU General Public License v2.0 | 4 votes |
public TracingPacketSender(MessageSender<NativePacketPayload> packetSender, Log log, String host, long serverThreadId) { this.packetSender = packetSender; this.host = host; this.serverThreadId = serverThreadId; this.log = log; }
Example #28
Source File: NoSubInterceptorWrapper.java From lams with GNU General Public License v2.0 | 4 votes |
public QueryInterceptor init(MysqlConnection conn, Properties props, Log log) { this.underlyingInterceptor.init(conn, props, log); return this; }
Example #29
Source File: ReadAheadInputStream.java From lams with GNU General Public License v2.0 | 4 votes |
public ReadAheadInputStream(InputStream toBuffer, boolean debug, Log logTo) { this(toBuffer, DEFAULT_BUFFER_SIZE, debug, logTo); }
Example #30
Source File: ServerStatusDiffInterceptor.java From lams with GNU General Public License v2.0 | 4 votes |
public QueryInterceptor init(MysqlConnection conn, Properties props, Log l) { this.connection = (JdbcConnection) conn; this.log = l; return this; }