[logback-dev] RFC: LoggingEvent redesign

Ceki Gulcu ceki at qos.ch
Mon Feb 23 17:27:59 CET 2009


Hi  Maarteen,

Thus far, mutability/immutablity, localness/remoteness, and storability on disk 
are aspects that we need to take into consideration. Are there other aspects?

Maarten Bosteels wrote:
> Hello Ceki,
> 
> Seems like a good idea to me. But what about making a read-only 
> interface and a read-write interface.
> 
> interface ImmutableLoggingEvent {
>   // only getters
> }
> 
> interface MutableLoggingEvent {
>   // getters and setters
> }
> 
> LoggingEventMemento implements ImmutableLoggingEvent
> 
> LoggingEvent implements MutableLoggingEvent
> 
> And wherever possible use a ImmutableLoggingEvent .
> 
> Maarten
> 
> 
> On Mon, Feb 23, 2009 at 1:44 PM, Ceki Gulcu <ceki at qos.ch> wrote:
> 
>     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
>     _______________________________________________
>     logback-dev mailing list
>     logback-dev at qos.ch
>     http://qos.ch/mailman/listinfo/logback-dev
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> logback-dev mailing list
> logback-dev at qos.ch
> http://qos.ch/mailman/listinfo/logback-dev

-- 
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