mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Use AppLog and System.Logger for logging - static imports
This commit is contained in:
@@ -4,7 +4,8 @@ import io.avaje.applog.AppLog;
|
||||
import io.ebeaninternal.api.SpiLogger;
|
||||
import io.ebeaninternal.api.SpiLoggerFactory;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.TRACE;
|
||||
|
||||
/**
|
||||
* Create a logger that captures the SQL and register it for later access in tests.
|
||||
@@ -33,22 +34,22 @@ public class CapturingLoggerFactory implements SpiLoggerFactory {
|
||||
|
||||
@Override
|
||||
public boolean isDebug() {
|
||||
return logger.isLoggable(Level.DEBUG);
|
||||
return logger.isLoggable(DEBUG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTrace() {
|
||||
return logger.isLoggable(Level.TRACE);
|
||||
return logger.isLoggable(TRACE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(String msg) {
|
||||
logger.log(Level.DEBUG, msg);
|
||||
logger.log(DEBUG, msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trace(String msg) {
|
||||
logger.log(Level.TRACE, msg);
|
||||
logger.log(TRACE, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,11 @@ import io.ebean.test.config.platform.PlatformAutoConfig;
|
||||
import io.ebean.test.config.provider.ProviderAutoConfig;
|
||||
import io.ebean.test.containers.DockerHost;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.Properties;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.INFO;
|
||||
|
||||
/**
|
||||
* Automatically configure ServerConfig for testing purposes.
|
||||
* <p>
|
||||
@@ -38,7 +40,7 @@ public class AutoConfigureForTesting implements AutoConfigure {
|
||||
io.avaje.config.Config.asConfiguration().evalModify(properties);
|
||||
}
|
||||
if (!config.isDefaultServer()) {
|
||||
log.log(Level.INFO, "skip automatic testing config on non-default server name:{0} register:{1}", config.getName(), config.isRegister());
|
||||
log.log(INFO, "skip automatic testing config on non-default server name:{0} register:{1}", config.getName(), config.isRegister());
|
||||
return;
|
||||
}
|
||||
if (isExtraServer(config, properties)) {
|
||||
@@ -46,7 +48,7 @@ public class AutoConfigureForTesting implements AutoConfigure {
|
||||
return;
|
||||
}
|
||||
String testPlatform = properties.getProperty("ebean.test.platform");
|
||||
log.log(Level.DEBUG, "automatic testing config - with ebean.test.platform:{0} name:{1} environmentDb:{2}", testPlatform, config.getName(), environmentDb);
|
||||
log.log(DEBUG, "automatic testing config - with ebean.test.platform:{0} name:{1} environmentDb:{2}", testPlatform, config.getName(), environmentDb);
|
||||
if (RunOnceMarker.isRun()) {
|
||||
setupPlatform(environmentDb, config);
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@ import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.datasource.DataSourceConfig;
|
||||
import io.ebean.test.containers.DockerHost;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.Properties;
|
||||
|
||||
import static java.lang.System.Logger.Level.INFO;
|
||||
|
||||
/**
|
||||
* Config for a database / datasource with associated DDL mode and Docker configuration.
|
||||
*/
|
||||
@@ -193,8 +194,7 @@ class Config {
|
||||
ds.setDriver(driverClass);
|
||||
config.setDataSourceConfig(ds);
|
||||
|
||||
log.log(Level.INFO, "Using jdbc settings - username:{0} url:{1} driver:{2}", ds.getUsername(), ds.getUrl(), ds.getDriver());
|
||||
|
||||
log.log(INFO, "Using jdbc settings - username:{0} url:{1} driver:{2}", ds.getUsername(), ds.getUrl(), ds.getDriver());
|
||||
if (driverClass != null) {
|
||||
try {
|
||||
Class.forName(driverClass);
|
||||
|
||||
@@ -4,11 +4,11 @@ import io.avaje.applog.AppLog;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.test.containers.ContainerFactory;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
import static java.util.concurrent.CompletableFuture.allOf;
|
||||
import static java.util.concurrent.CompletableFuture.runAsync;
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PlatformAutoConfig {
|
||||
|
||||
Config config = new Config(db, platform, databaseName, this.config);
|
||||
platformSetup.setupExtraDbDataSource(config);
|
||||
log.log(Level.DEBUG, "configured dataSource for extraDb name:{0} url:{1}", db, this.config.getDataSourceConfig().getUrl());
|
||||
log.log(DEBUG, "configured dataSource for extraDb name:{0} url:{1}", db, this.config.getDataSourceConfig().getUrl());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,9 +92,9 @@ public class PlatformAutoConfig {
|
||||
Properties dockerProperties = platformSetup.setup(config);
|
||||
if (!dockerProperties.isEmpty()) {
|
||||
if (isDebug()) {
|
||||
log.log(Level.INFO, "Docker properties: {0}", dockerProperties);
|
||||
log.log(INFO, "Docker properties: {0}", dockerProperties);
|
||||
} else {
|
||||
log.log(Level.DEBUG, "Docker properties: {0}", dockerProperties);
|
||||
log.log(DEBUG, "Docker properties: {0}", dockerProperties);
|
||||
}
|
||||
// start the docker container with appropriate configuration
|
||||
new ContainerFactory(dockerProperties, config.getDockerPlatform()).startContainers();
|
||||
@@ -130,7 +130,7 @@ public class PlatformAutoConfig {
|
||||
}
|
||||
this.platformSetup = KNOWN_PLATFORMS.get(platform);
|
||||
if (platformSetup == null) {
|
||||
log.log(Level.WARNING, "unknown platform {0} - skipping platform setup", platform);
|
||||
log.log(WARNING, "unknown platform {0} - skipping platform setup", platform);
|
||||
}
|
||||
return platformSetup != null;
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@ import io.ebean.config.CurrentUserProvider;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.config.EncryptKeyManager;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.Properties;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.INFO;
|
||||
|
||||
/**
|
||||
* Auto configuration of User and Tenant providers and Encrypt key manager for testing purposes.
|
||||
*/
|
||||
@@ -44,12 +46,12 @@ public class ProviderAutoConfig {
|
||||
if (keyManager == null) {
|
||||
// Must be 16 Chars for Oracle function
|
||||
String keyVal = properties.getProperty("ebean.test.encryptKey", "simple0123456789");
|
||||
log.log(Level.DEBUG, "for testing - using FixedEncryptKeyManager() keyVal:{0}", keyVal);
|
||||
log.log(DEBUG, "for testing - using FixedEncryptKeyManager() keyVal:{0}", keyVal);
|
||||
config.setEncryptKeyManager(new FixedEncryptKeyManager(keyVal));
|
||||
}
|
||||
|
||||
if (providerSetFlag > 0) {
|
||||
log.log(Level.INFO, msg(providerSetFlag));
|
||||
log.log(INFO, msg(providerSetFlag));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user