Skip to content

Commit

Permalink
DOCS-1676: Add fine-grained logging controls
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel committed Dec 2, 2024
1 parent c905a64 commit e45e138
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions docs/architecture/viam-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,45 @@ maintenance : {

### Logging

Log messages written appear under the [**LOGS** tab](/cloud/machines/#logs) for the machine running the module.

#### Debugging
Log messages appear under the [**LOGS** tab](/cloud/machines/#logs) for a machine.

The default log level for `viam-server` and any running resources is `"Info"`.

You can configure logs for all machine resources, inside your machine config.
To specify the log level for a specific resource or for all resources matching a pattern, specify the `pattern` and the `level` field.

<!-- prettier-ignore -->
| Attribute | Description |
| --------- | ----------- |
| `pattern` | A regular expression (regex) pattern matching one or more resources. |
| `level` | The log level: `"debug"`, `"info"`, `"warn"`, or `"error"`. |

For example:

```json
"log": [
     {
       "pattern": "rdk.resource_manager",
       "level": "info",
     },{
       "pattern": "rdk.resource_manager.*",
       "level": "debug",
     },{
   "pattern": "rdk.networking.signaler.*",
   "level": "info"
 },{
   "pattern": "rdk.networking.netlogger",
   "level": "debug"
 }
  ]
```

Patterns are processed from top to bottom.
If multiple patterns apply, the last pattern to be processed will apply.
If additional log configurations are applied at a resource level using the `log_configuration` field, these take precedence over log levels applied in the `log` field of the machine configuration.

#### Debugging

You can enable debug level logs in two ways:

- Start `viam-server` with the `-debug` option.
Expand Down

0 comments on commit e45e138

Please sign in to comment.