Defining environment variables for debug log-level and log-file will avoid
specifying the same in each virsh command. Following is a patchset
for enabling env variable support for virsh logging.
Two new environment variables are defined:
a. VIRSH_DEBUG=<log_level>
log_level can be a value between 0 - 4, where
0 -> "ERROR"
1 -> "WARNING"
2 -> "NOTICE"
3 -> "INFO"
4 -> "DEBUG"
b. VIRSH_LOG_FILE=<logfile-path-and-name>
logfile-path-and-name is the name and complete path for the log file.
The above two variables are independent.
if log_level is specified without setting a log file name,
then, logs will be displayed in stdio.
If logfile-path-and-name specified without setting log_level,
then, default log_level (DEBUG) will be used to log to the specified file.
virsh commandline parameters (-l and -d) get precedence over environment
variables and will override respective env variable values.
1/3 - Use env variables to control virsh logging
2/3 - Change log level order to make "DEBUG" the superset
3/3 - Related changes to virsh manpage