diff options
author | Thomas Watson | 2015-08-12 21:37:56 +0000 |
---|---|---|
committer | Thomas Watson | 2015-08-12 21:37:56 +0000 |
commit | 7e39ff7a7a923af0d3eeef06ba93bea71ea9a192 (patch) | |
tree | 4f93e49445b46895c06d3e8e73177b979e9518a3 | |
parent | 52896896aac837cb5d716383f38a6da44fd4796b (diff) | |
download | rt.equinox.framework-7e39ff7a7a923af0d3eeef06ba93bea71ea9a192.tar.gz rt.equinox.framework-7e39ff7a7a923af0d3eeef06ba93bea71ea9a192.tar.xz rt.equinox.framework-7e39ff7a7a923af0d3eeef06ba93bea71ea9a192.zip |
Bug 253738 - EclipseLog forces UTF-8 for System.errI20150818-0800
-rw-r--r-- | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogWriter.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogWriter.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogWriter.java index f75ec6544..1520ab158 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogWriter.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogWriter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2012 IBM Corporation and others. + * Copyright (c) 2004, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -40,10 +40,12 @@ class EquinoxLogWriter implements SynchronousLogListener, LogFilter { /** The line separator used in the log output */ private static final String LINE_SEPARATOR; + static { String s = System.getProperty("line.separator"); //$NON-NLS-1$ LINE_SEPARATOR = s == null ? "\n" : s; //$NON-NLS-1$ } + //Constants for rotating log file /** The default size a log file can grow before it is rotated */ private static final int DEFAULT_LOG_SIZE = 1000; @@ -112,7 +114,7 @@ class EquinoxLogWriter implements SynchronousLogListener, LogFilter { public EquinoxLogWriter(Writer writer, String loggerName, boolean enabled, EquinoxConfiguration environmentInfo) { if (writer == null) // log to System.err by default - this.writer = logForStream(System.err); + this.writer = logForErrorStream(); else this.writer = writer; this.loggerName = loggerName; @@ -244,10 +246,10 @@ class EquinoxLogWriter implements SynchronousLogListener, LogFilter { try { writer = logForStream(secureAction.getFileOutputStream(outFile, true)); } catch (IOException e) { - writer = logForStream(System.err); + writer = logForErrorStream(); } } else { - writer = logForStream(System.err); + writer = logForErrorStream(); } } } @@ -290,7 +292,7 @@ class EquinoxLogWriter implements SynchronousLogListener, LogFilter { System.err.println("Logging to the console instead.");//$NON-NLS-1$ //we failed to write, so dump log entry to console instead try { - writer = logForStream(System.err); + writer = logForErrorStream(); writeLog(0, logEntry); writer.flush(); } catch (Exception e2) { @@ -448,6 +450,13 @@ class EquinoxLogWriter implements SynchronousLogListener, LogFilter { } /** + * Always use the default encoding for System.err + */ + private Writer logForErrorStream() { + return new BufferedWriter(new OutputStreamWriter(System.err)); + } + + /** * Writes the log entry to the log using the specified depth. A depth value of 0 * indicates that the log entry is the root entry. Any value greater than 0 indicates * a sub-entry. |