Products | Versions |
---|---|
TIBCO DataSynapse GridServer | - |
Not Applicable | - |
Resolution:
How to use Log4j and Commons-Logging for GS4.2 or GS5.0:
DataSynapse provides Commons-Logging classes inside the Engine jar file. You will have to add the log4j jar files inside your gridlib, then you will have to add the following code in the constructor of your service Class for GS5.0:
LogFactory.releaseAll();
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Log4JLogger");
System.setProperty(LogFactory.FACTORY_PROPERTY, "org.apache.commons.logging.impl.Log4jFactory");
LogFactory.getFactory();
log = LogFactory.getLog(this.getClass());
For GS4.2:
log = LogFactory.getLog(this.getClass()); is needed
You will have to create a private variable: private Log log;. It will be initialized by the constructor.
The Engine will need to use the system ClassLoader instead of the default. To change the default ClassLoader to the system, you will need to log on to the Director and follow those steps:
1. Go to Engine -> Engine Configuration
2. Select or Create a new Engine configuration
3. Go to Classes, Libraries, and Paths
4. Change Classloader value to System
5. Go to Engine JVM section
6. add -Dds.GridLibManager.useRelativePath=true to Command-line Arguments
7. Click on Save
Note: The DSEngine.jar can be found under webappsliveclusterWEB-INFetc and will need to be added to your GridLib.
Note: The example attached contains DSEngine.jar for GS5.0, you will need to replace it with the DSEngine.jar from you GS install.
Example:
MyGridLib-1.0.zip -> grid-library.xml
-> jars (directory)
-> DSEngine.jar
-> log4j-1.2.14.jar
-> log4j.properties
-> myService.jar
-> ...