ARTEMIS-3092 inconsistent JDBC config logging

This commit is contained in:
Justin Bertram 2021-02-02 14:07:28 -06:00 committed by Clebert Suconic
parent 4b314e2aab
commit b4f8aada3c
3 changed files with 12 additions and 10 deletions

View File

@ -16,8 +16,8 @@
*/ */
package org.apache.activemq.artemis.jdbc.store.drivers; package org.apache.activemq.artemis.jdbc.store.drivers;
import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.beanutils.PropertyUtils;
import org.jboss.logging.Logger;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.util.Map; import java.util.Map;
@ -25,13 +25,12 @@ import java.util.stream.Collectors;
public class JDBCDataSourceUtils { public class JDBCDataSourceUtils {
private static final Logger logger = Logger.getLogger(JDBCDataSourceUtils.class);
public static DataSource getDataSource(String dataSourceClassName, Map<String, Object> dataSourceProperties) { public static DataSource getDataSource(String dataSourceClassName, Map<String, Object> dataSourceProperties) {
logger.info(new StringBuilder("Initialising JDBC data source: ").append(dataSourceClassName).append(" ") ActiveMQJournalLogger.LOGGER.initializingJdbcDataSource(dataSourceClassName, dataSourceProperties
.append(dataSourceProperties.keySet().stream() .keySet()
.stream()
.map(key -> key + "=" + dataSourceProperties.get(key)) .map(key -> key + "=" + dataSourceProperties.get(key))
.collect(Collectors.joining(", ", "{", "}")))); .collect(Collectors.joining(", ", "{", "}")));
try { try {
DataSource dataSource = (DataSource) Class.forName(dataSourceClassName).newInstance(); DataSource dataSource = (DataSource) Class.forName(dataSourceClassName).newInstance();
for (Map.Entry<String, Object> entry : dataSourceProperties.entrySet()) { for (Map.Entry<String, Object> entry : dataSourceProperties.entrySet()) {

View File

@ -85,6 +85,10 @@ public interface ActiveMQJournalLogger extends BasicLogger {
@Message(id = 141009, value = "A Free File is less than the maximum data", format = Message.Format.MESSAGE_FORMAT) @Message(id = 141009, value = "A Free File is less than the maximum data", format = Message.Format.MESSAGE_FORMAT)
void fileTooSmall(); void fileTooSmall();
@LogMessage(level = Logger.Level.INFO)
@Message(id = 141010, value = "Initialising JDBC data source {0} with properties {1}", format = Message.Format.MESSAGE_FORMAT)
void initializingJdbcDataSource(String dataSourceClassName, String dataSourceProperties);
@LogMessage(level = Logger.Level.WARN) @LogMessage(level = Logger.Level.WARN)
@Message(id = 142000, value = "You have a native library with a different version than expected", format = Message.Format.MESSAGE_FORMAT) @Message(id = 142000, value = "You have a native library with a different version than expected", format = Message.Format.MESSAGE_FORMAT)
void incompatibleNativeLibrary(); void incompatibleNativeLibrary();

View File

@ -1739,13 +1739,12 @@ public class ConfigurationImpl implements Configuration, Serializable {
sb.append("clustered=").append(isClustered()).append(","); sb.append("clustered=").append(isClustered()).append(",");
if (isJDBC()) { if (isJDBC()) {
DatabaseStorageConfiguration dsc = (DatabaseStorageConfiguration) getStoreConfiguration(); DatabaseStorageConfiguration dsc = (DatabaseStorageConfiguration) getStoreConfiguration();
sb.append("jdbcDriverClassName=").append(dsc.getJdbcDriverClassName()).append(","); sb.append("jdbcDriverClassName=").append(dsc.getDataSourceProperty("driverClassName")).append(",");
sb.append("jdbcConnectionUrl=").append(dsc.getJdbcConnectionUrl()).append(","); sb.append("jdbcConnectionUrl=").append(dsc.getDataSourceProperty("url")).append(",");
sb.append("messageTableName=").append(dsc.getMessageTableName()).append(","); sb.append("messageTableName=").append(dsc.getMessageTableName()).append(",");
sb.append("bindingsTableName=").append(dsc.getBindingsTableName()).append(","); sb.append("bindingsTableName=").append(dsc.getBindingsTableName()).append(",");
sb.append("largeMessageTableName=").append(dsc.getLargeMessageTableName()).append(","); sb.append("largeMessageTableName=").append(dsc.getLargeMessageTableName()).append(",");
sb.append("pageStoreTableName=").append(dsc.getPageStoreTableName()).append(","); sb.append("pageStoreTableName=").append(dsc.getPageStoreTableName()).append(",");
} else { } else {
sb.append("journalDirectory=").append(journalDirectory).append(","); sb.append("journalDirectory=").append(journalDirectory).append(",");
sb.append("bindingsDirectory=").append(bindingsDirectory).append(","); sb.append("bindingsDirectory=").append(bindingsDirectory).append(",");