Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The approach to logging is that each Entitiy as highlighted on Logging Format Design would provide an implementation of MessageStatusLogger. This logger would be obtained from the MessagesStatusLoggerFactory during the constuction of the entity. When a Status event occured that should be logged a LogActor is requried to request the logging. The initial LogActors _LogActor_s would be Connection, Channel and Subscription. Later phases would introduce VirtualHost and ManagementConnection. These Actors will initially only be used to provide their log formated name as per the format design. However, later their details can be used to identify if logging should procced for that Actor and Entity combination. At this stage selective configurations is not part of this design.

The addition of the LogActor allows for situations such as Binding to have a Connection associated with the Binding. This will allow a Binding create event to be logged like this:

No Format

2009-06-29 13:35:10,1234 +0100 MESSAEG [ con:1(guest@127.0.0.1/)/ch:2/ex(amq.direct)/qu(testQueue)/bd(routingKey) ] BND-1001 : Binding Created

rather having no details about how the creation occured:

No Format

2009-06-29 13:35:10,1234 +0100 MESSAGE [ vh(/)/ex(amq.direct)/qu(testQueue)/bd(routingKey) ] BDN-1001 : Binding Created

Interfaces

Code Block
java
java
titleLogActor


/**
 * LogActor the entity that is requesting the log to be peformed.
 *
 * The actor is responsible for providing the formatted name for the log entry.
 *
 */
public interface LogActor
{
    /**
Code Block
javajava
titleLogActor


/**
 * LogActor the entity that is requesting the log to be peformed.
 *
 * The actor is responsible for providing the formatted name for the log entry.
 *
 */
public interface LogActor
{
    /**
     * Return the String that this actor wishes to be entered into the logfile.
     *
     * Return the String that this actor wishes to be entered into the logfile.
     *
     * @return String
     */
    public String getLogFormattedName();
}

...

Code Block
java
java
titleRawMessageLogger
/**
 * A RawMessage Logger takes the given String and any Throwable and writes the
 * data to its resouce.
 */
public interface RawMessageLogger
{
    /**
     * Log the message and formatted stack trace for any Throwable.
     *
     * @param message   String to log.
     * @param throwable Throwable for which to provide stack trace.
     */
    public void rawMessage(String message, Throwable throwable);
}

The addition of the ability to set a creator allows for situations such as Binding to have a Connection associated with the Binding. This will allow a Binding create event to be logged like this:

No Format

2009-06-29 13:35:10,1234 +0100 INFO [ con:1(guest@127.0.0.1/)/ch:2/ex(amq.direct)/qu(testQueue)/bd(routingKey) ] Created Binding

rather having no details about how the creation occured:

No Format

2009-06-29 13:35:10,1234 +0100 INFOpublic [void vh(/)/ex(amq.direct)/qu(testQueue)/bd(routingKey) ] Created BindingrawMessage(String message, Throwable throwable);
}

Logging Usage

Code Block
java
java
titleLogging of a Channel Creation
pubic class Channel
...
    if (_statusLogger.isInfoEnabled((ConnectonLogActor)thiscnnectonLogActor))
    {
        _statusLogger.info((ConnectonLogActor)this)connectonLogActor, "ChM-1001 : Channel Created");
    }
...

...