Using Message Logger for Lazy Logging in WebSphere ESB and Process Server 6.2

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’:

2009-03-09_154556

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:

  1. Timestamp
  2. Service Message Object message ID
  3. Mediation primitive name
  4. Module name
  5. Actual message itself – i.e. the Service Message Object serialized as XML.
  6. 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.

Advertisements

6 Responses to Using Message Logger for Lazy Logging in WebSphere ESB and Process Server 6.2

  1. Jean-Francois Mermet says:

    On my Windows install, the MessageLog.log is located in C:\WINDOWS\Temp

  2. @Jean-Francois, I’m no expert on this detail of Windows, but I think this depends which Windows version you are using, and maybe which user you are logged in as well. Thanks for the comment.

  3. Shin says:

    Is there a way to aggregate multiple MessageLogN.log(s) into one file such as MessageLog.log?
    In other words, can I concentrate outputs on one file?

  4. @Shin, not using the default handler, formatter, etc., no. However, you could write your own logging classes, in which case you’re able to log in whatever what you want. Remember, this approach is quick-n-dirty only!

  5. rajeev says:

    That will be very help full if any one can tell me .how can we change the default path of MessageLogN.log from C:\Documents and Settings\YourUsername\Local Settings\Temp to anyother location

  6. ritushree says:

    thanks , this was help

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: