Skip to content

set_log_level

Runs at once Any mode Open to every client

Set the level of one of the robot's loggers, without a restart. The robot software writes its logs through named loggers, one per part. This sets one of them in the robot's two control processes, the command executor and the real-time loop: lines below the level are no longer written. A logger's level also applies to the loggers under it that have none of their own: "rti" covers "rti.can" until "rti.can" is set. The dashboard, the supervisor, the recorder and the self-collision worker keep their own levels; the dashboard's Logs tab sets the dashboard's. The level lasts until that process restarts.

Syntax

robot.set_log_level(name, level)

Arguments

Name Type Default Description
name str required The logger: "rti", "rti.startup", "rti.loop", "rti.mode", "rti.flash", "rti.errors", "rti.can", "rti.safety", "rti.homing", "rti.handler", "rti.exec", "rti.gripper", "rti.dynamics", "rti.selfcheck", "rti.recipe", "rti.incident", "rti.net", "exec", "exec.control", "exec.tcp", "exec.forward", "exec.status", "exec.planner", "exec.stop", "config", "filters", "shm", "kin", "proc", "io", or the libraries' "toppra" and "can". The logging documentation says what each one writes. The other processes' loggers ("sup" and the ones under it, "gui", "sc", "rec") are refused: this command does not reach those processes.
level str required "DEBUG", "INFO", "WARNING" or "ERROR", in any case.

Default values

"INFO" for every logger, "WARNING" for "toppra" and "can", set each time the command executor or the real-time loop starts.

Returns

Any

{"name": name, "level": level}: the logger and the level now set.

Examples

robot.set_log_level("exec.planner", "DEBUG")
robot.set_log_level("exec.planner", "INFO")
Usage restrictions 3 codes

This command runs at once; it is not queued. The robot accepts it in any mode and state, from every client.

It answers with one of these codes when it does not carry the command out:

  • [6003] Invalid arguments — name is not one of the loggers above, or level is not one of the four levels
  • [6025] RTI not running or not answering — rTI did not answer within 1 s: it is not running or not responding. The command may still have taken effect
  • [6026] Refused by RTI — rTI has no such logger or level. The message says why

In Python, a code above raises CommandRejected; its number is the code. The call raises:

  • CommandRejected: The robot refused it: the logger is unknown or belongs to another process, or the level is unknown. Or RTI refused it or did not answer within 1 s (Errors:).
  • RobotTimeout: The robot did not answer within 5 s.
  • RobotConnectionError: The client is not connected.

If the connection drops while the call waits for the robot's answer, it raises CommandRejected with the code CONNECTION_LOST (DISCONNECTED after disconnect()); while it waits for the robot's status, RobotConnectionError.

Like every immediate command, it also answers BAD_ARGS when a raw client sends a value the robot cannot read at all, and INTERNAL when it fails inside the robot.

Protocol

A client that does not use robotclient sends this over the TCP command protocol (port 29000) for the example above:

{"id": "c1", "cmd": "set_log_level", "args": ["exec.planner", "DEBUG"]}

See also