363785 - StdErrLog must use system-dependent EOL.

This commit is contained in:
Simone Bordet 2011-11-15 10:19:10 +01:00
parent be9597f8f2
commit 46aad20248
1 changed files with 18 additions and 17 deletions

View File

@ -37,9 +37,10 @@ import org.eclipse.jetty.util.DateCache;
*/
public class StdErrLog implements Logger
{
private static final String EOL = System.getProperty("line.separator");
private static DateCache _dateCache;
private static Properties __props = Log.__props;
private final static boolean __source = Boolean.parseBoolean(Log.__props.getProperty("org.eclipse.jetty.util.log.SOURCE",
Log.__props.getProperty("org.eclipse.jetty.util.log.stderr.SOURCE","false")));
private final static boolean __long = Boolean.parseBoolean(Log.__props.getProperty("org.eclipse.jetty.util.log.stderr.LONG","false"));
@ -122,7 +123,7 @@ public class StdErrLog implements Logger
/**
* Get the Logging Level for the provided log name. Using the FQCN first, then each package segment from longest to
* shortest.
*
*
* @param props
* the properties to check
* @param name
@ -193,13 +194,13 @@ public class StdErrLog implements Logger
* Condenses a classname by stripping down the package name to just the first character of each package name
* segment.Configured
* <p>
*
*
* <pre>
* Examples:
* "org.eclipse.jetty.test.FooTest" = "oejt.FooTest"
* "org.eclipse.jetty.server.logging.LogTest" = "orjsl.LogTest"
* </pre>
*
*
* @param classname
* the fully qualified class name
* @return the condensed name
@ -248,7 +249,7 @@ public class StdErrLog implements Logger
/* ------------------------------------------------------------ */
/**
* Is the source of a log, logged
*
*
* @return true if the class, method, file and line number of a log is logged.
*/
public boolean isSource()
@ -259,7 +260,7 @@ public class StdErrLog implements Logger
/* ------------------------------------------------------------ */
/**
* Set if a log source is logged.
*
*
* @param source
* true if the class, method, file and line number of a log is logged.
*/
@ -334,9 +335,9 @@ public class StdErrLog implements Logger
synchronized (__loggers)
{
this._level = LEVEL_DEBUG;
// Boot stomp all cached log levels to DEBUG
for(StdErrLog log: __loggers.values())
for(StdErrLog log: __loggers.values())
{
log._level = LEVEL_DEBUG;
}
@ -347,9 +348,9 @@ public class StdErrLog implements Logger
synchronized (__loggers)
{
this._level = this._configuredLevel;
// restore all cached log configured levels
for(StdErrLog log: __loggers.values())
for(StdErrLog log: __loggers.values())
{
log._level = log._configuredLevel;
}
@ -367,7 +368,7 @@ public class StdErrLog implements Logger
* <p>
* Available values ({@link StdErrLog#LEVEL_ALL}, {@link StdErrLog#LEVEL_DEBUG}, {@link StdErrLog#LEVEL_INFO},
* {@link StdErrLog#LEVEL_WARN})
*
*
* @param level
* the level to set the logger to
*/
@ -551,19 +552,19 @@ public class StdErrLog implements Logger
}
else
{
buffer.append('\n');
buffer.append(EOL);
format(buffer,thrown.toString());
StackTraceElement[] elements = thrown.getStackTrace();
for (int i = 0; elements != null && i < elements.length; i++)
{
buffer.append("\n\tat ");
buffer.append(EOL).append("\tat ");
format(buffer,elements[i].toString());
}
Throwable cause = thrown.getCause();
if (cause != null && cause != thrown)
{
buffer.append("\nCaused by: ");
buffer.append(EOL).append("Caused by: ");
format(buffer,cause);
}
}
@ -571,7 +572,7 @@ public class StdErrLog implements Logger
/**
* A more robust form of name blank test. Will return true for null names, and names that have only whitespace
*
*
* @param name
* the name to test
* @return true for null or blank name, false if any non-whitespace character is found.
@ -597,7 +598,7 @@ public class StdErrLog implements Logger
/**
* Get a Child Logger relative to this Logger.
*
*
* @param name
* the child name
* @return the appropriate child logger (if name specified results in a new unique child)
@ -661,7 +662,7 @@ public class StdErrLog implements Logger
}
return s.toString();
}
public static void setProperties(Properties props)
{
__props = props;