Widening.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2551 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2009-05-04 23:42:45 +00:00
parent 2247e7d0a0
commit 75727e6daa
@@ -40,8 +40,7 @@ import java.util.logging.SimpleFormatter;
public class OneLineLogFormatter extends Formatter public class OneLineLogFormatter extends Formatter
{ {
/** /**
* Creates a log formatter that will include the function from which a log * Creates a log formatter that will include the function from which a log entry was generated.
* entry was generated.
*/ */
public OneLineLogFormatter () public OneLineLogFormatter ()
{ {
@@ -49,8 +48,8 @@ public class OneLineLogFormatter extends Formatter
} }
/** /**
* Creates a log formatter that will optionally include or not include the * Creates a log formatter that will optionally include or not include the function from which
* function from which a log entry was generated. * a log entry was generated.
*/ */
public OneLineLogFormatter (boolean showWhere) public OneLineLogFormatter (boolean showWhere)
{ {
@@ -111,17 +110,17 @@ public class OneLineLogFormatter extends Formatter
} }
/** /**
* Configures the default logging handler to use an instance of this * Configures the default logging handler to use an instance of this formatter when formatting
* formatter when formatting messages. * messages.
*/ */
public static void configureDefaultHandler () public static void configureDefaultHandler ()
{ {
configureDefaultHandler(new OneLineLogFormatter(true)); configureDefaultHandler(true);
} }
/** /**
* Configures the default logging handler to use an instance of this * Configures the default logging handler to use an instance of this formatter when formatting
* formatter when formatting messages. * messages.
*/ */
public static void configureDefaultHandler (boolean showWhere) public static void configureDefaultHandler (boolean showWhere)
{ {
@@ -129,15 +128,14 @@ public class OneLineLogFormatter extends Formatter
} }
/** /**
* Configures the default logging handler to use an instance of the * Configures the default logging handler to use an instance of the specified formatter when
* specified formatter when formatting messages. * formatting messages.
*/ */
public static void configureDefaultHandler (Formatter formatter) public static void configureDefaultHandler (Formatter formatter)
{ {
Logger logger = LogManager.getLogManager().getLogger(""); Logger logger = LogManager.getLogManager().getLogger("");
Handler[] handlers = logger.getHandlers(); for (Handler handler : logger.getHandlers()) {
for (int ii = 0; ii < handlers.length; ii++) { handler.setFormatter(formatter);
handlers[ii].setFormatter(formatter);
} }
} }
@@ -146,9 +144,9 @@ public class OneLineLogFormatter extends Formatter
protected SimpleDateFormat _format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss:SSS"); protected SimpleDateFormat _format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss:SSS");
protected FieldPosition _fpos = new FieldPosition(SimpleDateFormat.DATE_FIELD); protected FieldPosition _fpos = new FieldPosition(SimpleDateFormat.DATE_FIELD);
protected static String LINE_SEPARATOR = "\n";
protected static final String DATE_FORMAT = "{0,date} {0,time}"; protected static final String DATE_FORMAT = "{0,date} {0,time}";
protected static String LINE_SEPARATOR = "\n";
static { static {
try { try {
LINE_SEPARATOR = System.getProperty("line.separator"); LINE_SEPARATOR = System.getProperty("line.separator");