[ 
https://issues.apache.org/activemq/browse/AMQ-1361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39905
 ] 

David Martín Clavo commented on AMQ-1361:
-----------------------------------------

*B. Implementation details*
(1) Logging enhancements (1st patch):
The TransportLogger class is now a class that uses one of the LogWriter 
implementations to print output; it doesn't print output itself any more. 
Two of these classes are included in the patch: one called DefaultLogWriter 
which implements the methods the same way as the present TransportLogger class, 
and one called CustomLogWriter which is an alternative format.
In order to implement your own LogWriter class, you need to:
(a) implement the LogWriter interface
(b) include a file in 
resources/META-INF/services/org/apache/activemq/transport/logwriters with the 
following format:
        {{class=org.apache.activemq.transport.logwriters.DefaultLogWriter}}
        The name of the file has to be the value of the 'logWriterName' option 
previously mentioned. This will link the name of the log writer to the class 
implementing the LogWriter interface.

(2) Dynamic control of logging enhancements (2nd patch):
Each TransportLogger instance has a TransportLoggerMBean to switch on / off 
logging for that transport. Also, there is a TransportLoggerControl Mbean which 
allows to switch on / off all the transport loggers at once.
To change the JMX port , by writing, for example: 
        
{{tcp://localhost:61616?trace=true&logWriterName=custom&dynamicManagement=true&jmxPort=1199}}
It is good to change the JMX port in case someone wants to have clients and 
brokers with this functionality in the same computer, and not have a port 
collision.

(3) Log parsing and analysis tool:
The tool is implemented with Python 2.5.1 and wxPython 2.8.4

*C. Notes*
-Example of URI which uses all the previous configuration options:
{{tcp://localhost:61616?trace=true&logWriterName=custom&dynamicManagement=true&startLogging=true&jmxPort=1299}}
-How to separate Transport logging from the rest of ActiveMQ logging by 
modifying log4j.properties:

{{log4j.rootLogger=WARN, stdout
log4j.additivity.org.apache.activemq.transport.TransportLogger=false
log4j.logger.org.apache.activemq.transport.TransportLogger=DEBUG, A}}
(A would be an appender of your choice).

> Logging improvement contribution
> --------------------------------
>
>                 Key: AMQ-1361
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1361
>             Project: ActiveMQ
>          Issue Type: Improvement
>          Components: Broker, Transport
>    Affects Versions: 5.0.0
>            Reporter: David Martín Clavo
>             Fix For: 5.0.0
>
>         Attachments: log_analyzer_tool.zip, patch1.zip, patch2.zip
>
>
> Hello people,
> After our proposal some time ago (view 
> http://www.nabble.com/Logging-improvement-proposal-tf3570794s2354.html#a9976200),
>  we would like to add a little contribution to the ActiveMQ code, and we hope 
> that the ActiveMQ developers and users like it.
> We thought it would be good to improve ActiveMQ logging's capabilities, in 
> order to make debugging, tracing, and understanding ActiveMQ easier.
> For this, we have added customization of ActiveMQ's Transport level logging, 
> allowing users to write their own logging formats. Also, we have added 
> dynamic control of this logging functions (via JMX). We have also developed a 
> simple tool to analyze the log files produced.
> We have split the contribution into 2 patches, one to add customized log 
> formats functionality, and the other to add dynamic management of logging via 
> JMX. 1st patch is against SVN rev. 564978. 2nd patch is against 1st patch 
> (incremental).
> *A. New features*
> (1) Logging enhancements (1st patch):
> It is now possible to customize what will be written to the log file at 
> transport level, by writing a custom class which implements the new LogWriter 
> interface.
> Also, the option: logWriterName = name has to be added to a transport URI to 
> choose which class (format) will be used (more details on how to implement 
> your own class / format later).
> To activate transport logging, the trace=true flag has to be used.
> People who don't want to use the new functionality will not have to change 
> their URI's.
> (2) Dynamic control of logging enhancements (2nd patch):
> (a) Added ability to reload log4j.properties file to the BrokerView MBean.
> (b) If the option dynamicManagement=true is appended to the URI, transport 
> logging can be managed through JMX:
>       -Logging can be switched on / off for every transport or for all of 
> them at once.
>       -If the option startLogging=false is appended to the URI, a transport 
> will initially not log, but a TransportLogger instance will be created, and 
> later it can be activated by JMX.
>       -Another option lets the user change the JMX port used for these 
> functions.
> (3) Log parsing and analysis tool:
> The tool parses log files (any number of them) of the CustomLogWriter format 
> (our own implementation of the LogWriter interface) and has the following 
> features:
> (a) The tool detects incorrect situations at Transport level: sent but not 
> received messages, duplicate messages at transport level.
> (b) The tool can show the communication sequence for a message ("travel path" 
> of a message).
> (c) Other features:
>       (c1) Loading of log files is done by choosing a directory with them.
>       (c2) Incorrect features can be filtered per type or per connection.
>       (c3) Long, hard to read connection / client IDs can be replaced by 
> short, easy to compare IDs.
>       (c4) Summary of connections, producers, consumers, log files.
> Some screen shots are included.
> (Continues on first comment)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to