Page MenuHomeVyOS Platform

Provide more information to the user when a traceback is reported to the user
Closed, ResolvedPublicFEATURE REQUEST


Currently, when something goes wrong, the command will report to the user the python traceback.
This information is often then provided to the team to investigate, it is however often not enough to act on.
In particular, the installed image version is not known.

sys.excepthook can be used to "augment" the information printed and therefore made debugging easier.

It could also be used to provide some user feedback
ie: you are seeing a bug, what to do depending if the code is LTS or rolling and surely more


Difficulty level
Unknown (require assessment)
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Feature (new functionality)

Event Timeline

+1, I'd also like if all failed commits were stored in a permanent log somewhere to make debugging easier, I can't find one right now.

I agree: the logs should reflect the actions performed to update the router following the configuration change. As this should be the same each time, we should be able to check a change with a saved replay, as a way to check that all is as should (part of the smoketest testing).

@dmbaturin I was aked on slack to report the information via syslog. However the syslog server is not listening on on UDP port 514 on localhost. How would you like to proceed ?
should it be opened (I am not sure where this should be configured) or should the log be written on the drive using the python logging module (as I currently have implemented).

# sudo lsof  | grep dev-log
I am officially daft .. I thought it was not running !

Personally I'd use systemd-journald which I think provides the same logging facilities as rsyslog used to, but vyos still runs both. IMO the logging section is a mess and would need a complete rewrite to journal.

from shlex import quote
def systemd(self, level, message):
    msg = quote(message)
    run(f'echo {msg} | systemd-cat -p {self.level}')

thanks to @runborg .. my own initial attempt to syslog failed (facility level ??)
This works

import logging
import logging.handlers
my_logger = logging.getLogger('MyLogger')  # logger is singleton
handler = logging.handlers.SysLogHandler(address='/dev/log', facility="auth")
my_logger.critical('this is critical')
thomas-mangin claimed this task.

How do we use this new "" for on-demand logging from scripts? For example if I want to print a warning when executing a conf_mode script that should go both to stderr and to a file, but is not a fatal exception?

Everything sent to stderr will both go to the screen and syslog.
If you raise it auto-magically format the raised exception to the user (the traceback is sent to stderr and thefore goes to syslog)

It will not intercept what is printed by executed programs. I could add an option for the functions to have stderr intercepted and printed by VyOS (causing program errors to go to logs)

Yes, that would be useful, for example conf_mode scripts could print warnings that would go to the syslog when the config is applied on boot. Other scripts output is seen by the user anyway so I don't see a use elsewhere.

ok will add the feature once the current set of patch waiting approval are in to not have to deal with rebasing etc :-)

erkin set Issue type to Feature (new functionality).Aug 30 2021, 7:51 AM
erkin removed a subscriber: Active contributors.