Yes. Two methods come to mind:

1. You can suppress the debug messages in the driver. See Throttling
logging events
<https://github.com/weewx/weewx/wiki/WeeWX-v4-and-logging#throttling-logging-events>
.

2. Or, you can add a [Logging] section to weewx.conf to do the same.

[Logging]
  [[loggers]]
    [[[weewx.drivers.pymodbus]]]
      level = INFO

Once we get the hang of it, I think we'll find the Python logging module
much more flexible. See the white paper Weewx V4 and logging
<https://github.com/weewx/weewx/wiki/WeeWX-v4-and-logging> for details.

-tk


On Sat, Mar 14, 2020 at 9:34 AM Lucas Heijst <[email protected]> wrote:

> Tom,
>
> I have written a weewx device driver which collects data from a modbus
> energy meter.
>
> =======
> from pymodbus.constants import Endian
> from pymodbus.payload import BinaryPayloadDecoder
> from pymodbus.payload import BinaryPayloadBuilder
> from pymodbus.client.sync import ModbusSerialClient as ModbusClient
> from pymodbus.compat import iteritems
> from collections import OrderedDict
>
> from pymodbus.constants import Endian
> from pymodbus.payload import BinaryPayloadDecoder
> from pymodbus.payload import BinaryPayloadBuilder
> from pymodbus.compat import iteritems
> from collections import OrderedDict
> =======
>
>
> In version 3.9.2 I got only weewx debug messages in the syslog file when
> debug was set to 1.
>
> In version 4.0.0b14 I also get the pymodbus logging, see snippet below.
> This logging is HUGE: 20,500 lines per minute!!
>
> ====================
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.transaction: Running
> transaction 2184
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.transaction: SEND: 0x1 0x4
> 0x0 0x52 0x0 0x2 0xd0 0x1a
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.framer.rtu_framer: Changing
> state to IDLE - Last Frame End - 1584184619.972779, Current Time stamp -
> 1584184620.01192
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.client.sync: New
> Transaction state 'SENDING'
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.transaction: Changing
> transaction state from 'SENDING' to 'WAITING FOR REPLY'
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.transaction: Changing
> transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.transaction: RECV: 0x1 0x4
> 0x4 0x47 0x12 0xdc 0xa6 0x97 0x8f
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.framer.rtu_framer: Getting
> Frame - 0x4 0x4 0x47 0x12 0xdc 0xa6
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.factory: Factory
> Response[ReadInputRegistersResponse: 4]
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.framer.rtu_framer: Frame
> advanced, resetting header!!
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.transaction: Adding
> transaction 1
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.transaction: Getting
> transaction 1
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.transaction: Changing
> transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.payload: [18194, 56486]
> Mar 14 08:17:00 pi31 mben[1835] DEBUG pymodbus.payload: [b'G\x12',
> b'\xdc\xa6']
> Mar 14 08:17:00 pi31
> ====================
>
> As a workaround I have set the folowing line in file/etc/rsyslog.conf.
>
> :msg, contains, "DEBUG pymodbus" stop
>
>
> which suppresses the log lines in the syslog file.
>
>
> But I wonder: is there a better way?
>
>
> Luc
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-development/fcd18609-1408-4d4d-b93c-ae2d410e101e%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-development/fcd18609-1408-4d4d-b93c-ae2d410e101e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/CAPq0zEAAf6XkU8aApcxtrf12QTpN9NWecdn6Znm_i7Y4smG-NQ%40mail.gmail.com.

Reply via email to