...
This technical specification page will detail three four areas of work to complete the Status Update change:
- The new classes required
- How to provide fixed log messages
- The additions to existing classes
- The deletions from existing classes
...
Interface | Description |
---|---|
LogActor | Actor that is requesting the log to be performedwill perform the logging. |
MessageStatusLogger | Entity that wishes to provide log statements. |
LogSubject | Subject of the logging . |
LogMessage MessageStatusLoggerFactory | Factory to generate MSLoggersLogMessages. |
RootMessageStatusLogger RootMessageLogger | Root logger that performs logging. |
RawMessageLogger | Wrapper for object that actually performs the logging. |
...
Implementation of the Actors
Class | Description |
---|---|
ConnectionActor AMQPActor | Responsible for providing data about the Connection when logging. |
ManagementConnectionActor ManagementActor | Responsible for providing data about the Management Connection when logging. |
Implementation of the LogSubject
Each of
...
these LogSubjects will ensure they toString according to the format design.
Class | Description |
---|---|
ConnectionMessageStatusLogger ConnectionLogSubject | Logger responsible for the Connection format. |
ChannelMessageStatusLogger ChannelLogSubject | Logger responsible for the Channel format. |
QueueMessageStatusLogger QueueLogSubject | Logger responsible for the Queue format. |
ExchangeMessageStatusLogger ExchangeLogSubject | Logger responsible for the Exchange format. |
BindingMessageStatusLogger BindingLogSubject | Logger responsible for the Binding format. |
SubscriptionMessageStatusLogger SubscriptionLogSubject | Logger responsible for the subscription format. |
MessageStoreMessageStatusLogger MessageStoreLogSubject | Logger responsible for the MessageStore format. |
RootMessageStatusLoggerImpl RootMessageLoggerImpl | Base logger that performs the final message formatting before logging. |
MessageStatusLoggerFactoryImpl LogMessageFactoryImpl | Factory to create the above LoggersLogMessages. |
Logging
Class | Description |
---|---|
Log4jRawMessageLogger | Wrapper to use log4j as the output mechanism. |
TestRawMessageLogger | Wrapper that provides an inspectable log for testing. |
...
Class | Description |
---|---|
BrokerLogMessages | A static class that contains accessors to the various parametrised log messages. |
Psuedo-Code Example
Code Block | ||||
---|---|---|---|---|
| ||||
// logActor is retreived from the ThreadLocal
// a logMessage of type logMessage (with parms) is then requested for the specified subject.
logActor.logMessage(logSubject, LogMessage(parms))
...
instance of LogActor{
RootLogger logger = ...getRootLogger();L
public void logMessage(LogSubject subject, LogMessage message)
{
if (logger.isMessageEnabled(this, subject)
{
// FormatMessage in to :
// MESSAGE [ this.toString() ] [ subject.toString() ] <messageID> : <message value>
logger.logMessage(FormatMessage(this, subject, message));
}
}
}
|
How to provide fixed log messages
The design calls for providing a fixed method of accessing the messages. Such as the following
Code Block | ||||
---|---|---|---|---|
| ||||
String version="0.6";
int build=794277;
String message = BrokerLogMessages.BRK-1001(version, build);
|
The value of message above would be
No Format |
---|
BRK-1001 : Startup : Version: 0.6 Build: 794277
|
This can be done easily with the use of a MessageFormatter and a property file.
Code Block |
---|
BRK-1001 = Startup : Version {0} Build: {1}
|
Initially the BrokerLogMessages class could be hand coded but in a future iteration it could be generated based on the content of the property file.
Additions to existing classes
...
The following log statements should be removed from the broker packages as they are being replaced with a new message.
...
AMQMinaProtocolSession
No Format |
---|
_logger.info("Auto-deleteing queue"Channel[" + channelId + "] awaiting closure - processing close-ok"); _logger.info("Closing channel due to: " + e.getMessage()); _logger.info("Closing connection due to: " + e.getMessage()); _logger.info("Closing connection due to: " + e.getMessage()); _logger.debug("REALLY Closing protocol session:" + this_minaProtocolSession); |
...
AMQPFastProtocolHandler
No Format |
---|
_logger.info("Protocol session created for:" + protocolSession.getRemoteAddress());
_logger.info("Session opened for:" + protocolSession.getRemoteAddress());
_logger.info("Protocol Session closed for:" + protocolSession.getRemoteAddress());
_logger.debug("AMQPFastProtocolHandler created");
|
BasicConsumeMethodHandler
No Format |
---|
_logger.debug("BasicConsume: from '" + body.getQueue() +
_logger.debug("No queue for '" + body.getQueue() + "'");
_logger.debug("Closing connection due to invalid selector");
|
ChannelFlowHandler.java:
No Format |
---|
_logger.debug("Channel.Flow for channel " + channelId + ", active=" + body.getActive());
|
Configuration
No Format |
---|
_devlog.info("Configuring logger using configuration log.info("Initialising managed object registry using platform MBean server"); _log.info("JMX ConnectorServer using SSL keystore file " + ksflogConfigFile.getAbsolutePath()); _startupLogdevlog.info("log file " + logConfigFile.getAbsolutePath("JMX ConnectorServer using SSL keystore) + " will be checked for changes every _devlog.debug("Using configuration file " + ksf_configFile.getAbsolutePath()); ex.getMessage()); |
ConnectionCloseMethodHandler
No Format |
---|
_logger.info("ConnectionClose received with reply code/reply text " + body.getReplyText() + " for " + session);
|
DerbyMessageStore
No Format |
---|
_logger.info("Configuring Derby message store for virtual host " + virtualHost.getName());
_logger.info("Recovering persistent state...");
_logger.info("Persistent state recovered successfully");
_logger.info("Recovering durable exchange " + exchange.getName() + " of type " + exchange.getType() + "...");
_logger.info("Restoring binding: (Exchange: " + exchange.getName() + ", Queue: " + queueName
_logger.info("Recovered message counts: " + queueRecoveries);
_logger.debug("public void createQueue(AMQQueue queue = " + queue + "): called");
_logger.debug("public void removeQueue(AMQShortString name = " + name + "): called");
_logger.debug("On recovery, delivering " + message.getMessageId() + " to " + queue.getName());
|
...
HeadersExchange
No Format |
---|
_loglogger.infodebug("Using capacityExchange " + DEFAULT_HASHTABLE_CAPACITYgetName() + ": for hash tables"); _log.info("Using capacity Unbinding " + hashtableCapacity + " for hash tables"queue.getName()); |
VirtualHost
No Format |
---|
_logger.infodebug("BindingExchange queue:" + queuegetName() + " with: routing keymessage '" + routingKey + "' to exchange:with headers " + thisheaders); _logger.debug("Loading configuration for virtualhost: " + config.getName()); |
...
JMXManagedObjectRegistry
No Format |
---|
_loggerlog.info("Channel["Initialising +managed channelIdobject +registry "]using awaitingplatform closure - processing close-okMBean server"); _loggerlog.info("Closing channel due to:JMX ConnectorServer using SSL keystore file " + eksf.getMessagegetAbsolutePath()); _loggerstartupLog.info("ClosingJMX connectionConnectorServer dueusing to:SSL "keystore + e.getMessage()); _logger.info("Closing connection due to: file " + eksf.getMessagegetAbsolutePath()); _logger.debug("REALLY Closing protocol session:" + _minaProtocolSession); |
...
Main
No Format |
---|
_loggerbrokerLogger.info("ProtocolStarting sessionQpid createdBroker for:" + protocolSessionQpidProperties.getRemoteAddressgetReleaseVersion()); _loggerbrokerLogger.info("Session opened for:Qpid.AMQP listening on non-SSL address " + protocolSession.getRemoteAddress()bindAddress); _loggerbrokerLogger.info("Protocol Session closed for:Qpid.AMQP listening on SSL port " + protocolSessionconfig.getRemoteAddressgetSSLPort()); _logger.debug("AMQPFastProtocolHandler created"); |
SubscriptionImpl
No Format |
---|
_logger.brokerLogger.info("ClosingQpid subscription (" + debugIdentity() + ")Broker Ready :" + thisQpidProperties.getReleaseVersion(); |
...
MemoryMessageStore
No Format |
---|
_log.info("BindingUsing queuecapacity " + queueDEFAULT_HASHTABLE_CAPACITY + " tofor exchange " + exch + " with routing key " + routingKey); |
ConnectionCloseMethodHandler
No Format |
---|
_loggerhash tables"); _log.info("ConnectionClose received with reply code/reply text Using capacity " + body.getReplyText()hashtableCapacity + " for hash tables" + session); |
QueueBindHandler
No Format |
---|
_log.info("Binding queue " + queue + " to exchange " + exch + " with routing key " + routingKey); |
...
No Format |
---|
_logger.info("Queue " + queueName + " bound to default exchange(" + defaultExchange.getName() + ")"); _logger.info("Queue " + queueName + " declared successfully"); |
...
QueueUnbindHandler
No Format |
---|
_brokerLoggerlog.info("StartingBinding Qpid Brokerqueue " + QpidProperties.getReleaseVersion() _brokerLogger.info("Qpid.AMQP listening on non-SSL addressqueue + " to exchange " + bindAddress); _brokerLogger.info("Qpid.AMQP listening on SSL port " + config.getSSLPort()); _brokerLogger.info("Qpid Broker Ready :exch + " with routing key " + QpidProperties.getReleaseVersion(routingKey); |
...
SimpleAMQQueue
No Format |
---|
_devlog.info("Configuring logger using configuration file " + logConfigFile.getAbsolutePath()); _devlog.info("log file Auto-deleteing queue:" + logConfigFile.getAbsolutePath() + " will be checked for changes every _devlog.debug("Using configuration file " + _configFile.getAbsolutePath()); ex.getMessage()); |
...
this);
|
SubscriptionImpl
No Format |
---|
_logger.debuginfo("Channel.FlowClosing forsubscription channel (" + channelIddebugIdentity() + ", active=):" + body.getActive()this); |
...
VirtualHost
No Format |
---|
_logger.debuginfo("BasicConsume: from 'Binding queue:" + body.getQueue()queue + _logger.debug("No queue for " with routing key '" + body.getQueue()routingKey + "'"); _logger.debug("Closing connection due to invalid selector"); |
HeadersExchange
No Format |
---|
to exchange:" + this); _logger.debug("ExchangeLoading "configuration + getName() + ": Unbindingfor virtualhost: " + queueconfig.getName()); _logger.debug("Exchange " + getName() + ": routing message with headers " + headers); |
Feedback
ID | From | Comment | Response |
---|---|---|---|
1 | Marnie | Ensure data logged in messaged due to be deleted is not lost. |
|
2 | Marnie | Following 1: Exception handling messages need further thought as replacing with 'Close' messages loses the cause |
|
3 | Marnie | Be mindful of performance in generating these log messages |
|
4 | Marnie | It is not clear that the LogActors, LogSubjects will be created and attached to their repective model objects |
|