Skip to content

Commit 273c3d4

Browse files
Refactored log capture and formatting code in org.openqa.selenium.tes… (#13322)
* Refactored log capture and formatting code in org.openqa.selenium.testing and org.openqa.selenium.grid.log packages. * Format files --------- Co-authored-by: Diego Molina <[email protected]> Co-authored-by: Diego Molina <[email protected]>
1 parent bb10753 commit 273c3d4

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

java/src/org/openqa/selenium/grid/log/TerseFormatter.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class TerseFormatter extends Formatter {
4141
* Line separator string. This is the value of the line.separator property at the moment that the
4242
* TerseFormatter was created.
4343
*/
44-
private final String lineSeparator = System.getProperty("line.separator");
44+
private final String lineSeparator = System.lineSeparator();
4545

4646
/*
4747
* DGF - These have to be compile time constants to be used with switch
@@ -78,7 +78,12 @@ public synchronized String format(final LogRecord record) {
7878
buffer.append(' ');
7979
buffer.append(levelNumberToCommonsLevelName(record.getLevel()));
8080
String[] parts = record.getSourceClassName().split("\\.");
81-
buffer.append(" [" + parts[parts.length - 1] + "." + record.getSourceMethodName() + "]");
81+
buffer
82+
.append(" [")
83+
.append(parts[parts.length - 1])
84+
.append(".")
85+
.append(record.getSourceMethodName())
86+
.append("]");
8287
buffer.append(SUFFIX);
8388
buffer.append(formatMessage(record)).append(lineSeparator);
8489
if (record.getThrown() != null) {

java/test/org/openqa/selenium/testing/CaptureLoggingRule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public String format(LogRecord record) {
135135
.append("]");
136136
}
137137
buffer.append(" - ");
138-
buffer.append(formatMessage(record)).append(System.getProperty("line.separator"));
138+
buffer.append(formatMessage(record)).append(System.lineSeparator());
139139
if (record.getThrown() != null) {
140140
final StringWriter trace = new StringWriter();
141141
record.getThrown().printStackTrace(new PrintWriter(trace));

0 commit comments

Comments
 (0)