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

Refactored log capture and formatting code in org.openqa.selenium.tes… #13322

Merged
merged 3 commits into from
Dec 18, 2023
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
9 changes: 7 additions & 2 deletions java/src/org/openqa/selenium/grid/log/TerseFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class TerseFormatter extends Formatter {
* Line separator string. This is the value of the line.separator property at the moment that the
* TerseFormatter was created.
*/
private final String lineSeparator = System.getProperty("line.separator");
private final String lineSeparator = System.lineSeparator();

/*
* DGF - These have to be compile time constants to be used with switch
Expand Down Expand Up @@ -78,7 +78,12 @@ public synchronized String format(final LogRecord record) {
buffer.append(' ');
buffer.append(levelNumberToCommonsLevelName(record.getLevel()));
String[] parts = record.getSourceClassName().split("\\.");
buffer.append(" [" + parts[parts.length - 1] + "." + record.getSourceMethodName() + "]");
buffer
.append(" [")
.append(parts[parts.length - 1])
.append(".")
.append(record.getSourceMethodName())
.append("]");
buffer.append(SUFFIX);
buffer.append(formatMessage(record)).append(lineSeparator);
if (record.getThrown() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public String format(LogRecord record) {
.append("]");
}
buffer.append(" - ");
buffer.append(formatMessage(record)).append(System.getProperty("line.separator"));
buffer.append(formatMessage(record)).append(System.lineSeparator());
if (record.getThrown() != null) {
final StringWriter trace = new StringWriter();
record.getThrown().printStackTrace(new PrintWriter(trace));
Expand Down
Loading