Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

An algorithm must be seen to be believed. -- D. E. Knuth


devel / comp.lang.python / Re: Getting Syslog working on OSX Monterey

SubjectAuthor
o Re: Getting Syslog working on OSX MontereyBarry Scott

1
Re: Getting Syslog working on OSX Monterey

<mailman.188.1646497547.2329.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17376&group=comp.lang.python#17376

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: bar...@barrys-emacs.org (Barry Scott)
Newsgroups: comp.lang.python
Subject: Re: Getting Syslog working on OSX Monterey
Date: Sat, 5 Mar 2022 16:25:38 +0000
Lines: 90
Message-ID: <mailman.188.1646497547.2329.python-list@python.org>
References: <CADoNktU6JPX00wDf9asFVr=NpTAy1ruRn_pHnLunc91M9_sokA@mail.gmail.com>
<0D40B574-2975-49BD-9E97-9055317169E5@barrys-emacs.org>
<20220228214109.ntoihdobzf5naqrx@hjp.at>
<4EAF5AC0-446D-4493-AFF0-2FD8A8889439@barrys-emacs.org>
<20220304212307.bd3rj67m6gaej37a@hjp.at>
<64FFB4FB-F4BD-4E1A-AAC7-792A26D65EB6@barrys-emacs.org>
Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\))
Content-Type: text/plain;
charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de FTgTSts96aDIq+TtmvicuwRNBkkJSpCFTEb6T1BfMR1g==
Return-Path: <barry@barrys-emacs.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(which': 0.04; 'yet.':
0.04; '(e.g.': 0.05; 'parameter': 0.05; 'mar': 0.07; '"just':
0.09; 'cc:addr:python-list': 0.09; 'fedora': 0.09;
'from:addr:barry': 0.09; 'linux': 0.09; 'macos': 0.09;
'mechanism': 0.09; 'myself.': 0.09; 'reasons:': 0.09;
'received:217.70': 0.09; 'received:gandi.net': 0.09;
'received:mail.gandi.net': 0.09; 'log': 0.12; 'cc:no real
name:2**0': 0.14; 'import': 0.15; 'url:mailman': 0.15;
'"creative': 0.16; '(more': 0.16; '2022,': 0.16; '>>>>': 0.16;
'__/': 0.16; 'api.': 0.16; 'aside': 0.16; 'barry': 0.16;
'challenge!"': 0.16; 'constructor': 0.16; 'destination.': 0.16;
'everywhere,': 0.16; 'from:addr:barrys-emacs.org': 0.16;
'from:name:barry scott': 0.16; 'hjp@hjp.at': 0.16; 'holzer': 0.16;
'logs': 0.16; 'message-id:@barrys-emacs.org': 0.16; 'missing?':
0.16; 'reality.': 0.16; 'rewrite': 0.16; 'server,': 0.16;
'stross,': 0.16; 'subject:OSX': 0.16; 'subject:working': 0.16;
'url-ip:212.17.106.137/32': 0.16; 'url-ip:212.17.106/24': 0.16;
'url-ip:212.17/16': 0.16; 'url:hjp': 0.16; '|_|_)': 0.16;
'wrote:': 0.16; 'api': 0.17; 'feb': 0.17; 'instead': 0.17;
"can't": 0.17; 'uses': 0.19; 'implement': 0.19;
'cc:addr:python.org': 0.20; 'written': 0.22; 'mac': 0.22; 'code':
0.23; "i'd": 0.24; 'url-ip:188.166.95.178/32': 0.25; 'url-
ip:188.166.95/24': 0.25; 'saying': 0.25; 'url:listinfo': 0.25;
'cc:2**0': 0.25; 'url-ip:188.166/16': 0.25; 'seems': 0.26;
'configure': 0.26; 'library': 0.26; 'port': 0.26; 'local': 0.27;
'function': 0.27; '>>>': 0.28; 'etc': 0.28; 'sense': 0.28;
'default': 0.31; 'url-ip:188/8': 0.31; 'think': 0.32; "doesn't":
0.32; 'but': 0.32; "i'm": 0.33; 'there': 0.33; 'mean': 0.34;
'header:In-Reply-To:1': 0.34; 'files': 0.36; 'missing': 0.37;
'really': 0.37; 'using': 0.37; 'way': 0.38; 'means': 0.38; 'two':
0.39; 'adding': 0.39; 'least': 0.39; 'single': 0.39; 'use': 0.39;
'want': 0.40; 'should': 0.40; 'connection': 0.61; 'likely': 0.61;
'forward': 0.62; 'remote': 0.63; 'pass': 0.64; 'apple': 0.64;
'look': 0.65; 'received:217': 0.67; 'deeply': 0.69; 'remaining':
0.69; 'url-ip:212/8': 0.69; 'disagree': 0.84; 'os.': 0.84;
'scott': 0.84; 'routing': 0.91; 'will,': 0.91; 'hidden': 0.95
In-Reply-To: <20220304212307.bd3rj67m6gaej37a@hjp.at>
X-Mailer: Apple Mail (2.3693.60.0.1.1)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <64FFB4FB-F4BD-4E1A-AAC7-792A26D65EB6@barrys-emacs.org>
X-Mailman-Original-References: <CADoNktU6JPX00wDf9asFVr=NpTAy1ruRn_pHnLunc91M9_sokA@mail.gmail.com>
<0D40B574-2975-49BD-9E97-9055317169E5@barrys-emacs.org>
<20220228214109.ntoihdobzf5naqrx@hjp.at>
<4EAF5AC0-446D-4493-AFF0-2FD8A8889439@barrys-emacs.org>
<20220304212307.bd3rj67m6gaej37a@hjp.at>
 by: Barry Scott - Sat, 5 Mar 2022 16:25 UTC

> On 4 Mar 2022, at 21:23, Peter J. Holzer <hjp-python@hjp.at> wrote:
>
> On 2022-02-28 22:05:05 +0000, Barry Scott wrote:
>> On 28 Feb 2022, at 21:41, Peter J. Holzer <hjp-python@hjp.at> wrote:
>>> On 2022-02-27 22:16:54 +0000, Barry wrote:
>>>> I have always assumed that if I want a logger syslog handler that I would have
>>>> to implement it myself. So far I have code that uses syslog directly and have
>>>> not written that code yet.
>>>
>>> What do you mean by using syslog directly? The syslog(3) library
>>> function also just sends messages to a "syslog listener" (more commonly
>>> called a syslog daemon) - at least on any unix-like system I'm familiar
>>> with (which doesn't include MacOS). It will, however, always use the
>>> *local* syslog daemon - AFAIK there is no standard way to open a remote
>>> connection (many syslog daemons can be configured to forward messages to
>>> a remote server, however).
>>
>> I'm re-reading the code to check on what I'm seeing. (Its been a long
>> time since I last look deeply at this code).
>>
>> You can write to /dev/log if you pass that to
>> SysLogHandler(address='/dev/log'), but the default is to use a socket
>> to talk to a network listener on localhost:514. There are no deamons
>> listening on port 514 on my Fedora systems or mac OS.
>
> If you are saying that SysLogHandler should use a system specific
> default (e.g. "/dev/log" on Linux) instead of UDP port 514 everywhere, I
> agree 99 % (the remaining 1 % is my contrarian alter ego arguing that
> that's really the distribution maintainer's job since a Linux
> distribution might use some other socket).
>
> If you are saying it should use the libc syslog routines, I disagree for
> at least two reasons: a) they are OS specific, b) you can't configure the
> destination. So that would remove useful functionality.
>
> In any case it seems strange to me that you want to rewrite it just to
> avoid passing a single parameter to the constructor (or - more likely -
> adding a single line to a config file).

What I am used to is a setup where programs use syslog() to log and
a dameon like rsyslog is responsible for routing the logs to local files
and/or remote systems. On a modern linux I think the route is
syslog() -> journald. And you can have syslog() -> journald -> rsyslogd.

Using the syslog() function means that any platform/distro details are
hidden from the user of syslog() and as is the case of macOS it
"just works". (I assume, not checked, that the write to the socket does not work
because Apple is not implementing the syslog protocol from the RFC).

>
>> What you do not see used in the SyslogHandler() is the import syslog
>> and hence its nor using openlog() etc from syslog API.
>
> For good reasons. The C syslog API is missing important functionality.

What are you think about being missing? Just curious.

As an aside if I had the need to log into a system log mechanism I'd be
looking to use the jounald API so that I can use structured logging on linux
systems.

Barry

>
> hp
>
> --
> _ | Peter J. Holzer | Story must make more sense than reality.
> |_|_) | |
> | | | hjp@hjp.at | -- Charles Stross, "Creative writing
> __/ | http://www.hjp.at/ | challenge!"
> --
> https://mail.python.org/mailman/listinfo/python-list

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor