Author |
Message
|
lium |
Posted: Wed May 12, 2010 2:04 pm Post subject: how to log message tree into log file |
|
|
Disciple
Joined: 17 Jul 2002 Posts: 184
|
I want to log part or whole message tree into log file, ie, part or whole of InputBody, LocalEnvironment, Output etc.
I have implemented a logger based on log4j which logs to a file and is working well. So now my mission is how to convert part of whole message tree into CHAR using ESQL.
Using ASBITSTREAM? it can convert part or whole message tree in to blob. But I then have to convert the blob into clob. Is there any better way to do that?
Thanks, |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed May 12, 2010 2:09 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Have you even looked at the trace node?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Svp |
Posted: Wed May 12, 2010 2:15 pm Post subject: |
|
|
Apprentice
Joined: 18 Feb 2010 Posts: 40
|
Using
x is blob = ASBITSTREAM(part of message or inputroot.xmlnsc)
msg is char= cast (x as char ccsid 437)
call log4j(xxx,msg,xxx); |
|
Back to top |
|
 |
sridhsri |
Posted: Wed May 12, 2010 2:27 pm Post subject: |
|
|
Master
Joined: 19 Jun 2008 Posts: 297
|
I wouldn't use Svp's method. They can't be turned off by an administrator and require a re-deploy of flow to turn it off. Trace nodes are the best way to go. |
|
Back to top |
|
 |
lium |
Posted: Wed May 12, 2010 3:13 pm Post subject: |
|
|
Disciple
Joined: 17 Jul 2002 Posts: 184
|
Thanks for reply.
Trace node is the easiest way to think of, but we might want to log inside a node, ie, in the middle of compute node's module. Another issue is the Trace node might have extra information, and the format is not exactly what we want to have |
|
Back to top |
|
 |
lium |
Posted: Wed May 12, 2010 3:23 pm Post subject: |
|
|
Disciple
Joined: 17 Jul 2002 Posts: 184
|
Great Thanks, SVP.
I just tried your solution, and it is exactly what I want.
TO sridhsri: I know this can not be turned on or off. I am going to implement a cachemanager, from which I can get the logging level, if it is debug level, then I will do the logging.
Actually, I tried SVP's way before, but without specify the CCSID, what I got is string like X'xxxxxxxx' which does not make sense to me.
Thanks again to everybody |
|
Back to top |
|
 |
Svp |
Posted: Wed May 12, 2010 5:12 pm Post subject: |
|
|
Apprentice
Joined: 18 Feb 2010 Posts: 40
|
could you tell me how you setup and configured log4j.properties file in your environment.
Are you using Windows? |
|
Back to top |
|
 |
lium |
Posted: Wed May 12, 2010 5:31 pm Post subject: |
|
|
Disciple
Joined: 17 Jul 2002 Posts: 184
|
We developed on windows and deploy on Unix.
We created a procedure to do this:
for example:
CREATE PROCEDURE Logger(IN logContent CHARACTER, IN logType CHARACTER)
LANGUAGE JAVA
EXTERNAL NAME "common.lib.Logger.log";
Then you implement common.lib.Logger class with log method. This class is nothing special but standard java class using log4j. Tons of example for such log4j class you can search from internet. |
|
Back to top |
|
 |
|