Logger
The logger
component enables you to control the log levels of other components and activities in Viseron.
Logs are in the format: [timestamp] [level] [log_name] - message
Configuration
Configuration example
Available levels
This list shows the available log levels sorted by severity. Logging messages which are less severe than the given level will be ignored.
- critical
- error
- warning
- info
- debug
View logs
Example command to examine the logs:
docker logs -f viseron
A logfile is also created in the config
directory named viseron.log
.
Log rotation
By default the log file is rotated on each restart of Viseron.
If you want to rotate the log file based on size and also keep a certain number of old logs, you can use the environment variables VISERON_LOG_MAX_BYTES
and VISERON_LOG_BACKUP_COUNT
.
- Docker
- Docker-Compose
docker run --rm \
-v {segments path}:/segments \
-v {snapshots path}:/snapshots \
-v {thumbnails path}:/thumbnails \
-v {event clips path}:/event_clips \
-v {config path}:/config \
-v /etc/localtime:/etc/localtime:ro \
-p 8888:8888 \
--name viseron \
--shm-size=1024mb \
-e VISERON_LOG_MAX_BYTES=100mb \
-e VISERON_LOG_BACKUP_COUNT=5 \
roflcoopter/viseron:latest
version: "2.4"
services:
viseron:
image: roflcoopter/viseron:latest
container_name: viseron
shm_size: "1024mb"
volumes:
- {segments path}:/segments
- {snapshots path}:/snapshots
- {thumbnails path}:/thumbnails
- {event clips path}:/event_clips
- {config path}:/config
- /etc/localtime:/etc/localtime:ro
ports:
- 8888:8888
environment:
- VISERON_LOG_MAX_BYTES=100mb
- VISERON_LOG_BACKUP_COUNT=5
The VISERON_LOG_MAX_BYTES
variable supports the following suffixes: b
, kb
, mb
, gb
, tb
.
Debugging a camera
If one of your cameras is malfunctioning you might need to enable debug logging for it to gain some more insight or raise an issue.
Setting default_level
to debug
will create a lot of noise.
To isolate the logs of a specific camera, use the cameras
config option.
The following example will enable debug logging for all logs related to the camera with the identifier camera_one
.
logger:
cameras:
camera_one: debug
Debugging a component
If you are experiencing issues with a specific component, you can enable debug logging for it.
The following example will enable debug logging for all logs related to the ffmpeg
component.
logger:
logs:
viseron.components.ffmpeg: debug
Global debug logging
To enable debug logging for the entire application, set default_level
to debug
.
logger:
default_level: debug