XML server tracing
Introduction
This topic describes how to configure XML server tracing when deployed to Kubernetes.
For more information about XML server tracing, see Debug configuration in the Social Program Management XML Infrastructure Guide.
However, to use it in a Kubernetes environment you will need to perform the steps described in this section.
In summary, you will need to:
- Create a new ConfigMap to override the trace setting in the default
xmlserverconfig.xml.template
file - Optionally you can (for the
xmlserver
deployment only) create a ConfigMap to override its default log4j properties file.
The Kubernetes commands presented in this topic are generic and assume a helm release name of releasename
.
To enter the commands in this topic as-is you need to enter the following commands first, substituting <name_space>
for the OpenShift project name or AKS namespace for your deployment:
- For Openshift:
- Create an alias for the
oc
command:- Bash:
alias k='oc'
- Windows PowerShell:
Set-Alias -Name k -Value oc
- Bash:
- Set the default namespace:
k project <name_space>
- Create an alias for the
- For AKS:
- Create an alias for the
kubectl
command:- Bash:
alias k='kubectl'
- Windows PowerShell:
Set-Alias -Name k -Value kubectl
- Bash:
- Set the default namespace:
k config set-context --current --namespace=<name_space>
- Create an alias for the
Specifying the XML server trace setting
To enable XML server tracing you need to modify the out-of-the-box setting:
- Copy the
xmlserver
pod’sxmlserverconfig.xml.template
file to your local file system using the Kubernetes copy command. For example:k cp <xmlserver-pod-name>:xmlserverconfig.xml.template xmlserverconfig.xml.template -c xmlserver
- Edit the local
xmlserverconfig.xml.template
file to change theTRACE_TRAFFIC
value as follows:<TRACE_TRAFFIC>true</TRACE_TRAFFIC>
- Delete the existing
releasename-xmlserverconfig-template-cm
ConfigMap. For example:k delete configmap releasename-xmlserverconfig-template-cm
- Create a new
releasename-xmlserverconfig-template-cm
ConfigMap using your edited copy ofxmlserverconfig.xml.template
; for example:k create releasename-xmlserverconfig-template-cm --from-file=xmlserverconfig.xml.template
The existingreleasename-xmlserverconfig-template-cm
ConfigMap in thereleasename-xmlserver
deployment will be replaced with your newly edited file. - You must restart the xmlserver pod(s) for the new setting to be used. You can restart the pod(s) using the Kubernetes
delete pod
command. For example:k delete pod <xmlserver-pod-name>
This will terminate the running pod and start a new pod that reflects the new ConfigMap.
Modifying the log4j properties
The out-of-the-box log4j2.properties
file will write the XML server trace output to stdout, which is routed to the pod’s tmp/xmlserver.log
file.
Optionally, you can provide your own custom log4j properties file.
For instance, it can be useful to modify the output layout to indicate the time-of-day and the worker thread processing the XML server job.
For example this log4j pattern:
appender.A1.layout.pattern=[%p] %d{ABSOLUTE_MICROS} [%t] [%c{1}] %m%n
will produce output in this format:
[xmlserver] [INFO] 14:01:46,165000 [ThreadPoolWorker-1] [XMLConnectionHandler] - Awaiting job configuration.
as compared to the out-of-the-box format:
[xmlserver] [INFO] [XMLConnectionHandler] Awaiting job configuration.
For more information on specifying log4j patterns see the Layouts section of the log4j documentation.
To modify the log4j2.properties
file:
- Copy the
xmlserver
pod’slog4j2.properties
file to your local file system using the Kubernetes copy command. For example:k cp <xmlserver-pod-name>:/opt/ibm/Curam/xmlserver/log4j2.properties log4j2.properties -c xmlserver
- Edit the local file to specify the desired log4j configuration settings.
- Create a ConfigMap using your edited copy of
log4j2.properties
; for example:k create configmap xmlserver-log4j-props-cm --from-file=log4j2.properties
- Edit the xmlserver deployment to specify the new ConfigMap:
k edit deployment releasename-xmlserver
- In the subsequent edit session add the entries for the new ConfigMap, matching the name used when creating it; for example:
...volumeMounts:...- mountPath: /opt/ibm/Curam/xmlserver/log4j2.propertiesname: xmlserver-log4j-props-cmsubPath: log4j2.properties...volumes:...
- You must restart the xmlserver pod(s) for it to reflect the new trace setting. You can restart the pod by using the Kubernetes
delete pod
command. For example:k delete pod <xmlserver-pod-name>
This will terminate the running pod and start a new pod that reflects the new ConfigMap that contains the log4j properties.