By default, warnings and errors are sent to STDOUT. YumaPro programs offer several parameters to allow users to tailor error logging to their needs.


The log parameter


A log file can be specified instead of using STDOUT with the 'log' parameter.


Here is an example of "user" setting their desired log file to /home/user/LOGS/netconfd-pro092017.log via command line:


user@system> netconfd-pro --log=~/LOGS/netconfd-pro092017.log


Here is an example of how to set the same log file in a YumaPro config file:


log ~/LOGS/netconfd-pro092017.log


If the specified log file does not exist then a new file will be created in that location.


If you specify a location which requires elevated/root permissions, then you may see this error when starting your program:


user@system> netconfd-pro log=/etc/netconfd-pro.log

Error: open logfile '/etc/fake-file.txt' failed (cannot open file)
netconfd-pro: init returned (cannot open file)


When specifying a log file in a root location you will need to run the netconfd-pro server (or other YumaPro program) as root:


user@system> sudo netconfd-pro log=/etc/netconfd-pro.log


The log-append parameter


Existing log files can be reused with the 'log-append' parameter, otherwise log files are overwritten.


Here is a command line example that instructs netconfd-pro to append log entries to /home/user/LOGS/netconfd-pro092017.log:


user@system> netconfd-pro --log=~/LOGS/netconfd-pro092017.log --log-append


Here is an example of how to turn log-append on in a YumaPro config file:


log-append true


If there is no configured log file then log-append will be ignored.


The log-level parameter


The logging level can be controlled with the 'log-level' parameter.

The default log level is 'info'.  The log-levels are additive:


log-level
Description
off
This setting suppress all errors and is not recommended! A program return code of '1' indicates some error.
error
print errors
warn
print warnings
info
print generally interesting trace info
debug
print general debugging trace info
debug2
print verbose debugging trace info
debug3
print very verbose debugging trace info
debug4
print maximum debugging trace info


Here is a command line example of setting the log-level for netconfd-pro to debug2 via command-line:


user@system> netconfd-pro --log=~/LOGS/netconfd-pro092017.log --log-append --log-level=debug2


Here is an example of how set the log-level to debug2 in a YumaPro config file:


log-level debug2