Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2261 - development/main/transit/core/handler/src/main/net/dpml/transit/adapter

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2261 - development/main/transit/core/handler/src/main/net/dpml/transit/adapter
  • Date: Mon, 11 Apr 2005 01:44:27 -0400

Author: mcconnell AT dpml.net
Date: Mon Apr 11 01:44:24 2005
New Revision: 2261

Added:

development/main/transit/core/handler/src/main/net/dpml/transit/adapter/StandardFormatter.java
Log:
Add a java.util.logging.Formatter to Transit on the basis that Transit should
be handling this as part of the bootstrap.

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/adapter/StandardFormatter.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/adapter/StandardFormatter.java
Mon Apr 11 01:44:24 2005
@@ -0,0 +1,58 @@
+
+package net.dpml.transit.adapter;
+
+import java.io.*;
+import java.text.*;
+import java.util.logging.Formatter;
+import java.util.logging.LogRecord;
+
+/**
+ * Logging message formatter that includes the category in the logging
statement.
+ */
+public class StandardFormatter extends Formatter
+{
+ private String lineSeparator =
+ (String) java.security.AccessController.doPrivileged(
+ new sun.security.action.GetPropertyAction("line.separator"));
+
+ /**
+ * Format a LogRecord using the classic style.
+ * @param record the log record to be formatted.
+ * @return a formatted log record
+ */
+ public synchronized String format( LogRecord record )
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ String header = getLogHeader( record );
+ buffer.append( header );
+ if( null != record.getLoggerName() )
+ {
+ buffer.append( "(" + record.getLoggerName() + "): " );
+ }
+ else
+ {
+ buffer.append( "() " );
+ }
+ String message = formatMessage( record );
+ buffer.append( message );
+ buffer.append( lineSeparator );
+ if( record.getThrown() != null )
+ {
+ Throwable cause = record.getThrown();
+ String error = ExceptionHelper.packException( cause, true );
+ buffer.append( error );
+ }
+ return buffer.toString();
+ }
+
+ private String getLogHeader( LogRecord record )
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append( "[" );
+ buffer.append( record.getLevel().getLocalizedName() );
+ buffer.append( " " );
+ String tag = buffer.toString();
+ return tag.substring( 0, 8 ) + "] ";
+ }
+}



  • svn commit: r2261 - development/main/transit/core/handler/src/main/net/dpml/transit/adapter, mcconnell, 04/10/2005

Archive powered by MHonArc 2.6.24.

Top of Page