Skip to content

Commit

Permalink
Issue #4567 - Applying fixes from PR #4570 review
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
  • Loading branch information
joakime committed Feb 20, 2020
1 parent 5df8b05 commit 16230e6
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ public static void setTagPad(int pad)
__threadNamePadding = pad;
}

@SuppressWarnings("UnusedAssignment")
private int _level = LEVEL_INFO;
// Level that this Logger was configured as (remembered in special case of .setDebugEnabled())
private int _configuredLevel;
private PrintStream _stderr = System.err;
@SuppressWarnings("UnusedAssignment")
private boolean _source = SOURCE;
// Print the long form names, otherwise use abbreviated
private boolean _printLongNames = LONG_CLASSNAMES;
Expand Down Expand Up @@ -216,7 +218,7 @@ public StdErrLog(String name, Properties props)
{
// allow stacktrace display to be controlled by properties as well
String stacks = getLoggingProperty(Log.PROPS, _name, "STACKS");
_hideStacks = stacks == null ? false : !Boolean.parseBoolean(stacks);
_hideStacks = stacks != null && !Boolean.parseBoolean(stacks);
}
catch (AccessControlException ignore)
{
Expand All @@ -235,6 +237,7 @@ public void setPrintLongNames(boolean printLongNames)
this._printLongNames = printLongNames;
}

@SuppressWarnings("unused")
public boolean isPrintLongNames()
{
return this._printLongNames;
Expand Down Expand Up @@ -461,6 +464,7 @@ private void format(StringBuilder builder, String level, String msg, Object... i
msg = "";
for (int i = 0; i < msgArgsLen; i++)
{
//noinspection StringConcatenationInLoop
msg += "{} ";
}
}
Expand Down Expand Up @@ -492,7 +496,7 @@ private void format(StringBuilder builder, String level, String msg, Object... i
{
if (isHideStacks())
{
builder.append(": " + cause);
builder.append(": ").append(cause);
}
else
{
Expand Down Expand Up @@ -599,9 +603,8 @@ else if (p == 0)
{
Throwable source = new Throwable();
StackTraceElement[] frames = source.getStackTrace();
for (int i = 0; i < frames.length; i++)
for (final StackTraceElement frame : frames)
{
final StackTraceElement frame = frames[i];
String clazz = frame.getClassName();
if (clazz.equals(StdErrLog.class.getName()) || clazz.equals(Log.class.getName()))
{
Expand Down

0 comments on commit 16230e6

Please sign in to comment.