table of contents
CAN_LOGGER(1) | User Commands | CAN_LOGGER(1) |
NAME¶
can_logger - log CAN traffic, printing messages to stdout or to a given file
DESCRIPTION¶
usage: can_logger [-h] [-f LOG_FILE] [-a] [-s FILE_SIZE] [-v] [--active |
- --passive] [-c CHANNEL] [-i INTERFACE] [-b BITRATE] [--fd] [--data-bitrate DATA_BITRATE] [--timing TIMING_ARG [TIMING_ARG ...]] [--filter {<can_id>:<can_mask>,<can_id>~<can_mask>} [{<can_id>:<can_mask>,<can_id>~<can_mask>} ...]] [--bus-kwargs BUS_KWARG [BUS_KWARG ...]] ...
Log CAN traffic, printing messages to stdout or to a given file.
options:¶
- -h, --help
- show this help message and exit
logger arguments:¶
- -f, --file_name LOG_FILE
- Path and base log filename, for supported types see can.Logger.
- -a, --append
- Append to the log file if it already exists.
- -s, --file_size FILE_SIZE
- Maximum file size in bytes. Rotate log file when size threshold is reached. (The resulting file sizes will be consistent, but are not guaranteed to be exactly what is specified here due to the rollover conditions being logger implementation specific.)
- -v
- How much information do you want to see at the command line? You can add several of these e.g., -vv is DEBUG
- --active
- Start the bus as active, this is applied by default.
- --passive
- Start the bus as passive.
- extra_args
- The remaining arguments will be used for logger/player initialisation. For example, `can_logger -i virtual -c test -f logfile.blf --compression-level=9` passes the keyword argument `compression_level=9` to the BlfWriter.
bus arguments:¶
- -c, --channel CHANNEL
- Most backend interfaces require some sort of channel. For example with the serial interface the channel might be a rfcomm device: "/dev/rfcomm0". With the socketcan interface valid channel examples include: "can0", "vcan0".
- -i, --interface {canalystii,cantact,etas,gs_usb,iscan,ixxat,kvaser,neousys,neovi,nican,nixnet,pcan,robotell,seeedstudio,serial,slcan,socketcan,socketcand,systec,udp_multicast,usb2can,vector,virtual}
- Specify the backend CAN interface to use. If left blank, fall back to reading from configuration files.
- -b, --bitrate BITRATE
- Bitrate to use for the CAN bus.
- --fd
- Activate CAN-FD support
- --data-bitrate DATA_BITRATE
- Bitrate to use for the data phase in case of CAN-FD.
- --timing TIMING_ARG [TIMING_ARG ...]
- Configure bit rate and bit timing. For example, use `--timing f_clock=8_000_000 tseg1=5 tseg2=2 sjw=2 brp=2 nof_samples=1` for classical CAN or `--timing f_clock=80_000_000 nom_tseg1=119 nom_tseg2=40 nom_sjw=40 nom_brp=1 data_tseg1=29 data_tseg2=10 data_sjw=10 data_brp=1` for CAN FD. Check the pythoncan documentation to verify whether your CAN interface supports the `timing` argument.
- --filter {<can_id>:<can_mask>,<can_id>~<can_mask>} [{<can_id>:<can_mask>,<can_id>~<can_mask>} ...]
- R|Space separated CAN filters for the given CAN interface: <can_id>:<can_mask> (matches when <received_can_id> & mask == can_id & mask) <can_id>~<can_mask> (matches when <received_can_id> & mask != can_id & mask) Fx to show only frames with ID 0x100 to 0x103 and 0x200 to 0x20F: python3 -m can.viewer --filter 100:7FC 200:7F0 Note that the ID and mask are always interpreted as hex values
- --bus-kwargs BUS_KWARG [BUS_KWARG ...]
- Pass keyword arguments down to the instantiation of the bus class. For example, `-i vector -c 1 --buskwargs app_name=MyCanApp serial=1234` is equivalent to opening the bus with `can.Bus('vector', channel=1, app_name='MyCanApp', serial=1234)
October 2025 | can_logger 4.6.1 |