Author |
Message
|
cristiano_js |
Posted: Wed Oct 13, 2010 2:02 pm Post subject: Log4J configuration file with relative path |
|
|
Newbie
Joined: 13 Oct 2010 Posts: 2
|
Hi guys,
I'm new in WMB world. I need to use the Log4J node, but I need that the
configuration file use relative paths. Is possible?
I tryed to put the configuration file in some folder and put the folder in bar file, but failed to load the file.
Some sugestions?
Thanks. |
|
Back to top |
|
 |
nukalas2010 |
Posted: Wed Oct 13, 2010 8:32 pm Post subject: Re: Log4J configuration file with relative path |
|
|
 Master
Joined: 04 Oct 2010 Posts: 220 Location: Somewhere in the World....
|
Quote: |
I tryed to put the configuration file in some folder and put the folder in bar file, but failed to load the file.
|
Place the Configuration file in the Broker system anywhere, If suppose if you place it on the Desktop then in the Log4j node Log4jConfigFile mention as C:\Documents and settings\username\Desktop\filename.xml
It works
me too working on same node..  |
|
Back to top |
|
 |
cristiano_js |
Posted: Thu Oct 14, 2010 4:25 am Post subject: Log4J configuration file with relative path |
|
|
Newbie
Joined: 13 Oct 2010 Posts: 2
|
Sorry, I expressed badly.
Putting the file with absolute path e.g: C: \ log \ log4j.xml worked.
But, I like to put this file and the dtd inside the bar, because in
my production environment I can't create a folder to put these
files. I Need to deploy these files together the with bar file.
Thanks. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Oct 14, 2010 5:22 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
While it is possible to reference the file when it is deployed in the BAR, many people just toss it into <sharedclasses> directory of the broker installation. That way, as new logging is added, there is one file that contains all logging info rather than a bunch of properties files where people can't find the info they need during code maintenance. Also, if you deploy your BAR to more than one EG, it becomes unweildy managing multiple versions of the properties file.
You don't need to create any new directories and if you ask your system admin nicely, I'm sure there are policies and procedures that allow you to place the file where it is intended to be. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
joebuckeye |
Posted: Thu Oct 14, 2010 5:56 am Post subject: |
|
|
 Partisan
Joined: 24 Aug 2007 Posts: 365 Location: Columbus, OH
|
Quote: |
But, I like to put this file and the dtd inside the bar, because in
my production environment I can't create a folder to put these
files. I Need to deploy these files together the with bar file. |
Others can correct me if I'm wrong but the bar file is merely a delivery mechanism, not a file that is itself 'deployed' to a server.
When the Broker (v7) or Config Manager(v6 and earlier) get a bar file they deploy all the files inside of it per it's design. CMF (compiled message flows) get deployed to the execution group, JAR files go to the JAR dir, XML files to the XML dir, etc.
I'm not sure where the broker would deploy a properties file or if it would error out.
The bar file is not deployed like a jar file is. I am seeing more and more of this type of question around the broker, must be all the new Java coders doing broker work and being told the bar file is like a jar file and assuming they can put files into it to reference in their code during runtime. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Oct 14, 2010 6:53 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Including any file in the BAR is possible. Here is the code to find it once the BAR is deployed:
Code: |
BrokerProxy b = BrokerProxy.getLocalInstance();
ExecutionGroupProxy e = b.getExecutionGroupByName(this.getExecutionGroup().getName());
String egUuid = e.getProperty("uuid"); // ExecutionGroup UUID.
DeployedObject xfs = e.getDeployedObjectByName("WhateverFile_youWant_toSee.esql");
if( xfs != null ){
String envMQSIWorkpath = System.getenv("MQSI_WORKPATH");
if( envMQSIWorkpath != null ){
// Change "config/XML" to the directory you want.
String file = envMQSIWorkpath+"/components/"+getBroker().getName()+"/"+egUuid+"/config/XML/"+"WhateverFile_youWant_toSee.esql";
try {
BufferedReader input = new BufferedReader(new FileReader( file ));
} catch (IOException ex){}
}
|
_________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Oct 14, 2010 7:59 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
lancelotlinc wrote: |
Including any file in the BAR is possible. Here is the code to find it once the BAR is deployed: |
It's less clear how to use that with the Log4J supportpack node. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Oct 14, 2010 8:23 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
@mqjeff
The log4j support pak for broker needs maintenance. It does not work most of the time. IBM chooses not to release it's source code, so we cannot use it in production, or fix the problems. And since its a support pak, if we wanted support from IBM, it would be extra charge. Therefore, its just better to use log4j directly, without the support pak. That way, all the source code is available because log4j source code is public domain.
@joebuckeye
Go Cincinati! bar = jar. jar = zip. Therefore, bar = zip. When you deploy a BAR to a Broker instance, what happens is the zip file gets exploded onto disk in the location MQSI_WORKPATH/components/$Brokername/$EG_UUid _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Vitor |
Posted: Thu Oct 14, 2010 8:49 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
lancelotlinc wrote: |
And since its a support pak, if we wanted support from IBM, it would be extra charge. |
Point of clarification for less experienced readers - not all support pacs require an extra charge to IBM. This varies by which Category the support pac falls into. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
joebuckeye |
Posted: Thu Oct 14, 2010 2:27 pm Post subject: |
|
|
 Partisan
Joined: 24 Aug 2007 Posts: 365 Location: Columbus, OH
|
lancelotlinc wrote: |
Go Cincinati! bar = jar. jar = zip. Therefore, bar = zip. When you deploy a BAR to a Broker instance, what happens is the zip file gets exploded onto disk in the location MQSI_WORKPATH/components/$Brokername/$EG_UUid |
I think you are missing the config/ directory.
Here is what I see under ${MQSI_WORKPATH}/components/<broker name>/<eg uuid>/config:
Code: |
drwxrws--- 2 mqsiuid mqbrkrs 256 Sep 24 11:08 XSD/
drwxrws--- 2 mqsiuid mqbrkrs 256 Sep 24 11:08 PHP/
drwxrws--- 2 mqsiuid mqbrkrs 256 Sep 24 11:08 MAR/
drwxrws--- 2 mqsiuid mqbrkrs 256 Sep 24 11:08 IDL/
drwxrws--- 2 mqsiuid mqbrkrs 256 Sep 24 11:08 Adapter/
-r--r----- 1 mqsiuid mqbrkrs 2 Oct 14 13:14 jvmLastUsedDebugPort
drwxrws--- 2 mqsiuid mqbrkrs 256 Oct 14 13:31 XSL/
drwxrws--- 2 mqsiuid mqbrkrs 4096 Oct 14 13:31 XML/
drwxrws--x 2 mqsiuid mqbrkrs 4096 Oct 14 13:31 JAR/
|
And the file types listed go into these directories.
If you say the other files go into the base execution group directory I'll believe you but we put as little as possible into our bar files (cmf's and dictionary files are about it and the jar file for JCN code only). All files we reference in flows "live" outside this structure. If their are non-JCN jars they go into the shared-classes directory. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Oct 14, 2010 6:39 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
lancelotlinc wrote: |
@mqjeff
The log4j support pak for broker needs maintenance. It does not work most of the time. IBM chooses not to release it's source code, so we cannot use it in production, or fix the problems. And since its a support pak, if we wanted support from IBM, it would be extra charge. Therefore, its just better to use log4j directly, without the support pak. That way, all the source code is available because log4j source code is public domain. |
I do not disagree with that.
Nor with how Vitor clarified the point.
I merely suggested that, if the customer asks a question about the supportPak, that answering it in terms of code in a JavaCompute node may at best be confusing.
The best bet with any supportPak at all is to always contact the person or persons listed as being responsible for it. |
|
Back to top |
|
 |
nukalas2010 |
Posted: Thu Oct 14, 2010 8:45 pm Post subject: Re: Log4J configuration file with relative path |
|
|
 Master
Joined: 04 Oct 2010 Posts: 220 Location: Somewhere in the World....
|
cristiano_js wrote: |
But, I like to put this file and the dtd inside the bar, because in
my production environment I can't create a folder to put these
files. I Need to deploy these files together the with bar file.
|
@cristiano
I am also new to working on this node..
I cant understand what u want to say  |
|
Back to top |
|
 |
|