[logback-dev] RFC: LoggingEvent redesign

Ceki Gulcu ceki at qos.ch
Mon Feb 23 13:44:56 CET 2009


Hello all,

I would like to split/redesign the LoggingEvent object as follows:

interface ILoggingEvent  {

   String[] getArgumentArray();
   CallerData[] getCallerData();
   Level getLevel();
   String getLoggerName();
   Marker getMarker();
   Map<String, String> getMDCPropertyMap();
   String getMessage();
   String getThreadName();
   ThrowableDataPoint[] getThrowableDataPointArray();
   long getTimeStamp();

   void setArgumentArray(Object[])
   // other setters omitted
}


// localized usage, temporary lifespan
class LoggingEvent implements ILoggingEvent {
   // getter and setter methods from ILoggingEvent omitted

   void prepareForDeferredProcessing();

   // create a LoggingEventMemento image of this LoggingEvent
   LoggingEventMemento asLoggingEventMemento();
}


// distributed (or remote) usage, long term lifespan
class LoggingEventMemento implements ILoggingEvent {
   // getter and setter methods from ILoggingEvent omitted

   int getVersion();
   makeImmutable();
}


LoggingEvent is intended to be used within the application generating
the logging event. LoggingEventMemento is intended for remote
applications (applications other than the application at the origin of
the event) and for longer term lifespan. LoggingEventMemento objects
are intended to be compatible across logback versions. If possible,
LoggingEventMemento should also be suitable for long term storage (on
disk).

Both LoggingEvent and LoggingEventMemento implement the ILoggingEvent
interface so that most logback-classic components, assuming they
expect to operate on ILoggingEvent instances, will be able to handle
LoggingEvent or LoggingEventMemento objects interchangeably.


Instead of LoggingEvent, those appenders which perform serialization,
will be serializing instances of LoggingEventMemento. The
asLoggingEventMemento() method in LoggingEvent will return a
LoggingEventMemento image of a given LoggingEvent.

Obviously there several technical obstacles to overcome. However, I am
soliciting your comments about the general goals of the above
redesign. Do they make sense? Have I omitted important goals?

TIA,

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch


More information about the logback-dev mailing list