cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [3/3] cayenne git commit: CAY-2010 DataSourceBuilder to help users create pooling and non-pooling DataSources
Date Tue, 19 May 2015 09:19:26 GMT
CAY-2010 DataSourceBuilder to help users create pooling and non-pooling DataSources

* single-line connection log


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/79a66d80
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/79a66d80
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/79a66d80

Branch: refs/heads/master
Commit: 79a66d803f0f74b58a67cbbab45bb46a97baa0e9
Parents: 246aae9
Author: aadamchik <aadamchik@apache.org>
Authored: Tue May 19 11:42:20 2015 +0300
Committer: aadamchik <aadamchik@apache.org>
Committed: Tue May 19 12:15:50 2015 +0300

----------------------------------------------------------------------
 .../apache/cayenne/datasource/DriverDataSource.java  | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/79a66d80/cayenne-server/src/main/java/org/apache/cayenne/datasource/DriverDataSource.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/datasource/DriverDataSource.java
b/cayenne-server/src/main/java/org/apache/cayenne/datasource/DriverDataSource.java
index 92cdad1..d8f960b 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/datasource/DriverDataSource.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/datasource/DriverDataSource.java
@@ -127,6 +127,7 @@ public class DriverDataSource implements DataSource {
 	 * Returns a new database connection, using preconfigured data to locate the
 	 * database and obtain a connection.
 	 */
+	@Override
 	public Connection getConnection() throws SQLException {
 		// login with internal credentials
 		return getConnection(userName, password);
@@ -136,6 +137,7 @@ public class DriverDataSource implements DataSource {
 	 * Returns a new database connection using provided credentials to login to
 	 * the database.
 	 */
+	@Override
 	public Connection getConnection(String userName, String password) throws SQLException {
 		try {
 
@@ -175,29 +177,28 @@ public class DriverDataSource implements DataSource {
 
 	private void logConnect(String url, String userName, String password) {
 		if (LOGGER.isInfoEnabled()) {
-			StringBuilder buf = new StringBuilder("Opening connection: ");
-
-			// append URL on the same line to make log somewhat grep-friendly
-			buf.append(url);
-			buf.append("\n\tLogin: ").append(userName);
-			buf.append("\n\tPassword: *******");
-
+			StringBuilder buf = new StringBuilder("Connecting to '").append(url).append("' as '").append(userName)
+					.append("'");
 			LOGGER.info(buf.toString());
 		}
 	}
 
+	@Override
 	public int getLoginTimeout() throws SQLException {
 		return -1;
 	}
 
+	@Override
 	public void setLoginTimeout(int seconds) throws SQLException {
 		// noop
 	}
 
+	@Override
 	public PrintWriter getLogWriter() throws SQLException {
 		return DriverManager.getLogWriter();
 	}
 
+	@Override
 	public void setLogWriter(PrintWriter out) throws SQLException {
 		DriverManager.setLogWriter(out);
 	}


Mime
View raw message