For debug and trace levels, either added isEnabled check or made arguments parameterized. (#1028)

This commit is contained in:
Koen De Groote
2017-05-21 21:50:13 +12:00
committed by Rob Bygrave
parent d0c1ae76f4
commit 9e2923f571
15 changed files with 27 additions and 18 deletions
+1 -1
View File
@@ -154,7 +154,7 @@ public final class Ebean {
} else {
// look to see if there is a default server defined
String defaultName = PrimaryServer.getDefaultServerName();
logger.debug("defaultName:" + defaultName);
logger.debug("defaultName:{}", defaultName);
if (defaultName != null && !defaultName.trim().isEmpty()) {
defaultServer = getWithCreate(defaultName.trim());
}
@@ -91,7 +91,7 @@ final class PropertyExpression {
// in which properties are being set/loaded. You can use
// GlobalProperties.evaluateExpressions() to get any unresolved
// expressions to be evaluated
logger.debug("Unable to evaluate expression [" + exp + "]");
logger.debug("Unable to evaluate expression [{}]", exp);
return null;
}
}
@@ -112,7 +112,7 @@ final class PropertyMapLoader {
otherProps = otherProps.replace("\\", "/");
InputStream is = findInputStream(otherProps);
if (is != null) {
logger.debug("loading properties from " + otherProps);
logger.debug("loading properties from {}", otherProps);
load(p, is);
} else {
logger.error("load.properties " + otherProps + " not found.");
@@ -135,12 +135,12 @@ final class PropertyMapLoader {
File f = new File(fileName);
if (f.exists()) {
logger.debug(fileName + " found in file system");
logger.debug("{} found in file system", fileName);
return new FileInputStream(f);
} else {
InputStream in = findInClassPath(fileName);
if (in != null) {
logger.debug(fileName + " found in classpath");
logger.debug("{} found in classpath", fileName);
}
return in;
}
@@ -23,6 +23,7 @@ public final class InternString {
return null;
}
//noinspection SynchronizationOnStaticField
synchronized (map) {
String v = map.get(s);
if (v != null) {
@@ -73,7 +73,7 @@ class ManifestReader {
* Collect each individual package splitting by delimiters.
*/
private void add(String packages) {
String[] split = packages.split(",|;| ");
String[] split = packages.split("[,; ]");
for (String aSplit : split) {
String pkg = aSplit.trim();
if (!pkg.isEmpty()) {
@@ -626,7 +626,7 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
int lc = persistListenerManager.getRegisterCount();
int fc = beanFinderManager.getRegisterCount();
logger.debug("BeanPersistControllers[" + cc + "] BeanFinders[" + fc + "] BeanPersistListeners[" + lc + "] BeanQueryAdapters[" + qa + "] BeanPostLoaders[" + pl + "] BeanPostConstructors[" + pc + "]");
logger.debug("BeanPersistControllers[{}] BeanFinders[{}] BeanPersistListeners[{}] BeanQueryAdapters[{}] BeanPostLoaders[{}] BeanPostConstructors[{}]", cc, fc, lc, qa, pl, pc);
}
private void logStatus() {
@@ -1239,7 +1239,7 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
if (desc.getIdType() == null) {
if (desc.isPrimaryKeyCompoundOrNonNumeric()) {
// assuming that this is a user supplied key like ISO country code or ISO currency code or lookup table code
logger.debug("Expecting user defined identity on " + desc.getFullName() + " - not using db sequence or autoincrement");
logger.debug("Expecting user defined identity on {} - not using db sequence or autoincrement", desc.getFullName());
desc.setIdType(IdType.EXTERNAL);
return;
}
@@ -1263,7 +1263,7 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
String seqName = desc.getIdGeneratorName();
if (seqName != null) {
logger.debug("explicit sequence " + seqName + " on " + desc.getFullName());
logger.debug("explicit sequence {} on {}", seqName, desc.getFullName());
} else {
String primaryKeyColumn = desc.getSinglePrimaryKeyColumn();
// use namingConvention to define sequence name
@@ -32,7 +32,7 @@ public class BeanFinderManager {
for (BeanFindController c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanFindController on[" + deployDesc.getFullName() + "] " + c.getClass().getName());
logger.debug("BeanFindController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
deployDesc.setBeanFinder(c);
}
}
@@ -33,7 +33,7 @@ public class BeanQueryAdapterManager {
for (BeanQueryAdapter c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanQueryAdapter on[" + deployDesc.getFullName() + "] " + c.getClass().getName());
logger.debug("BeanQueryAdapter on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
deployDesc.addQueryAdapter(c);
}
}
@@ -33,7 +33,7 @@ public class PersistControllerManager {
for (BeanPersistController c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanPersistController on[" + deployDesc.getFullName() + "] " + c.getClass().getName());
logger.debug("BeanPersistController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
deployDesc.addPersistController(c);
}
}
@@ -32,7 +32,7 @@ public class PostConstructManager {
for (BeanPostConstructListener c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanPostLoad on[" + deployDesc.getFullName() + "] " + c.getClass().getName());
logger.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
deployDesc.addPostConstructListener(c);
}
}
@@ -32,7 +32,7 @@ public class PostLoadManager {
for (BeanPostLoad c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanPostLoad on[" + deployDesc.getFullName() + "] " + c.getClass().getName());
logger.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
deployDesc.addPostLoad(c);
}
}
@@ -202,7 +202,7 @@ public class DeployUtil {
} else {
// this is ok...
logger.trace("... transient property " + msg);
logger.trace("... transient property {}", msg);
return null;
}
} catch (IllegalArgumentException e) {
@@ -57,6 +57,7 @@ public final class ShutdownManager {
* Return true if the system is in the process of stopping.
*/
public static boolean isStopping() {
//noinspection SynchronizationOnStaticField
synchronized (servers) {
return stopping;
}
@@ -74,6 +75,7 @@ public final class ShutdownManager {
* </p>
*/
public static void deregisterShutdownHook() {
//noinspection SynchronizationOnStaticField
synchronized (servers) {
try {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
@@ -89,6 +91,7 @@ public final class ShutdownManager {
* Register the shutdown hook with the Runtime.
*/
protected static void registerShutdownHook() {
//noinspection SynchronizationOnStaticField
synchronized (servers) {
try {
String value = System.getProperty("ebean.registerShutdownHook");
@@ -110,6 +113,7 @@ public final class ShutdownManager {
* </p>
*/
public static void shutdown() {
//noinspection SynchronizationOnStaticField
synchronized (servers) {
if (stopping) {
// Already run shutdown...
@@ -175,6 +179,7 @@ public final class ShutdownManager {
* Register an ebeanServer to be shutdown when the JVM is shutdown.
*/
public static void registerEbeanServer(SpiEbeanServer server) {
//noinspection SynchronizationOnStaticField
synchronized (servers) {
servers.add(server);
}
@@ -187,6 +192,7 @@ public final class ShutdownManager {
* </p>
*/
public static void unregisterEbeanServer(SpiEbeanServer server) {
//noinspection SynchronizationOnStaticField
synchronized (servers) {
servers.remove(server);
}
@@ -227,7 +227,9 @@ public class JtaTransactionManager implements ExternalTransactionManager {
break;
default:
logger.debug("Jta Txn [" + transaction.getId() + "] status:" + status);
if (logger.isDebugEnabled()) {
logger.debug("Jta Txn [" + transaction.getId() + "] status:" + status);
}
}
}
@@ -713,7 +713,7 @@ public final class DefaultTypeManager implements TypeManager {
ScalarTypeConverter converter = foundType.newInstance();
ScalarTypeWrapper stw = new ScalarTypeWrapper(logicalType, wrappedType, converter);
logger.debug("Register ScalarTypeWrapper from " + logicalType + " -> " + persistType + " using:" + foundType);
logger.debug("Register ScalarTypeWrapper from {} -> {} using:{}", logicalType, persistType, foundType);
add(stw);
} catch (Exception e) {
@@ -745,7 +745,7 @@ public final class DefaultTypeManager implements TypeManager {
AttributeConverter converter = foundType.newInstance();
ScalarTypeWrapper stw = new ScalarTypeWrapper(logicalType, wrappedType, new AttributeConverterAdapter(converter));
logger.debug("Register ScalarTypeWrapper from " + logicalType + " -> " + persistType + " using:" + foundType);
logger.debug("Register ScalarTypeWrapper from {} -> {} using:{}", logicalType, persistType, foundType);
add(stw);
} catch (Exception e) {