|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Log4j XML Configuration in local broker v10 at windows |
« View previous topic :: View next topic » |
Author |
Message
|
muthu121521 |
Posted: Tue Apr 28, 2020 4:54 am Post subject: Log4j XML Configuration in local broker v10 at windows |
|
|
Apprentice
Joined: 31 Aug 2015 Posts: 36
|
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
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 |
|
 |
lfrestrepog |
Posted: Wed Apr 29, 2020 4:32 am Post subject: |
|
|
Novice
Joined: 08 Jul 2014 Posts: 22
|
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 Gutiérrez |
|
Back to top |
|
 |
lfrestrepog |
Posted: Wed Apr 29, 2020 4:47 am Post subject: |
|
|
Novice
Joined: 08 Jul 2014 Posts: 22
|
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 Gutiérrez |
|
Back to top |
|
 |
muthu121521 |
Posted: Wed Apr 29, 2020 6:31 am Post subject: |
|
|
Apprentice
Joined: 31 Aug 2015 Posts: 36
|
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 |
|
 |
lfrestrepog |
Posted: Wed Apr 29, 2020 7:10 am Post subject: |
|
|
Novice
Joined: 08 Jul 2014 Posts: 22
|
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 Gutiérrez |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|