Improving the FB logging

Hi

I have a lot of frustration with regards to the logging of FB as very often the logs are unhelpful and difficult to use.

My suggestion would be to change the logging mechanism from changing the ‘capture’ mode (start / steps / stops) to capturing all always and having a filter instead.

The logic about this is you do not need log files until something goes wrong and you (generally) cannot tell when something is going to go wrong. You only need the detail when the detail is needed, apart from that, high level detail is fine.

My suggestion would be to follow the standard that the tech industry uses

# Log Level Importance
0 Fatal One or more key business functionalities are not working and the whole system doesn’t fulfill the business functionalities.
1 Error One or more functionalities are not working, preventing some functionalities from working correctly.
2 Warn Unexpected behavior happened inside the application, but it is continuing its work and the key business features are operating as expected.
3 Info An event happened, the event is purely informative and can be ignored during normal operations.
4 Debug A log level used for events considered to be useful during software debugging when more granular information is needed.
5 Trace A log level describing events showing step by step execution of your code that can be ignored during the standard operation, but may be useful during extended debugging sessions.

Level 0 - Things like e-stop or other fatal type of messages
Level 1 - Dropped steps / Failed UTM connections etc
Level 2 - Retries of missed steps
Level 3 - Sequence start / stop / other information script generated message
Level 4 - Every step in a sequence
Level 5 - Every step, response and very low-level messaging

The issue is that this will create large log files which is problematic to handle so I would suggest this are the resolution around it.

1 - Create two log files. One is synced automatically and the other is local unless requested for analysis
a - Synced log file will cover Level 0 to 3 only
b - All levels - Only synced on MANUAL request for diagnostic.

On request, the user can request a detailed log file to be uploaded to the mothership and can then read the detail.
The benefit to the mothership in standard operations is a reduced log level
The benefit to the user is access to low level low files on demand and logging events are not lost because they were not asked for before they knew they needed them.

Well.
I have been diving into the logging capabilities of FB and I found a huge surprise.
It appears most of my logging desires my already be in place.

What I do not understand (yet) is the difference between logging levels 1,2 and 3 and whether messages can be sent to the various levels. A search of the documentation yielded no results.

Is there documentation on the logging levels?
Is there a way to set the logging level for various sequences? What I mean is I program sequences in an extremely modular manner, and for some of the sequences I call in my code, I would want to be reported at level 1 or 2 and some at level 3.

You can find documentation for log verbosity level and other settings such as sequence logging here: Jobs and Logs | FarmBot Software Documentation You can also use the docs search with term “logs” and that page is the first suggestion.

Log verbosity level is determined by FarmBot OS. Unfortunately there is currently no way to set log verbosity on a per-sequence basis nor with the send_message() Lua helper. One way to hack around this limitation is by including your own filing system in the log message itself, and then using the logs search bar to do your filtering, rather than the built-in type/verbosity filters. For example:

send_message("info", "Level 0, Fatal --- Movement failed.")

Then search by “Level 0” or “Fatal” instead of using our built-in filters.

Thanks

Is there a definiton of what 1,2 and 3 mean instead of just more detail?

This is the definition we have, which admittedly is a little loose:

Every log that FarmBot sends has a verbosity of 1 , 2 , or 3 , which can be loosely associated with how important the log is and the level of detail that it reveals about how your FarmBot is operating. A more verbose log (verbosity 3 ) is usually “lower level” and less important. A less verbose log (verbosity 1 ) is usually “higher level” and more important.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.