Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LOGMGR-204] Fix short host name to be first instead of last part #198

Merged
merged 1 commit into from
Oct 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static FormatStep[] getSteps(final String formatString, ColorMap colors)
break;
}
case 'h': {
stepList.add(Formatters.hostnameFormatStep(leftJustify, minimumWidth, truncateBeginning, maximumWidth, argument == null ? "1" : argument));
stepList.add(Formatters.hostnameFormatStep(leftJustify, minimumWidth, truncateBeginning, maximumWidth, false));
break;
}
case 'H': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,13 @@ public void renderRaw(final StringBuilder builder, final ExtLogRecord record) {
* @return the format step
*/
public static FormatStep hostnameFormatStep(final boolean leftJustify, final int minimumWidth, final boolean truncateBeginning, final int maximumWidth, final boolean qualified) {
return hostnameFormatStep(leftJustify, minimumWidth, truncateBeginning, maximumWidth, qualified ? null : "1");
return qualified ? hostnameFormatStep(leftJustify, minimumWidth, truncateBeginning, maximumWidth, null) : new SegmentedFormatStep(leftJustify, minimumWidth, truncateBeginning, maximumWidth, null) {
public String getSegmentedSubject(final ExtLogRecord record) {
final String hostName = record.getHostName();
final int idx = hostName.indexOf('.');
return idx == -1 ? hostName :hostName.substring(0, idx);
jamezp marked this conversation as resolved.
Show resolved Hide resolved
}
};
}

/**
Expand Down