Overview

The Linux Broker Agent can log to the system log (syslog), but syslog needs to be configured to receive Log4J log messages. For ease of configuration, we recommend using the syslog-ng package, though not covered here, other syslog variants may also work in your environment.

The configuration file bundled with the Linux Broker Agent has a default log level of ERROR which only logs errors. The bundled configuration file cannot be directly edited.

This document will cover installing syslog-ng, creating a custom
configuration file and changing the log levels.

Instructions

This section will guide you through:

  • Installing syslog-ng
  • Enabling network syslog
  • Configuring the Linux Broker Agent to use a custom logging configuration
  • Adjusting the Linux Broker Agent logging levels
  • Restoring the default logging configuration once you have finished troubleshooting.

Install syslog-ng

The following are the steps required to install on SUSE and RHEL.

SUSE syslog-ng Installation Steps

On SuSE systems, install syslog-ng package by running:

[[code style="text-align: left;font-family: Consolas;font-size: 0.85em"]]czoyOTpcInN1ZG8genlwcGVyIGluc3RhbGwgc3lzbG9nLW5nXCI7e1smKiZdfQ==[[/code]]

Redhat syslog-ng Installation Steps

On Redhat systems, install syslog-ng package by running:

[[code style="text-align: left;font-family: Consolas;font-size: 0.85em"]]czoyNjpcInN1ZG8geXVtIGluc3RhbGwgc3lzbG9nLW5nXCI7e1smKiZdfQ==[[/code]]

Now syslog-ng is installed, you need to enable network syslog.

Enable Network Syslog

Unfortunately Log4J cannot send messages to a domain socket so uses the loopback network interface instead, and this needs to be enabled.

Edit the syslog-ng.conf to enable network syslog:

[[code]]czozNzpcInN1ZG8gdmkgL2V0Yy9zeXNsb2ctbmcvc3lzbG9nLW5nLmNvbmZcIjt7WyYqJl19[[/code]]

Locate and change the following lines in the syslog-ng.conf file from:
[[code style="text-align: left;font-family: Consolas;font-size: 0.85em"]]czo4NDpcIiMgIyB1bmNvbW1lbnQgdG8gcHJvY2VzcyBsb2cgbWVzc2FnZXMgZnJvbSBuZXR3b3JrOiAjICN1ZHAoaXAoXCIwLjAuMC4we1smKiZdfVwiKSBwb3J0KDUxNCkpO1wiO3tbJiomXX0=[[/code]]

to:
[[code style="text-align: left;font-family: Consolas;font-size: 0.85em"]]czo4NTpcIiMgIyB1bmNvbW1lbnQgdG8gcHJvY2VzcyBsb2cgbWVzc2FnZXMgZnJvbSBuZXR3b3JrOiAjIHVkcChpcChcIjEyNy4wLjAue1smKiZdfTFcIikgcG9ydCg1MTQpKTtcIjt7WyYqJl19[[/code]]

Save and close the syslog-ng.conf file then and restart syslog
[[code style="text-align: left;font-family: Consolas;font-size: 0.85em"]]czoyNzpcInN1ZG8gc2VydmljZSBzeXNsb2cgcmVzdGFydFwiO3tbJiomXX0=[[/code]]

Linux Broker Agent error messages will now appear in syslog file (i.e. /var/log/messages).

The next section will explain how to configure the Linux Broker Agent to use a custom logging configuration file.

Configure the Linux Broker Agent Configuration To Use Custom Logging Configuration File

Download the example log4j.xml file (see end of this document) and copy the log4j.xml file to /etc/xdl.

Now we need to change the Linux Broker Agent to use this custom logging configuration file. To do this edit /etc/xdl/ctx-vda.conf and change:

[[code style="text-align: left;font-family: Consolas;font-size: 0.85em"]]czoxNDpcIiNMb2c0Q29uZmlnPVwiXCJcIjt7WyYqJl19[[/code]]

to:
[[code style="text-align: left;font-family: Consolas;font-size: 0.85em"]]czozMjpcIkxvZzRqQ29uZmlnPVwiL2V0Yy94ZGwvbG9nNGoueG1sXCJcIjt7WyYqJl19[[/code]]

Restart the Broker Agent service.
sudo /sbin/service ctxvda restart

The example log4j.xml file has the log level set to trace which is useful for troubleshooting but quite verbose so you don’t always want to use this level of logging in production. The next section will cover adjusting the Linux Broker Agent logging level.

Adjusting the Linux Broker Agent Linux Broker Agent Logging Levels

The root Log4J log level is sufficient for controlling most logging levels. It can be found in the element tag . To adjust this level, edit /etc/xdl/log4j.xml and set the loglevel setting. For example:

[[code style="text-align: left;font-family: Consolas;font-size: 0.85em"]]czozMDpcIiZsdDtsb2dsZXZlbCB2YWx1ZT1cInRyYWNlXCImZ3Q7XCI7e1smKiZdfQ==[[/code]]

Individual components of the Broker Agent may also be adjusted, such enabling Broker Agent performance counters (stored in the file /var/log/xdl/vdaperf.log), by turning on the loglevel for the logger name “com.citrix.cds.common.PerformanceCounters”.

Restart the Broker Agent service.

[[code style="text-align: left;font-family: Consolas;font-size: 0.85em"]]czozMzpcInN1ZG8gL3NiaW4vc2VydmljZSBjdHh2ZGEgcmVzdGFydFwiO3tbJiomXX0=[[/code]]

The log level defines the minimum rank of messages to log:

  • ALL – The lowest possible rank and is intended to turn on all logging.
  • TRACE – Designates finer-grained informational events than the DEBUG.
  • DEBUG – Designates fine-grained informational events that are most useful to debug an application.
  • INFO – Designates informational messages that highlight the progress of the application at coarse-grained level.
  • WARN – Designates potentially harmful situations.
  • ERROR – Designates error events that might still allow the application to continue running.
  • FATAL – Designates very severe error events that will presumably lead the application to abort.
  • OFF – The highest possible rank and is intended to turn off logging.

Restore Production or Default Linux Broker Agent Logging Levels

To restore the log configuration back to default, restore the configuration setting in /etc/xdl/ctx-vda.conf back to:

[[code style="text-align: left;font-family: Consolas;font-size: 0.85em"]]czoxNDpcIiNMb2c0Q29uZmlnPVwiXCJcIjt7WyYqJl19[[/code]]

And restart the Broker Agent service.
[[code style="text-align: left;font-family: Consolas;font-size: 0.85em"]]czoyNzpcInN1ZG8gc2VydmljZSBjdHh2ZGEgcmVzdGFydFwiO3tbJiomXX0=[[/code]]