Debugging function – verbose vpxd logging

Today Steve Jin published a post called How to Enable ESX Server Logs for Troubleshooting. A very useful tip when you are looking for those hard-to-find “features” in your script.

Steve’s tipĀ  reminded me that I have a similar small function in my toolchest to do something similar for the vCenter log.

The function allows you to switch the vCenter log between “warning” and “verbose” on the fly. No need to go into the vCenter client to change the logging option anymore while debugging.

The script

Annotation

Line 1-14: The actual function. You can place this in one of the profile files and then you can call the function anytime.

Line 2: The only parameter is a switch, which allows you switch between “warning” and ” verbose” logging mode. If you don’t specify the -Verbose parameter the default is used. The default switches logging to “warning” mode

Line 16,22: Before and after the code where you want extra logging, you place a call to the Set-vLogging function with the desiredĀ  mode.

You can consult the vCenter log(s) via the vSphere client but you can also access them directly with, for example notepad. The logs are located in %allusersprofile%\VMware\VMware VirtualCenter\Logs.

Update May 12th 2010: as William pointed out there are some other vpxd logging levels available.

Value Description
none Disable logging
error Errors only
warning Errors and warnings
info Normal logging
verbose Verbose logging
trivia Trivia. Shows the SOAP packages

The following is a slightly adapted function that lets you chose which of the 6 logging levels you want

Annotations

Line 7: Only if the -Level parameter contains 1 of the 6 accepted values, will the logging level be changed.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.