Added isXXXEnabled for logging statements

Guarded the logging statements which do concatenation of strings
or calling toString on objects. When a log level isn't enabled
this still would produce garbage that would need to be collected.

Guarded all logging up to info, warn and error can be assumed to be
enabled on a production system.
This commit is contained in:
Marten Deinum
2020-12-03 15:58:53 +01:00
committed by Mahmoud Ben Hassine
parent 718837fad3
commit 737f6ace13
30 changed files with 175 additions and 102 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2018 the original author or authors.
* Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -144,7 +144,7 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean {
jdbcTemplate.execute(trimmedScript);
}
catch (DataAccessException e) {
if (this.ignoreFailedDrop && trimmedScript.toLowerCase().startsWith("drop")) {
if (this.ignoreFailedDrop && trimmedScript.toLowerCase().startsWith("drop") && logger.isDebugEnabled()) {
logger.debug("DROP script failed (ignoring): " + trimmedScript);
}
else {