Logging

70 views
Skip to first unread message

Mark Fraser

unread,
May 23, 2022, 4:02:03 AM5/23/22
to weewx...@googlegroups.com
I'm running version 4.8 of weewx and although I've got
log_success = False
In all places in weewx.conf, I still see lines like:
May 23 09:00:56 weathercam /weewxd: bme280: BME280 data
compensated_reading(id=a4ff8186-9fd7-4cb1-ac00-22716b358662,
timestamp=2022-05-23 09:00:56.543049, temp=34.843 °C, pressure=996.53
hPa, humidity=17.31 % rH)
May 23 09:00:56 weathercam /weewxd: bme280: {'windGust': 3.672,
'outBatteryStatus': 0, 'rain_total': 42.06, 'windSpeed': 2.448,
'windDir': 270.0, 'outHumidity': 70.0, 'outTemp': 16.0, 'dateTime':
1653292852, 'usUnits': 16, 'rain': 0.0, 'pressure': 996.5324701184883}
In /var/log/syslog.

Is there any way of stopping these messages too?

Stephen Hocking

unread,
May 23, 2022, 6:51:28 AM5/23/22
to weewx...@googlegroups.com
Check what debug is set to.

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/724506eb-825f-04c3-7c18-3cb39c801b32%40gmail.com.


--
  "I and the public know
  what all schoolchildren learn
  Those to whom evil is done
  Do evil in return"		W.H. Auden, "September 1, 1939"

Doug Jenkins

unread,
May 23, 2022, 6:54:19 AM5/23/22
to weewx...@googlegroups.com
Mark:

I would add the log_success = False under the BME280 driver in your weewx.conf. If that doesn't work, then check with the driver's author to see if the code can be revised to accommodate WeeWx logging class.

Mark Fraser

unread,
May 23, 2022, 9:59:43 AM5/23/22
to weewx...@googlegroups.com
On 23/05/2022 11:54, Doug Jenkins wrote:
> Mark:
>
> I would add the log_success = False under the BME280 driver in your
> weewx.conf. If that doesn't work, then check with the driver's author to
> see if the code can be revised to accommodate WeeWx logging class.
>
> On Mon, May 23, 2022 at 4:02 AM Mark Fraser <mfr...@gmail.com
> <mailto:mfr...@gmail.com>> wrote:
>
> I'm running version 4.8 of weewx and although I've got
> log_success = False
> In all places in weewx.conf, I still see lines like:
> May 23 09:00:56 weathercam /weewxd: bme280: BME280 data
> compensated_reading(id=a4ff8186-9fd7-4cb1-ac00-22716b358662,
> timestamp=2022-05-23 09:00:56.543049, temp=34.843 °C, pressure=996.53
> hPa, humidity=17.31 % rH)
> May 23 09:00:56 weathercam /weewxd: bme280: {'windGust': 3.672,
> 'outBatteryStatus': 0, 'rain_total': 42.06, 'windSpeed': 2.448,
> 'windDir': 270.0, 'outHumidity': 70.0, 'outTemp': 16.0, 'dateTime':
> 1653292852, 'usUnits': 16, 'rain': 0.0, 'pressure': 996.5324701184883}
> In /var/log/syslog.
>
> Is there any way of stopping these messages too?

Looks like it has already been asked for:
https://gitlab.com/wjcarpenter/bme280wx/-/issues/1

and it seems to be using it's own logging functions:

def logmsg(level, msg):
syslog.syslog(level, 'bme280: %s' % msg)

def logdbg(msg):
logmsg(syslog.LOG_DEBUG, msg)

def loginf(msg):
logmsg(syslog.LOG_INFO, msg)

def logerr(msg):
logmsg(syslog.LOG_ERR, msg)


If I replace these with:
import weeutil.logger
and change instances of loginf() with log.info() is it likely to work?

Doug Jenkins

unread,
May 23, 2022, 11:05:50 AM5/23/22
to weewx...@googlegroups.com
Mark:

It is worth a shot and most likely it would work. If it does, I would recommend forking the repo and make the same changes for log.error, log.message, and log.debug using the functions from weeutil.logger.

Then I would commit the changes to your fork and send the maintainer a pull request to make the changes in the regular driver.

DDJ



--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

Mark Fraser

unread,
May 23, 2022, 11:32:56 AM5/23/22
to weewx...@googlegroups.com
On 23/05/2022 16:05, Doug Jenkins wrote:
> Mark:
>
> It is worth a shot and most likely it would work. If it does, I would
> recommend forking the repo and make the same changes for log.error,
> log.message, and log.debug using the functions from weeutil.logger.
>
> Then I would commit the changes to your fork and send the maintainer a
> pull request to make the changes in the regular driver.
>
> DDJ

Here's my forked repo, haven't had chance to test it yet.
https://gitlab.com/mfraz74/bme280wx/

gjr80

unread,
May 23, 2022, 4:04:53 PM5/23/22
to weewx-user
Simply changing to use the python logging module instead of the syslog module (aka changing to WeeWX v4 logging instead of WeeWX v3 logging) will not in itself enable log_success in a third party extension. log_success needs to be built into the extension (usually through use of conditional statements). Any well written driver/service should not be emitting routine data every loop period at the info level. Looking at your repo I don't think the solution is to use log_success but rather to change the log.info() call at line 69 to log.debug(). Then, if you run WeeWX with debug = 0 your logs will be silent (from this extension) and if you need to see the extension output during troubleshooting just restart WeeWX with debug = 1.

Gary

Mark Fraser

unread,
May 23, 2022, 5:16:12 PM5/23/22
to weewx...@googlegroups.com
Apologies, I was only going by what it said at
https://github.com/weewx/weewx/blob/master/docs/logging.md and assumed
that is all I needed to do.

gjr80

unread,
May 24, 2022, 4:58:42 AM5/24/22
to weewx-user
You have nothing to apologise over, you did exactly the right thing. Was just pointing out that the operation of log_success is independent of the logging system being used and in the case of a driver or service such as you are using using log.debug() is more appropriate.

Gary

Mark Fraser

unread,
May 25, 2022, 3:53:50 AM5/25/22
to weewx...@googlegroups.com
On 24/05/2022 09:58, gjr80 wrote:
> You have nothing to apologise over, you did exactly the right thing. Was
> just pointing out that the operation of log_success is independent of
> the logging system being used and in the case of a driver or service
> such as you are using using log.debug() is more appropriate.
>
> Gary

Thanks Gary, that's been changed. Is it worth testing to see if the
version of weewx installed can use the new logging system first as in
https://github.com/matthewwall/weewx-windy/blob/master/bin/user/windy.py ?
Reply all
Reply to author
Forward
0 new messages