Using Message Logger for Lazy Logging in WebSphere ESB and Process Server 6.2
March 9, 2009 6 Comments
If you’re creating a mediation flow in WebSphere ESB and Process Server 6.2, it’s now even easier to do ‘lazy’ (drop-and-forget) logging for debugging purposes (Note: I’m calling it ‘lazy’ deliberately. I am not suggesting you should do this in a production system – it’s for quick-and-dirty testing).
Simply drop a Message Logger primitive onto the mediation flow, and change the type from ‘Database’ to ‘Custom’:
The default handler, formatter, and filter classes shown will be used to do the logging. This means that files named MessageLogN.log will appear in your system’s temporary folder (on Windows, for example, this is normally C:\Documents and Settings\YourUsername\Local Settings\Temp). These will contain lines like this:
3/9/09 3:08 PM,EBC7634C-011F-4000-E000-02BCC0A80A8A,MessageLogger1,LogTest,<?xml version="1.0" encoding="UTF-8"?> <body xsi:type="i1:operation1RequestMsg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:i1="wsdl.http://LogTest/i1" xmlns:i1_1="http://LogTest/i1"> <i1_1:operation1> <input1>some data</input1> </i1_1:operation1> </body> ,6
The six fields you see in the comma-delimited line are:
- Service Message Object message ID
- Mediation primitive name
- Module name
- Actual message itself – i.e. the Service Message Object serialized as XML.
- Service Message Object version
This can be really handy for quickly instrumenting a mediation flow.
If you want to get more sophisticated, you can override the handler, formatter, and filter classes with your own, and in any production system, you’d probably want to do that. This document from the Java documentation explains more.