Understanding Weewx new method of logging

362 views
Skip to first unread message

Tomasz Lewicki

unread,
Jul 26, 2023, 5:40:26 AM7/26/23
to weewx-user
Hi WX users.

I'd like to ask about logging in Weewx (I'm using version 4.10.2). To make a long story short, I'd like to completely turn off logging by Weewx - because I'm using Raspberry Pi with SD card and want to minimize write operations as much as possible.

I've read article on wiki (https://github.com/weewx/weewx/wiki/WeeWX-v4-and-logging) but do not clearly understand new way of control logging. I'd like to have simple switch in weewx.conf, for example "completely_disable_logging = True" or something similar. Is there some switch in [Logging] block as I see it in wiki? If I change "disable_existing_loggers = False" to "disable_existing_loggers = True", will I get the expected effect?

vince

unread,
Jul 26, 2023, 11:50:53 AM7/26/23
to weewx-user
I just log to tmpfs (essentially ramdisk) and it is not an issue for me.

Add this to your /etc/fstab and reboot

#---- put logs and tmp dirs in ramdisk ---
tmpfs           /tmp            tmpfs   defaults,nosuid,mode=0755,nodev,noatime   0       0
tmpfs           /var/log        tmpfs   defaults,nosuid,mode=0755,nodev,noatime   0       0
tmpfs           /var/tmp        tmpfs   defaults,nosuid,mode=0755,nodev,noatime   0       0
#---------------------------------------------

Note that the result here is that you will lose 'all' logs when you reboot, but the upside is it never writes to SD card.  In this configuration your pi SD is close to read-only.

Tomasz Lewicki

unread,
Jul 27, 2023, 6:18:19 AM7/27/23
to weewx-user
Thank you. I'm using log2ram so I think it has the same effect. But I think that some mechanism to completely turn off logging does/should exist. I can always turn it on if needed.

 I don't know if it is good approach but I've used "disable_existing_loggers = True" directive in weewx.conf and log aren't generated - or I can't find them :)

Rainer Lang

unread,
Jul 27, 2023, 6:33:17 AM7/27/23
to weewx...@googlegroups.com

you are free to do whatever you want...
You can even disable the rsyslog service completely and have no logging at all.
However, turning off logging is not a very smart approach, and thinking you can turn logging on again "when it's needed" is imho rather naive thinking. When an application (and it may even fail to restart) fails, you may no longer be able to find out what has caused the issue without logs.
You can use RAM (temporary file system) as suggested by @vince, you can move the logs to a remote server (e.g. NAS) etc., but switching off logging completely is nothing a professional IT person would recommend

you could also use a SSD disk instead of a microSD with your RPi or a SLC microSD card if you want to avoid wear out of your SD card ...
I'm using both approaches for years now with my RPi's - and have my logs available in case they are needed 😎

--
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/9812f2ab-5ffb-4e64-bd97-80358501cf5bn%40googlegroups.com.

Tomasz Lewicki

unread,
Jul 27, 2023, 9:08:54 AM7/27/23
to weewx-user
Thank you for advice but external SSD/USB is not an option. Unfortunately I can't send logs to other machine because I will install the station in remote place where web access is limited and I have limits for LTE transfer (transfer rate and volume of data). UPS supply is out of the question too. I got RPi outside and have to limit potential points of failure as much as possible.

I worked in IT for some time and of course I know that log tell you the truth (even if you don't want to know it). But I also think that it's entirely up to the user if he/she wants some service enabled/disabled or log created or not. With all pros and cons of this approach of course.

Graham Eddy

unread,
Jul 27, 2023, 9:48:29 AM7/27/23
to WeeWX User
see https://docs.python.org/3/library/logging.config.html - weewx logging uses this yaml (translated into ini syntax).
perhaps your best option is to set logging level at ‘error’, which is not verbose unless you really really need it
⊣GE⊢

vince

unread,
Jul 27, 2023, 12:22:37 PM7/27/23
to weewx-user
This worked for me in debian12 using a v5 beta.

It's probably not 'off' completely but there are zero syslog lines from weewx starting/running/stopping other than a line or two that systemd writes.

[Logging]
    version = 1
    disable_existing_loggers = True

    # Root logger
    [[root]]
      level = CRITICAL

Tom Keffer

unread,
Jul 27, 2023, 2:13:17 PM7/27/23
to weewx...@googlegroups.com
Geez, if that works, it should be mentioned in the Logging wiki.

--
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.

vince

unread,
Jul 27, 2023, 3:21:58 PM7/27/23
to weewx-user
I'd appreciate it if others try to verify it and let me know via email please and I'd be happy to do so.

Tomasz Lewicki

unread,
Jul 28, 2023, 2:32:56 AM7/28/23
to weewx-user
I confirm that from a moment when I changed False to True, log are not filled anymore. I have only these lines:

[Logging]
    version = 1
    disable_existing_loggers = True

    # Root logger
    [[root]]
      level = ERROR
      handlers = syslog,

So probably I found Holy Grail.

Reply all
Reply to author
Forward
0 new messages