ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » InitLog4j() didn't work within ESQL Script

Post new topic  Reply to topic
 InitLog4j() didn't work within ESQL Script « View previous topic :: View next topic » 
Author Message
EricL
PostPosted: Thu Jul 19, 2018 1:37 pm    Post subject: InitLog4j() didn't work within ESQL Script Reply with quote

Centurion

Joined: 10 Oct 2014
Posts: 100

Hi,

I installed "Node for log4j (IAM3)" on IIB, I also created a workflow with a node "Log4jLoggingPlugin", the node is tested out to be working as I can see messsages logged into log file (default appender), but when try code log4j within ESQL script, I got 2 error messages:

1. Found multiple definitions for function or procedure named "Main" in module "Transformation_Compute" in default broker schema.

2. Incorrect function or procedure name "log4j" or argument count, Builder Referential Error Marker

The 2 errors are complained about the line:
...
CALL log4j('MyFlow', 'WARN','Message from ESQL') INTO rc;
...

The procudure is as:
CREATE PROCEDURE InitLog4j()
BEGIN
DECLARE rc BOOLEAN;
CALL log4j('MyFlow', 'WARN','Message from ESQL') INTO rc;
IF ( rc = FALSE ) THEN
-- error during logging
END IF;
END;

May I kow how to make correction?

Thanks
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jul 20, 2018 4:39 am    Post subject: Re: InitLog4j() didn't work within ESQL Script Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

EricL wrote:
May I kow how to make correction?


Error 1 sounds like a known problem where Eclipse sometimes adds another Main function rather than editing the existing one.

Error 2 is because you're calling "log4j" but the definition is for "Initlog4j". You need to line them up.

It's a design question if you want to initialize log4j each time before logging or define 2 functions. Multiple initializations are not harmfully.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
EricL
PostPosted: Fri Jul 20, 2018 6:43 am    Post subject: Reply with quote

Centurion

Joined: 10 Oct 2014
Posts: 100

Thanks....
I modified my code a bit:
...
DECLARE rc BOOLEAN;
DECLARE SIMPOC_Log4j_Initialized BOOLEAN;

IF (SIMPOC_Log4j_Initialized = NULL) THEN
CALL initLog4j('C:\ProgramData\IBM\MQSI\brokerlog.xml') INTO rc;
IF (rc = FALSE) THEN
THROW USER EXCEPTION MESSAGE 5560 VALUES('Error Initializing log4j');
END IF;

SET SIMPOC_Log4j_Initialized = TRUE;

CALL log4j_1_1('A_Flow','default','WARN','initLog4j() completed initialization of log4J env.') INTO rc;
...

E.g. call initLog4j() first before using it, strangely, after messge sent in and processed, I still don't see error messages... and I don't see any error messages when build workflow, I'm a bit lost...
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jul 20, 2018 7:03 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

EricL wrote:
E.g. call initLog4j() first before using it, strangely, after messge sent in and processed, I still don't see error messages... and I don't see any error messages when build workflow, I'm a bit lost...


Welcome to the log4j support pac, enjoy your stay

It's a bit temperamental in my experience. It's worth checking rc from the actual call as well as the initialization just to see if that's returning false, but I've seen it return true with no output.

I would suggest making sure the ESQL line is using the same appender/priority/parameters as the node that's working. If the log4j configuration is wrong then the output won't appear and the call will return true (because it successfully called log4j). If it's all correct log4j could still be filtering the line out because of the settings.

We ended up writing an equivalent in-house with better error handing and easier configuration.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » InitLog4j() didn't work within ESQL Script
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.