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 IndexWebSphere Message Broker SupportLog4j XML Configuration in local broker v10 at windows

Post new topicReply to topic
Log4j XML Configuration in local broker v10 at windows View previous topic :: View next topic
Author Message
muthu121521
PostPosted: Tue Apr 28, 2020 4:54 am Post subject: Log4j XML Configuration in local broker v10 at windows Reply with quote

Apprentice

Joined: 31 Aug 2015
Posts: 31

Hi all,
I have the below piece of code which was used to initiate log

Code:
Call initLog4j('iib_log4j.xml') INTO bflag;


I have log4j set up everything ready, but i am not able to make my broker read the the file 'iib_log4j.xml' and log it.

Quote:
Steps i have had taken:
I have packaged jar file by adding the below files
1. iib_log4j.xml
2. log4j.dtd


I have placed the jar file into the below directory
C:\ProgramData\IBM\MQSI\config\TESTNODE\default\shared-classes
Where TESTNODE is my broker and default is my EG, I have restarted my broker.

But still my broker did not load the iib_log4j.xml when i call the statement
Code:
Call initLog4j


But if i promote an external variable inplace of 'iib_log4j.xml' and provide the fullpath of the log4j xml like below

C:\\Users\\xxxxx\\IIB_Log4j\\iib_log4j.xml

It does work, how do i resolve the issue of not referencing the full path of the log4j xml file and making the changes in my code, there are many applications and many places i have to make changes.

What changes should i do to make the broker automatically load the 'iib_log4j.xml' when i call the the below code
Code:
Call initLog4j('iib_log4j.xml') INTO bflag;


should i have to make any changes into my environment variables to make sure the broker load the log4j xml?
Back to top
View user's profile Send private message
lfrestrepog
PostPosted: Wed Apr 29, 2020 4:32 am Post subject: Reply with quote

Novice

Joined: 08 Jul 2014
Posts: 17

Hello, good day.

Maybe you can pass that path as a system property. I think that would be kind of a dirty hack, but should work:

Code:
mqsichangeproperties BUS -e IS -o ComIbmJVMManager -n jvmSystemProperty -v '-DlogPropertiesPath=probably better to use full path here anyway'


You can even use a user defined configurable service for that property (and that should be easier to maintain if you have the same need in different IS).

Also, just out of curiosity, why use log4j? The bus already has other logging facilities.

Stay safe. Wash your hands frequently.
_________________
--
Luis Fernando Restrepo Gutirrez
Back to top
View user's profile Send private message
lfrestrepog
PostPosted: Wed Apr 29, 2020 4:47 am Post subject: Reply with quote

Novice

Joined: 08 Jul 2014
Posts: 17

Can you share the code of your initLog4j method? and where in your jar file is the iib_log4j.xml located?

Without more clues on your implementation, I assume this
Code:
Call initLog4j('iib_log4j.xml') INTO bflag;
, would look for the file in the working directory for the jvm, which I believe is not at all a good place for that configuration file.
_________________
--
Luis Fernando Restrepo Gutirrez
Back to top
View user's profile Send private message
muthu121521
PostPosted: Wed Apr 29, 2020 6:31 am Post subject: Reply with quote

Apprentice

Joined: 31 Aug 2015
Posts: 31

Hi,

Thanks for replying.

Here it is the code for initLog4j

Code:
CREATE FUNCTION initLog4j( IN CONFIG_FILE_NAME CHARACTER )
   RETURNS BOOLEAN
   LANGUAGE JAVA
   EXTERNAL NAME "com.ibm.broker.IAM3.Log4jNode.initLog4j";


I have created the jar file using the below command

Code:
jar cvf C:\Data\Logs\EG\default_Log4j_Config_Files.jar C:\Data\Logs\EG\iib_log4j.xml  C:\Data\Logs\EG\log4j.dtd


I have pasted the jar file default_Log4j_Config_Files.jar into the directory C:\ProgramData\IBM\MQSI\config\TESTNODE\default\shared-classes
Back to top
View user's profile Send private message
lfrestrepog
PostPosted: Wed Apr 29, 2020 7:10 am Post subject: Reply with quote

Novice

Joined: 08 Jul 2014
Posts: 17

Okay, and is java isolation enabled in your application?

What happens if you try to deploy your jar in a static library (referenced from the application)?
_________________
--
Luis Fernando Restrepo Gutirrez
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportLog4j XML Configuration in local broker v10 at windows
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.