VMware Cloud Director has different logging levels. The default logging configuration might not be sufficient for busy environments or for capturing events whilst troubleshooting. You might need to change the level of logging and even the sizes and number of files retained.

Important: Verify that you are aware of the consequences to your VMware Cloud Director server group when making changes to the log configuration without guidance from the VMware Global Support team. If you change a logging level to a more verbose one, the logs might start to expand very fast, and your VMware Cloud Director environment might run out of disk space.

The VMware Cloud Director logs are located in the /opt/vmware/vcloud-director/logs/ directory.

The VMware Cloud Director log configuration file is located in the /opt/vmware/vcloud-director/etc/ directory. The name of the log configuration file is log4j.properties.

If you customize the log4j.properties log configuration file, before a VMware Cloud Director upgrade, you must make a copy of the log4j.properties, and after the upgrade, manually insert any missing sections.

To improve your log retention and to ensure that the VMware Cloud Director logs are kept for a certain amount of time, consider using a syslog server.

Table 1. Logging Levels
Logging Level Description
FATAL FATAL is the least verbose level. This level logs very severe error events that might cause the application to fail.
ERROR This level logs error events that might still allow the application to continue running.
WARN This level logs potentially harmful situations and warnings.
INFO This level logs informational messages that highlight the progress of the application at a coarse-grained level.
DEBUG This level logs informational events that are most useful to debug an application at a fine-grained level.
TRACE TRACE is the most verbose level. This level logs informational events at a more fine-grained level than the DEBUG level logging.

Prerequisites

Make a backup copy of the /opt/vmware/vcloud-director/etc/log4j.properties file.

Consider

Procedure

  1. Log in directly or by using an SSH client to the VMware Cloud Director console as root.
  2. Open the /opt/vmware/vcloud-director/etc/log4j.properties file in a text editor.
  3. Locate the Default vCloud loggers section, and modify the log level for the loggers.
    The following example shows the log level set to the most verbose level.
    log4j.logger.com.vmware.vcloud=TRACE 
    log4j.logger.com.vmware.ssdc=TRACE
  4. Locate the log file definition that you want to update.
    log4j.appender.Feature.File=logs/File_Name
    For example, you might want to change the logging level for the # Component appender for container debug section. The last line of the section configures the level of logging that the file captures.
  5. Set the logging level to the value you want.
    Important: Verify that you are aware of the consequences to your VMware Cloud Director server group when making changes to the log configuration without guidance from the VMware Global Support team.
    The following example changes the line to match the most verbose level.
    log4j.appender.vcloud.system.debug.threshold=TRACE
  6. If you change the recording to a more verbose level, you might need to increase the number of log backups and the size of the log files.
    1. Locate the MaxFileSize and MaxBackupIndex lines.
      log4j.appender.vcloud.system.debug.MaxFileSize=
      log4j.appender.vcloud.system.debug.MaxBackupIndex=
    2. Change the default settings.
      For example, if you want the log files to expand to 50 MB before they rollover and to keep the last 18 logs, change the lines as follows.
      log4j.appender.vcloud.system.debug.MaxFileSize=50000KB
      log4j.appender.vcloud.system.debug.MaxBackupIndex=18
      When a file reaches the selected 50 MB size, VMware Cloud Director continues to log data in a new file and keeps up to 18 backups.
    Important: If you change a logging level to a more verbose one, the logs might start to expand very fast, and your VMware Cloud Director environment might run out of disk space.
  7. Save the /opt/vmware/vcloud-director/etc/log4j.properties file.
    VMware Cloud Director applies the changes immediately. The Log4J.properties file does not have explicit lines for changing the size and amount of logs that VMware Cloud Director keeps.

Control the API Request Logging in VMware Cloud Director

You can control the process of capturing and storing information about incoming requests in VMware Cloud Director.

VMware Cloud Director logs the incoming requests to the VMware Cloud Director cells in request logs. The logs have names of the form YYYY_MM_DD.request.log. You can find the VMware Cloud Director request.log files in the /opt/vmware/vcloud-director/logs/ directory, but you cannot configure the logs through the log4j.properties file.

You can use the manage-config subcommand of the command line tool to control the API request logging. The manage-config subcommand changes the settings for the whole server group. For more information about the manage-config subcommand options and arguments, see Updating Application Configuration Settings in VMware Cloud Director.

The log rotation can happen maximum once per day and is not linked to the size of the individual log files or the total size of all log files. You can control the rotation policy by changing the amount of days for which VMware Cloud Director keeps the logs.

Procedure

  1. Log in directly or by using an SSH client to the OS of the VMware Cloud Director cell as root.
  2. If you want change the retention policy of the request logs, use the manage-config subcommand of the cell management tool.
    The retention policy value represents the number of days for which VMware Cloud Director retains the National Center for Supercomputing Applications (NCSA) compliant request log. The default value is 0, where 0 means forever. Deleting the value also keeps the logs forever. The least amount of time you can keep the logs is 1 day.
    /opt/vmware/vcloud-director/bin/cell-management-tool manage-config --name "vcloud.http.log.retainDays" --value New_Value
  3. For the changes to take effect, you must restart the cells.
    After you restart a cell, it begins using the updated value. You can restart part of the cells or all of the cells at once.