0

showLogName overrides showShortLogName

This commit is contained in:
rjenkinsjr
2016-03-31 19:50:04 -04:00
parent a861371a94
commit cc06b83c11
2 changed files with 24 additions and 16 deletions

View File

@@ -98,14 +98,18 @@ import org.yaml.snakeyaml.Yaml;
* defaults to <code>false</code>.</li> * defaults to <code>false</code>.</li>
* *
* <li><code>slf4j.showLogName</code> - Set to <code>true</code> if you want the * <li><code>slf4j.showLogName</code> - Set to <code>true</code> if you want the
* logger instance name to be included in output messages. If unspecified or * logger instance name (wrapped in curly braces) to be included in output
* given any other value, defaults to <code>false</code>.</li> * messages. If unspecified or given any other value, defaults to
* <code>false</code>. If this option is <code>true</code>, it overrides
* <code>slf4j.showShortLogName</code>.</li>
* *
* <li><code>slf4j.showShortLogName</code> - Set to <code>true</code> if you * <li><code>slf4j.showShortLogName</code> - Set to <code>true</code> if you
* want the logger instance's short name to be included in output messages. The * want the logger instance's short name (wrapped in curly braces) to be
* short name is equal to the full name with every dot-separated portion of the * included in output messages. The short name is equal to the full name with
* full name (except the last portion) truncated to its first character. If * every dot-separated portion of the full name (except the last portion)
* unspecified or given any other value, defaults to <code>true</code>.</li> * truncated to its first character. If unspecified or given any other value,
* defaults to <code>true</code>. This option is ignored if
* <code>slf4j.showLogName</code> is <code>true</code>.</li>
* </ul> * </ul>
* *
* <p> * <p>
@@ -810,13 +814,13 @@ public final class BukkitPluginLoggerAdapter extends MarkerIgnoringBase {
} }
// Append the name of the log instance if so configured // Append the name of the log instance if so configured
if (BukkitPluginLoggerAdapter.CONFIG_VALUE_SHOW_SHORT_LOG_NAME) { if (BukkitPluginLoggerAdapter.CONFIG_VALUE_SHOW_LOG_NAME) {
buf.append('{').append(this.name).append("} ");
} else if (BukkitPluginLoggerAdapter.CONFIG_VALUE_SHOW_SHORT_LOG_NAME) {
if (this.shortLogName == null) { if (this.shortLogName == null) {
this.shortLogName = this.computeShortName(); this.shortLogName = this.computeShortName();
} }
buf.append(String.valueOf(this.shortLogName)).append(" - "); buf.append('{').append(this.shortLogName).append("} ");
} else if (BukkitPluginLoggerAdapter.CONFIG_VALUE_SHOW_LOG_NAME) {
buf.append(String.valueOf(this.name)).append(" - ");
} }
// Append the message // Append the message

View File

@@ -55,16 +55,20 @@ slf4j:
# If not specified or given an invalid value, defaults to "false". # If not specified or given an invalid value, defaults to "false".
showThreadName: false showThreadName: false
# Shows the full logger name (e.g. "info.ronjenkins.bukkit.MyPlugin"). # Shows the full logger name (e.g. "info.ronjenkins.bukkit.MyPlugin"),
# wrapped in curly braces.
# #
# If not specified or given an invalid value, defaults to "false". # If not specified or given an invalid value, defaults to "false". If true,
# this overrides "slf4j.showShortLogName".
showLogName: false showLogName: false
# Shows the short logger name, which is the short Java package name format # Shows the short logger name, wrapped in curly braces. The short logger name
# (e.g. a logger named "info.ronjenkins.bukkit.MyPlugin" would have a short # is the short Java package name format (e.g. a logger named
# name of "i.r.b.MyPlugin". # "info.ronjenkins.bukkit.MyPlugin" would have a short name of
# "i.r.b.MyPlugin").
# #
# If not specified or given an invalid value, defaults to "true". # If not specified or given an invalid value, defaults to "true". If
# "slf4j.showLogName" is true, this option is ignored.
showShortLogName: true showShortLogName: true
# This section controls logging levels for individual loggers. # This section controls logging levels for individual loggers.