Script de commandes runwithtrace pour Linux
Pour activer la fonction de trace de MQ Explorer, fermez et redémarrez MQ Explorer avec le script de commandes runwithtrace. Cette rubrique présente une copie de ce script, qui peut être utilisé sur les systèmes Linux®.
Copiez et sauvegardez le script ci-dessous dans un fichier texte appelé runwithtrace.cmd, puis exécutez-le comme décrit à l'étape 3 de la section "Utilisation de la fonction de trace d'IBM® MQ Explorer dans d'autres environnements Eclipse".
#!/bin/sh
#---------------------------------------------------------------------------
# File Name : runwithtrace
#
# File Description : This script is used when MQ Explorer plug-ins are
# installed into another Eclipse or Eclipse based product.
# It launches eclipse and will run WebSphere MQ Explorer with trace enabled.
#
#---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
# Special processing for enabling trace
# 1. Allow a user to supply their own properties file, pointed to by the
# MQPROPERTIES environment variable
# 2. Otherwise, build a properties file in /tmp which writes trace
# to /var/mqm/trace directory if writeable, otherwise to /tmp itself
# ---------------------------------------------------------------------------
# test if variable is not set or refers to a file that does not exist
if [ -z "$MQPROPERTIES" -o ! -f "$MQPROPERTIES" ]
then
# Create a properties file with the default trace options
MQPROPERTIES=/tmp/mq_trace.properties
# -----------------------------------------------------
# Where should trace go - Try the trace directory first
# -----------------------------------------------------
echo "Confirming write access to the MQ trace directory /var/mqm/trace"
MQTRACE=/var/mqm/trace
# test if dir exists and is writable
if [ -d $MQTRACE -a -w $MQTRACE ]
then
echo "Trace will be written to the MQ trace directory /var/mqm/trace"
else
echo "Trace will be written to the temporary directory /tmp"
MQTRACE=/tmp
fi
# -------------------------------------------------------------
# Now build the default properties file
# -------------------------------------------------------------
echo Diagnostics.MQ=enabled > $MQPROPERTIES
echo Diagnostics.Java=all >> $MQPROPERTIES
echo Diagnostics.Java.Trace.Detail=high >> $MQPROPERTIES
echo Diagnostics.Java.Trace.Destination.File=enabled >> $MQPROPERTIES
echo Diagnostics.Java.Trace.Destination.Console=disabled >> $MQPROPERTIES
echo Diagnostics.Java.Trace.Destination.Pathname=$MQTRACE >> $MQPROPERTIES
echo Diagnostics.Java.FFDC.Destination.Pathname=$MQTRACE >> $MQPROPERTIES
echo Diagnostics.Java.Errors.Destination.Filename=$MQTRACE >> $MQPROPERTIES
fi
# ---------------------------------------------------------------------------
# Build the command line to run
# Look in the current directory
# All parameters passed to this script are passed through.
# Set the load time weaving options, it's set as part of the vmargs parameter.
# ---------------------------------------------------------------------------
# Special case for when MQ Explorer plug-ins are installed in an Eclipse or an
# Eclipse based product.
# eclipse needs to be in current directory.
if [ -f "eclipse" ]
then
explorerCmd="./eclipse"
fi
if [ ! -f "${explorerCmd}" ]
then
echo "ERROR - eclipse executable could not be found in the current directory"
echo "ERROR - This script needs to be run in the same directory as the eclipse executable"
exit 1
fi
# Note.
# In eclipse and eclipse based products the osgi.framework.extensions is set
# as part of the Equinox Weaving plug-ins eclipse installation.
# Therefore unlike in the normal MQ Explorer script LTW_OPTIONS is empty
# LTW_OPTIONS=-Dosgi.framework.extensions=org.eclipse.equinox.weaving.hook
LTW_OPTIONS=
explorerCmd="$explorerCmd $* -vmargs -Xmx512M $LTW_OPTIONS -Dcom.ibm.mq.commonservices=$MQPROPERTIES"
# ---------------------------------------------------------------------------
# Launch MQ Explorer
# ---------------------------------------------------------------------------
echo Launching $explorerCmd
exec $explorerCmd