Author |
Message
|
WMBSAM |
Posted: Mon Oct 19, 2009 10:31 am Post subject: log4j issue |
|
|
 Voyager
Joined: 02 Oct 2009 Posts: 90 Location: Atlanta
|
hello i am trying to use the support pac provided for the logging in log4j format .
the issue is i am trying to use the api's(functionalities as described in the manual in the ESQL but some how it doesn't work.
Here is my ESQL code:
Code: |
CREATE FUNCTION initLog4j( IN CONFIG_FILE_NAME CHARACTER )
RETURNS BOOLEAN
LANGUAGE JAVA
EXTERNAL NAME "com.ibm.broker.IAM3.Log4jNode.initLog4j";
CREATE FUNCTION log4j( IN COMPONENT_NAME CHARACTER,
IN LEVEL CHARACTER,IN TEXT CHARACTER )
RETURNS BOOLEAN
LANGUAGE JAVA
EXTERNAL NAME "com.ibm.broker.IAM3.Log4jNode.log";
CREATE COMPUTE MODULE MyApplicationFlow_log4j
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyEntireMessage();
DECLARE rc BOOLEAN;
CALL initLog4j('C:\Documents and Settings\wmbsam\My Documents\iam3\samples\brokerlog.xml') INTO rc;
IF ( rc = FALSE ) THEN
PROPAGATE TO TERMINAL 'out1';
-- error initializing log4j My Message is $ESQL:InputRoot.XMLNS.Test
END IF;
CALL log4j('MyApplicationFlow.msgflow', 'WARN','My Message is $ESQL:InputRoot.XMLNS.Test$') INTO rc;
IF ( rc = FALSE ) THEN
-- error during logging
PROPAGATE TO TERMINAL 'out';
END IF;
RETURN TRUE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
|
In debug mode i can clearly see that the functions initLog4j,log4j returns true(boolean type)
I get the following Output in Log file:
11:10:27,996 WARN [MyApplicationFlow.msgflow] My Message is $ESQL:InputRoot.XMLNS.Test$
Any suggestions??? |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Oct 19, 2009 11:27 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Yes.
Both of those PROPAGATES will return back to the ESQL. |
|
Back to top |
|
 |
WMBSAM |
Posted: Mon Oct 19, 2009 11:45 am Post subject: |
|
|
 Voyager
Joined: 02 Oct 2009 Posts: 90 Location: Atlanta
|
I changed the code and removed the propagate statement but the result is the same.
Here is the change i made:
Code: |
DECLARE rc BOOLEAN;
CALL initLog4j('C:\Documents and Settings\wmbsam\My Documents\iam3\samples\brokerlog.xml') INTO rc;
/* IF ( rc = FALSE ) THEN
PROPAGATE TO TERMINAL 'out1';
-- error initializing log4j My Message is $ESQL:InputRoot.XMLNS.Test
END IF;*/
CALL log4j('MyApplicationFlow.msgflow', 'WARN','My Message is $ESQL:InputRoot.XMLNS.Test$') INTO rc;
/*IF ( rc = FALSE ) THEN
-- error during logging
PROPAGATE TO TERMINAL 'out';
END IF;*/
|
and here is the Output I get its the same result:
12:41:54,855 WARN [MyApplicationFlow.msgflow] My Message is $ESQL:InputRoot.XMLNS.Test$ |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Oct 19, 2009 11:59 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
What result are you expecting? |
|
Back to top |
|
 |
WMBSAM |
Posted: Mon Oct 19, 2009 12:44 pm Post subject: |
|
|
 Voyager
Joined: 02 Oct 2009 Posts: 90 Location: Atlanta
|
|
Back to top |
|
 |
TonyD |
Posted: Mon Oct 19, 2009 6:04 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
I think the $ESQL .... $ format is for use in the Log4j custom node, as opposed to calling Log4j from ESQL as you are doing.
Try:
CALL log4j('MyApplicationFlow.msgflow', 'WARN','My Message is ' || InputRoot.XMLNS.Test) INTO rc; |
|
Back to top |
|
 |
WMBSAM |
Posted: Tue Oct 20, 2009 11:06 am Post subject: |
|
|
 Voyager
Joined: 02 Oct 2009 Posts: 90 Location: Atlanta
|
Tony i tried what you have said but it doesn't work.
I have followed what exactly the manual says but it doesn't work. |
|
Back to top |
|
 |
WMBSAM |
Posted: Tue Oct 20, 2009 8:37 pm Post subject: |
|
|
 Voyager
Joined: 02 Oct 2009 Posts: 90 Location: Atlanta
|
The only success i got is by using the log4j node where the xpath variables work but when i try to use it by esql no matter what i use the xpath or the esql format nothing works.  |
|
Back to top |
|
 |
TonyD |
Posted: Wed Oct 21, 2009 3:45 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
WMBSAM wrote: |
Tony i tried what you have said but it doesn't work.
I have followed what exactly the manual says but it doesn't work. |
WMBSAM,
What result did you get? The Log4j node examples are not applicable when you call Log4j from your ESQL. I assume that 'Test' is the root element of your message. Specify:
InputRoot.XMLNS.Test.AnElementName
:in your Log4j call.
It does work! ... I have tested it. |
|
Back to top |
|
 |
WMBSAM |
Posted: Wed Oct 21, 2009 10:15 pm Post subject: |
|
|
 Voyager
Joined: 02 Oct 2009 Posts: 90 Location: Atlanta
|
My bad acctually i had a attribute in the parent element
Thanks Tony for the valuable advice it really works!!!!  |
|
Back to top |
|
 |
|