GUACAMOLE-641: Log creation of new database connections.

This commit is contained in:
Michael Jumper
2021-06-21 14:43:19 -07:00
parent ca443c8a34
commit 6ef951cd61

View File

@@ -28,6 +28,8 @@ import java.util.Properties;
import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.GuacamoleException;
import org.apache.ibatis.datasource.pooled.PooledDataSource; import org.apache.ibatis.datasource.pooled.PooledDataSource;
import org.apache.ibatis.datasource.unpooled.UnpooledDataSource; import org.apache.ibatis.datasource.unpooled.UnpooledDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Pooled DataSource implementation which dynamically retrieves the database * Pooled DataSource implementation which dynamically retrieves the database
@@ -37,6 +39,11 @@ import org.apache.ibatis.datasource.unpooled.UnpooledDataSource;
@Singleton @Singleton
public class DynamicallyAuthenticatedDataSource extends PooledDataSource { public class DynamicallyAuthenticatedDataSource extends PooledDataSource {
/**
* Logger for this class.
*/
private static final Logger logger = LoggerFactory.getLogger(DynamicallyAuthenticatedDataSource.class);
/** /**
* Creates a new DynamicallyAuthenticatedDataSource which dynamically * Creates a new DynamicallyAuthenticatedDataSource which dynamically
* retrieves database credentials from the given JDBCEnvironment each time * retrieves database credentials from the given JDBCEnvironment each time
@@ -63,6 +70,7 @@ public class DynamicallyAuthenticatedDataSource extends PooledDataSource {
@Override @Override
public Connection getConnection() throws SQLException { public Connection getConnection() throws SQLException {
try { try {
logger.debug("Creating new database connection for pool.");
return super.getConnection(environment.getUsername(), environment.getPassword()); return super.getConnection(environment.getUsername(), environment.getPassword());
} }
catch (GuacamoleException e) { catch (GuacamoleException e) {