 |
How does LogSequencer Generate Sequence Diagrams
In many software projects it is common practice to have a log file that contains debugging information generated at runtime. It is also common practice to log when an important method of an object is called and when it ends.
You can use AOP (Aspect Oriented Programming, more info) and the AspectJ compiler (with java) to automatically have your classes write the basic logging information.
The steps to add logging to your applications using an aspect are very simple:
- create an aspect class that generates logging (see java example )
- compile your source code and the aspect class with the AspectJ compiler
- run your application
You can download the LogSequencer package (RowParser, an aspect for logging, and a LogSequencer property file ) for AspectJ here.
Click here to find out more about AspectJ.
If you don't want to use AspectJ and your source code does not write the minimum information to generate a sequence diagram
- Class name or object name,
- Method name,
- Method action (i.e. Begin or End),
at the beginning and the end of a method then you need to add logging statements to your source code. The following code snipplet illustrates basic logging (java syntax):
| protected boolean addOrderItem(OrderItem oi) { |
| if (m_isLogging) log("Order", "addOrderItem()", "Begin");
|
| |
| // method logic |
| …………..
|
| |
| if (m_isLogging) log("Order", "addOrderItem()", "End"); |
| return true; |
| } |
AspectJ References
|
|