Java Code Examples for java.sql.DriverManager#getLogWriter()

The following examples show how to use java.sql.DriverManager#getLogWriter() . 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: Logger.java    From spanner-jdbc with MIT License 6 votes vote down vote up
public void log(String str, Throwable t) {
  PrintWriter writer = DriverManager.getLogWriter();
  if (writer == null) {
    return;
  }

  synchronized (this) {
    buffer.setLength(0);
    dateFormat.format(new Date(), buffer, dummyPosition);
    buffer.append(connectionIDString);
    buffer.append(str);

    // synchronize to ensure that the exception (if any) does
    // not get split up from the corresponding log message
    synchronized (writer) {
      writer.println(buffer.toString());
      if (t != null) {
        t.printStackTrace(writer);
      }
    }
    writer.flush();
  }
}
 
Example 2
Source File: SimpleDataSource.java    From sqlhelper with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public PrintWriter getLogWriter() throws SQLException {
    return DriverManager.getLogWriter();
}
 
Example 3
Source File: SimpleDataSource.java    From oxygen with Apache License 2.0 4 votes vote down vote up
@Override
public PrintWriter getLogWriter() {
  return DriverManager.getLogWriter();
}
 
Example 4
Source File: UnpooledDataSource.java    From ZhihuSpider with MIT License 4 votes vote down vote up
public PrintWriter getLogWriter() throws SQLException {
	return DriverManager.getLogWriter();
}
 
Example 5
Source File: CsvDriver.java    From jdbc-driver-csv with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static void writeLog(String message) {
    PrintWriter logWriter = DriverManager.getLogWriter();
    if (logWriter != null) {
        logWriter.println(CsvDriver.class.getPackage().getName() + ": " + message);
    }
}
 
Example 6
Source File: PooledDataSource.java    From mybaties with Apache License 2.0 4 votes vote down vote up
@Override
public PrintWriter getLogWriter() throws SQLException {
  return DriverManager.getLogWriter();
}
 
Example 7
Source File: UnpooledDataSource.java    From mybaties with Apache License 2.0 4 votes vote down vote up
@Override
public PrintWriter getLogWriter() throws SQLException {
  return DriverManager.getLogWriter();
}
 
Example 8
Source File: SimpleDataSource.java    From vibur-dbcp with Apache License 2.0 4 votes vote down vote up
@Override
public PrintWriter getLogWriter() throws SQLException {
    return DriverManager.getLogWriter();
}
 
Example 9
Source File: CassandraDataSource.java    From cassandra-jdbc-wrapper with Apache License 2.0 4 votes vote down vote up
public PrintWriter getLogWriter()
{
    return DriverManager.getLogWriter();
}
 
Example 10
Source File: PooledDataSource.java    From mybatis with Apache License 2.0 4 votes vote down vote up
@Override
public PrintWriter getLogWriter() throws SQLException {
  return DriverManager.getLogWriter();
}
 
Example 11
Source File: UnpooledDataSource.java    From mybatis with Apache License 2.0 4 votes vote down vote up
@Override
public PrintWriter getLogWriter() throws SQLException {
  return DriverManager.getLogWriter();
}