|
This note has been tested with Ant 1.8 and Groovy 1.8, with Tibco Runtime Agent (TRA) 5.6.
Tracing can be added to a deployed BW engine by modifying the tra file after deployment. Just add the following to the tra file(s):
Trace.Startup=true
Trace.Task.*=true
Trace.JC.*=true
Trace.Engine=true
Trace.Debug.*=true
Since each new deployment overwrites the tra file it is better to use ant and AppManage for scripted deployments and also script the modifications of the tra file afterwards. You will also need an ant target calling AppManage to start the BW engine after modifying the tra file.
So this approach involves three scripted steps: deploying the ear file using AppManage, changing the tra file and finally starting the application using AppManage. This note deals with the second scripted step: the scripted change of the tra file only. See below the ant target to do this.
<target name="addTracing">
<groovy>
<![CDATA[
def bwHost = properties.get("bw.host")
def sshUser = properties.get("sshUser")
def sshPassword=properties.get("ssh.password")
def tibcoInstallationDir = properties.get("tibco.server.installationDir")
def tibcoDomainDir = tibcoInstallationDir +"/tra/domain/" +properties.get("tibco.admin.domain")
def packageName = properties.get("source.packagename")
def traDir = tibcoDomainDir +"/application/" +packageName
def traFileName = properties.get("tibco.traFileName")
ant.scp(
trust:true,
file: sshUser +":" +sshPassword +"@" +bwHost +":" +traDir +"/" +traFileName,
todir: "."
){}
ant.copy(file: traFileName, tofile:traFileName +"_orig" +properties.get("BUILD_ID")){}
ant.propertyfile(
file:traFileName
) {
entry(key: 'Trace.Startup', value:"true")
entry(key: 'Trace.Task.*', value:"true")
entry(key: 'Trace.JC.*', value:"true")
entry(key: 'Trace.Engine', value:"true")
entry(key: 'Trace.Debug.*', value:"true")
}
ant.scp(
trust:true,
todir: sshUser +":" +sshPassword +"@" +bwHost +":" +traDir,
file: traFileName
){}
]]>
</groovy>
</target>
First note the usage of properties to get the BW host, password and the BW deployment name to add tracing to. Instead of using properties for the server password and host name one could also use ssh trusted key authentication to log in and extract the host name from the deployment xml file, e.g. within Groovy with XmlSlurper.
Then recognize that Tibco tra files are in fact Ant property files. That means that adding and modifying properties within tra files is straightforward with the Ant propertyfile task.
Of course the ant code above can be executed by calling ant from the command line. But it is much easier to set up a build system such as Jenkins and then call the script from its web front-end with just a single click.
|