Home > Virtualization > vCenter and Solutions Logs: How to Change the Settings

vCenter and Solutions Logs: How to Change the Settings

Logging is an important tool for system monitoring and troubleshooting. vCenter has comprehensive logs for itself and related solutions. We’ll introduce how to change the settings for these logs in vCenter appliance. One obvious use case is to increase the log levels for troubleshooting.

vCenter Logs
As usual, the vCenter configuration file resides in a subfolder in the /etc folder.

Time to learn how to "Google" and manage your VMware and clouds in a fast and secure

HTML5 App
# vim /etc/vmware-vpx/vpxd.cfg
<config><log>
    <compressOnRoll>true</compressOnRoll>
    <level>info</level>
    <maxFileNum>30</maxFileNum>
    <maxFileSize>52428800</maxFileSize>
    <memoryLevel>verbose</memoryLevel>
  </log></config>

As you can see, the log level is defined within the tag with default value of info. All the levels of vCenter include none, error, warning, info, verbose, trivia, in an order from less to more detailed messages.

The vCenter logs are in the /var/log/vmware/vpx folder with file name starting with vpxd prefix. You can use vSphere API to access the logs. In parallel with vpx folder are sso, vami, vsphere-client for related logs.

vCenter Solutions Logs
Most of the solutions on vCenter are written in Java with log4j framework for logging. To change the settings of the logs for these solutions, you need to change the corresponding log4j.properties file.

To find out these files, it’s pretty easy on the vCenter appliance with the find command as follows:

# find / -name log4j.properties
/usr/lib/vmware-vsphere-client/server/work/org.eclipse.virgo.kernel.deployer_3.0.3.RELEASE/staging/global/bundle/com.vmware.vco.vcoservice/5.1.0/vco-service-5.1.0.jar/log4j.properties
/usr/lib/vmware-vsphere-client/server/work/org.eclipse.virgo.kernel.deployer_3.0.3.RELEASE/staging/global/bundle/com.vmware.vco.vcoservice/5.1.0/vco-service-5.1.0.jar-past/log4j.properties
/usr/lib/vmware-vsphere-client/server/work/org.eclipse.virgo.kernel.deployer_3.0.3.RELEASE/staging/global/bundle/com.vmware.mks.console/1.0.0/console-1.0.0.war/console-distro/resources/log4j.properties
/usr/lib/vmware-vsphere-client/server/work/org.eclipse.virgo.kernel.deployer_3.0.3.RELEASE/staging/global/bundle/com.vmware.mks.console/1.0.0/console-1.0.0.war-past/console-distro/resources/log4j.properties
/usr/lib/vmware-vpx/inventoryservice/scripts/log4j.properties
/usr/lib/vmware-vpx/inventoryservice/lib/server/config/log4j.properties
/usr/lib/vmware-vpx/sps/conf/log4j.properties
/usr/lib/vmware-vpx/inventoryservice-registration/log4j.properties
/usr/lib/vmware-vpx/tomcat/webapps/vsm/WEB-INF/classes/log4j.properties
/usr/lib/vmware-vpx/tomcat/webapps/sms/WEB-INF/classes/log4j.properties
/usr/lib/vmware-vpx/tomcat/webapps/eam/WEB-INF/classes/log4j.properties
/usr/lib/vmware-vpx/tomcat/webapps/statsreport/WEB-INF/classes/log4j.properties
/usr/lib/vmware-vpx/tomcat/webapps/vws/WEB-INF/classes/log4j.properties
/usr/lib/vmware-vpx/tomcat/webapps/ls/WEB-INF/classes/log4j.properties
/usr/lib/vmware-sso/webapps/sso-adminserver/WEB-INF/classes/log4j.properties
/usr/lib/vmware-sso/webapps/lookupservice/WEB-INF/classes/log4j.properties

Most of these files can be easily mapped to corresponding components. As expected, the log4j.properties files follow the standard log4j framework. The following is an example file:

# vim /usr/lib/vmware-vpx/tomcat/webapps/vws/WEB-INF/classes/log4j.properties
# Set root category priority to ERROR and appender to LOGFILE
log4j.rootCategory=ERROR, LOGFILE
 
# Set vim package loggers
log4j.logger.com.vmware.vim=INFO
# Uncomment additivity line to not log event logs to LOGFILE
# log4j.additivity.com.vmware.vim.common.eventLog=false
 
# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
log4j.appender.LOGFILE.File=${vim.logdir}/vws.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.MaxFileSize=5MB
log4j.appender.LOGFILE.MaxBackupIndex=10
log4j.appender.LOGFILE.Threshold=INFO
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=[%d{ISO8601} %t %x %-5p %c] %m%n
 
# CIM Diagnostics
log4j.logger.com.vmware.vim.cimmonitor.util.CimDiagnostics=INFO, DIAG
log4j.additivity.com.vmware.vim.cimmonitor.util.CimDiagnostics=false
 
# DIAG is set to be a File appender using a PatternLayout.
log4j.appender.DIAG=org.apache.log4j.RollingFileAppender
log4j.appender.DIAG.File=${vim.logdir}/cim-diag.log
log4j.appender.DIAG.Append=true
log4j.appender.DIAG.MaxFileSize=5MB
log4j.appender.DIAG.MaxBackupIndex=10
log4j.appender.DIAG.Threshold=INFO
log4j.appender.DIAG.layout=org.apache.log4j.PatternLayout
log4j.appender.DIAG.layout.ConversionPattern=[%d{ISO8601} %x %c] %m%n
 
#Jointool logs
log4j.logger.com.vmware.vim.jointool=INFO, JOINTOOL
log4j.additivity.com.vmware.vim.jointool=false
 
log4j.appender.JOINTOOL=com.vmware.log4j.appender.NonAppendingRollingFileAppender
log4j.appender.JOINTOOL.File=${vim.logdir}/jointool.log
log4j.appender.JOINTOOL.MaxFileSize=5MB
log4j.appender.JOINTOOL.MaxBackupIndex=10
log4j.appender.JOINTOOL.Threshold=INFO
log4j.appender.JOINTOOL.layout=org.apache.log4j.PatternLayout
log4j.appender.JOINTOOL.layout.ConversionPattern=[%d{ISO8601} %x %c] %m%n

After changing the properties file, you want to restart the tomcat as follows:

/etc/init.d/vmware-vpxd tomcat-restart

Log4J levels
Log4j defines 6 levels of logs: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, in the order of descending details. Each level would include the logs of levels coming after itself. You can also use another two: ALL, OFF.

With the TRACE or ALL, you will have quite lots of (most likely more than you like to see) entries in the log file, which may slow down the system. For that, you want to reverse it back to default INFO level.

Categories: Virtualization Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.