--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Fri Jun 26 17:08:14 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Fri Jun 26 17:49:17 2015 +0200
@@ -607,7 +607,7 @@
newFunctionNode.uniqueName(reservedName);
}
- final boolean info = log.levelFinerThanOrEqual(Level.INFO);
+ final boolean info = log.isLoggable(Level.INFO);
final DebugLogger timeLogger = env.isTimingEnabled() ? env._timing.getLogger() : null;
@@ -644,8 +644,8 @@
if (info) {
final StringBuilder sb = new StringBuilder("<< Finished compile job for ");
sb.append(newFunctionNode.getSource()).
- append(':').
- append(quote(newFunctionNode.getName()));
+ append(':').
+ append(quote(newFunctionNode.getName()));
if (time > 0L && timeLogger != null) {
assert env.isTimingEnabled();
@@ -713,7 +713,7 @@
if (cacheKey != null && env._persistent_cache) {
// If this is an on-demand compilation create a function initializer for the function being compiled.
// Otherwise use function initializer map generated by codegen.
- Map<Integer, FunctionInitializer> initializers = new HashMap<>();
+ final Map<Integer, FunctionInitializer> initializers = new HashMap<>();
if (isOnDemandCompilation()) {
initializers.put(functionNode.getId(), new FunctionInitializer(functionNode, getInvalidatedProgramPoints()));
} else {
@@ -829,9 +829,9 @@
final long totalSize = osc.calculateObjectSize(functionNode);
sb.append(phaseName).
- append(" Total size = ").
- append(totalSize / 1024 / 1024).
- append("MB");
+ append(" Total size = ").
+ append(totalSize / 1024 / 1024).
+ append("MB");
log.info(sb);
Collections.sort(list, new Comparator<ClassHistogramElement>() {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/lookup/MethodHandleFactory.java Fri Jun 26 17:08:14 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/lookup/MethodHandleFactory.java Fri Jun 26 17:49:17 2015 +0200
@@ -278,7 +278,7 @@
//if there is no logger, or if it's set to log only coarser events
//than the trace level, skip and return
- if (logger == null || logger.levelCoarserThan(level)) {
+ if (logger == null || !logger.isLoggable(level)) {
return mh;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/logging/DebugLogger.java Fri Jun 26 17:08:14 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/logging/DebugLogger.java Fri Jun 26 17:49:17 2015 +0200
@@ -99,10 +99,10 @@
final StringBuilder sb = new StringBuilder();
sb.append('[')
- .append(record.getLoggerName())
- .append("] ")
- .append(record.getMessage())
- .append('\n');
+ .append(record.getLoggerName())
+ .append("] ")
+ .append(record.getMessage())
+ .append('\n');
return sb.toString();
}
@@ -194,7 +194,7 @@
*/
public void indent(final int pos) {
if (isEnabled) {
- indent += pos * INDENT_SPACE;
+ indent += pos * INDENT_SPACE;
}
}
@@ -227,57 +227,14 @@
}
/**
- * Check if the logger is above the level of detail given
+ * Check if the event of given level will be logged.
* @see java.util.logging.Level
*
- * The higher the level, the more severe the warning
- *
- * @param level logging level
- * @return true if level is above the given one
- */
- public boolean levelCoarserThan(final Level level) {
- return getLevel().intValue() > level.intValue();
- }
-
- /**
- * Check if the logger is above or equal to the level
- * of detail given
- * @see java.util.logging.Level
- *
- * The higher the level, the more severe the warning
- *
* @param level logging level
- * @return true if level is above the given one
- */
- public boolean levelCoarserThanOrEqual(final Level level) {
- return getLevel().intValue() >= level.intValue();
- }
-
- /**
- * Check if the logger is below the level of detail given
- * @see java.util.logging.Level
- *
- * The higher the level, the more severe the warning
- *
- * @param level logging level
- * @return true if level is above the given one
+ * @return true if event of given level will be logged.
*/
- public boolean levelFinerThan(final Level level) {
- return getLevel().intValue() < level.intValue();
- }
-
- /**
- * Check if the logger is below or equal to the level
- * of detail given
- * @see java.util.logging.Level
- *
- * The higher the level, the more severe the warning
- *
- * @param level logging level
- * @return true if level is above the given one
- */
- public boolean levelFinerThanOrEqual(final Level level) {
- return getLevel().intValue() <= level.intValue();
+ public boolean isLoggable(final Level level) {
+ return logger.isLoggable(level);
}
/**
@@ -566,7 +523,7 @@
* @param str string to log
*/
public void log(final Level level, final String str) {
- if (isEnabled && !isQuiet) {
+ if (isEnabled && !isQuiet && logger.isLoggable(level)) {
final StringBuilder sb = new StringBuilder();
for (int i = 0 ; i < indent ; i++) {
sb.append(' ');
@@ -584,7 +541,7 @@
* @param objs objects for which to invoke toString and concatenate to log
*/
public void log(final Level level, final Object... objs) {
- if (isEnabled && !isQuiet) {
+ if (isEnabled && !isQuiet && logger.isLoggable(level)) {
final StringBuilder sb = new StringBuilder();
for (final Object obj : objs) {
sb.append(obj);