Thomas Keffer <[email protected]> writes:

> weewx V4 uses a new logging facility, Python's module 'logging', which
> requires that one set up logging handlers. The handler "syslog" is designed
> to (roughly) emulate the previous syslog logging. To set it up, you must
> specify a destination (called 'address') and a 'facility', which vary from
> OS to OS. I suspect that the defaults that weewx is picking for NetBSD are
> wrong.

Thanks for the hint.  Patch attached.  With this weewx runs, gets
archive records, posts them to mqtt, and creates and rsyncs the html
pages.   And log messages appear in /var/log/messages (which is where
syslog puts them per local config, tos that's fine.).   

I am still seeing an issue, but I am 99.9% sure it is unrelated.

> Take a look at the top of file weeutil/logger.py where these destinations
> are coded in. It looks like:
>
> if sys.platform == "darwin":
>     address = '/var/run/syslog'
>     facility = 'local1'
> elif sys.platform.startswith('linux'):
>     address = '/dev/log'
>     facility = 'user'
> elif sys.platform.startswith('freebsd'):
>     address = '/var/run/log'
>     facility = 'user'
> else:
>     address = ('localhost', 514)
>     facility = 'user'
>
> I don't know which branch NetBSD would take. Either 'freebsd' or the
> default, I imagine. Obviously, what it's choosing isn't working out.
> Perhaps you can supply an alternative for NetBSD? It may be as simple as a
> different file path for 'address'.

It was.

I would suggest that if there isn't a match, that the code throw an
exception rather than assume a default.  The UDP port 514 might be for
Linux, and if so I think it would be better to just put that first and
be explicit.

OpenBSD is likely also /var/run/log; this layout is inherited from
somewhere along the 4.3BSD to 4.4BSD lineage (syslogd originated in
4.3BSD, but I think 4.4 regularized some paths into the modern BSD
hier(7) layout.)

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/rmieeu2291t.fsf%40s1.lexort.com.
>From f63255792c2ac7455875192d82c05843942dc735 Mon Sep 17 00:00:00 2001
From: Greg Troxel <[email protected]>
Date: Sun, 8 Mar 2020 10:46:26 -0400
Subject: [PATCH] logger.py: Add path config for NetBSD

---
 bin/weeutil/logger.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bin/weeutil/logger.py b/bin/weeutil/logger.py
index e5b5bff4..f64d408c 100644
--- a/bin/weeutil/logger.py
+++ b/bin/weeutil/logger.py
@@ -26,6 +26,9 @@ elif sys.platform.startswith('linux'):
 elif sys.platform.startswith('freebsd'):
     address = '/var/run/log'
     facility = 'user'
+elif sys.platform.startswith('netbsd'):
+    address = '/var/run/log'
+    facility = 'user'
 else:
     address = ('localhost', 514)
     facility = 'user'
-- 
2.22.0

Reply via email to