Skip to content

Commit d60bac1

Browse files
sdimkovddavison
authored andcommitted
Use platform-dependant line separator instead of hardcoded '\n'.
Fixes logging to file for Windows. Use System.getProperty() instead of internal JDK api. Signed-off-by: Daniel Davison <daniel.jj.davison@gmail.com>
1 parent 1cde3ee commit d60bac1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

java/server/src/org/openqa/selenium/remote/server/log/TerseFormatter.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ public class TerseFormatter extends Formatter {
4040
*/
4141
private static final String SUFFIX = " - ";
4242

43+
/**
44+
* Line separator string. This is the value of the line.separator
45+
* property at the moment that the TerseFormatter was created.
46+
*/
47+
private final String lineSeparator = System.getProperty("line.separator");
48+
4349
/*
4450
* DGF - These have to be compile time constants to be used with switch
4551
*/
@@ -83,7 +89,7 @@ public synchronized String format(final LogRecord record) {
8389
buffer.append(record.getLoggerName());
8490
}
8591
buffer.append(SUFFIX);
86-
buffer.append(formatMessage(record)).append('\n');
92+
buffer.append(formatMessage(record)).append(lineSeparator);
8793
if (record.getThrown() != null) {
8894
final StringWriter trace = new StringWriter();
8995
record.getThrown().printStackTrace(new PrintWriter(trace));

0 commit comments

Comments
 (0)