Deutsch   English   Français   Italiano  
<mailman.100.1731438669.4695.python-list@python.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: Left Right <olegsivokon@gmail.com>
Newsgroups: comp.lang.python
Subject: Re: FileNotFoundError thrown due to file name in file, rather than
 file itself
Date: Tue, 12 Nov 2024 20:10:55 +0100
Lines: 50
Message-ID: <mailman.100.1731438669.4695.python-list@python.org>
References: <87v7wt986z.fsf@zedat.fu-berlin.de>
 <CAJQBtg=UOiOmmHa25EUZtrZO19F1O0_VxCO6gWjZ5ebAMHnXCA@mail.gmail.com>
 <mailman.92.1731341107.4695.python-list@python.org>
 <875xosyfr0.fsf@zedat.fu-berlin.de>
 <CAJQBtg=nr+KC5iz_WY7nqkGK+YBEWAPq40ksaWJCAOT_+=pHxg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de yHzNOJaFc+hvSZlDTRyNAQGdbH+IglpOA7LGTFyDMq7Q==
Cancel-Lock: sha1:kOUKOXuIOjk1rzKjcyZd+3Dc9IA= sha256:8FK4r66zy8U/13AqjZigqwMvlNLkPNnSXfc4J1SSye8=
Return-Path: <olegsivokon@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
 reason="2048-bit key; unprotected key"
 header.d=gmail.com header.i=@gmail.com header.b=heSYkq9U;
 dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.032
X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'debugging': 0.07;
 'filter': 0.07; 'space,': 0.07; 'subject:name': 0.07; 'wrong.':
 0.07; 'cc:addr:python-list': 0.09; 'fact,': 0.09; 'simplicity':
 0.09; 'log': 0.12; 'cc:no real name:2**0': 0.14; 'that.': 0.15;
 'aggregate': 0.16; 'category,': 0.16; 'command.': 0.16;
 'database,': 0.16; 'impossible': 0.16; 'infra': 0.16; 'ldap':
 0.16; 'logs': 0.16; 'moderately': 0.16; 'pipe': 0.16; 'received
 :mail-qv1-xf34.google.com': 0.16; 'run,': 0.16; 'server,': 0.16;
 'tries': 0.16; 'problem': 0.16; "aren't": 0.19; 'figure': 0.19;
 'cc:addr:python.org': 0.20; 'option': 0.20; 'written': 0.22;
 'first,': 0.22; 'subject:file': 0.22; 'anything': 0.25; 'past':
 0.25; 'saying': 0.25; 'cc:2**0': 0.25; 'behavior': 0.26;
 'perform': 0.26; 'output': 0.28; 'am,': 0.31; 'convention': 0.31;
 'program,': 0.31; 'message-id:@mail.gmail.com': 0.31; 'program':
 0.32; "doesn't": 0.32; 'but': 0.32; 'there': 0.33; 'header:In-
 Reply-To:1': 0.34; 'received:google.com': 0.34; 'same': 0.34;
 'mean': 0.34; 'from:addr:gmail.com': 0.34; 'files': 0.36;
 'really': 0.36; 'cases': 0.36; 'work,': 0.36; 'source': 0.36;
 'change': 0.36; 'those': 0.36; "it's": 0.37; 'file': 0.38; 'way':
 0.38; 'both': 0.38; 'quite': 0.39; 'single': 0.39; 'enough': 0.39;
 'advantage': 0.40; 'program.': 0.40; 'wants': 0.40; 'whenever':
 0.40; 'want': 0.40; 'best': 0.61; 'remember': 0.61; "there's":
 0.61; 'day,': 0.62; 'gives': 0.62; 'come': 0.62; 'send': 0.62;
 'similar': 0.63; 'email': 0.63; 'your': 0.64; 'touch': 0.65;
 'required': 0.65; 'that,': 0.68; 'during': 0.69; 'currently,':
 0.69; 'drop': 0.69; 'natural': 0.69; 'care': 0.71; 'chance': 0.71;
 'free': 0.71; 'low': 0.74; 'records': 0.75; 'heart': 0.76;
 'potentially': 0.76; 'etc.,': 0.84; 'perspective,': 0.84;
 'reliability': 0.84; 'subject: \n ': 0.84; 'property': 0.88;
 'reliable.': 0.91; 'subject:than': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1731438667; x=1732043467; darn=python.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=HEJuYe3uUafqppa6PXsUucqF14irQJE4I8n0swhaa7A=;
 b=heSYkq9UxLykjOMUEkeUOXGxviqMJx4iYySl53urdeB7pjYN63qngQZKYBe64wTw+c
 uhEMqKzE+fva+e+2HSc6SSJKjEUTp0FlnSSQjjFHhcsXCj5OGvj+vkTTXFf+CeevIko6
 rL+bd1J2d6W2cQgTgfcP2MTsbeNRfu7eTcrZYStPxBMI8/BYsbp/1+U2Vvn//6LSdK0f
 RKQxBAfmD++owBA9Gwi1qXCY2EgvEWkMDaLbGoxkYKy8kgZHCX3Fk0GC4O4ABFPYHoEG
 obcdyxuPnE5BQpuYx4ugrh4UqobH41UMErW2SDYj+RV71LOzDraRBcrOwlAFmSsOpeA5
 qn3g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1731438667; x=1732043467;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=HEJuYe3uUafqppa6PXsUucqF14irQJE4I8n0swhaa7A=;
 b=IJIWSkkc2u6e7MmRLtAZrB/tNyAFmApjRTcNJXnlTLuM12lDyg5KSn4PC6Aw7t8v2k
 3yW7h4ewZp1BpnL4sYGey+zc+vZNZ9wkIB9hfE/XNkhW4BzdxPVBvoCqJQod84jewI0U
 DH/BfsERFzMEmGAwOy16c5kdamLVLy6RV/qUxVmvjzoQInB6GWW5wqCDC+6pjHy/FS/D
 oIUp7WvYmWKBgTtOuS+4cgDW/LcgKgsnpCOQiEOwsEUZG71p6fXxyD4OjG3Kw5s8PLu1
 OkVu8eZ2IV5yhoEELgCRShy3HlXLxkWeoNGP7ePSurj3XS+oPPK/+X+CTpU9wfZGUmDu
 f75A==
X-Gm-Message-State: AOJu0Yy0FjZdWK3fOhsrTuBM47jvAWYk0RkCcDr0gQFMOP+5z9V6kDPB
 9czzdZeg9j0EjBrb6u/JLOSjDzfOnopCe5aqShlYrnUvsq/lpbE9pVg2n80DWorqW6p6V/WBzlV
 k7QCWMkn70La2otGKrdZDRcgvEhwf2pKw
X-Google-Smtp-Source: AGHT+IEbCNGSFVA2mjGYJ1eGtYjgLvX+FJp/u/SvXhLtRKn3Y509ahGnxB03rj///ncdHdk8WJ6vBSkjdH3N6tdcov4=
X-Received: by 2002:a05:6214:4803:b0:6cc:364f:fc32 with SMTP id
 6a1803df08f44-6d39e19639amr278599156d6.32.1731438666912; Tue, 12 Nov 2024
 11:11:06 -0800 (PST)
In-Reply-To: <875xosyfr0.fsf@zedat.fu-berlin.de>
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: <CAJQBtg=nr+KC5iz_WY7nqkGK+YBEWAPq40ksaWJCAOT_+=pHxg@mail.gmail.com>
X-Mailman-Original-References: <87v7wt986z.fsf@zedat.fu-berlin.de>
 <CAJQBtg=UOiOmmHa25EUZtrZO19F1O0_VxCO6gWjZ5ebAMHnXCA@mail.gmail.com>
 <mailman.92.1731341107.4695.python-list@python.org>
 <875xosyfr0.fsf@zedat.fu-berlin.de>
Bytes: 8907

> I am not entirely convinced by NB2.  I am, in fact, a sort of sysadmin
> person and most of my programs write to a log file.  The programs are
> also moderately complex, so a single program might access a database,
> query an LDAP server, send email etc., so potentially quite a lot can go
> wrong.  They are also not programs whose output I would pipe to another
> command.  What would be the advantage of logging to stderr?  Quite apart
> from that, I find having a log file a useful for debugging when I am
> developing.

First, the problem with writing to files is that there is no way to
make these logs reliable.  This is what I mean by saying these are
unreliable: since logs are designed to grow indefinitely, the natural
response to this design property is log rotation.  But, it's
impossible to reliably rotate a log file.  There's always a chance
that during the rotation some log entries will be written to the file
past the point of rotation, but prior to the point where the next logs
volume starts.

There are similar reliability problems with writing to Unix or
Internet sockets, databases etc.  For different reasons, but at the
end of the day, whoever wants logs, they want them to be reliable.
Both simplicity and convention selected for stderr as the only and the
best source of logging output.

Programs that write their output to log files will always irritate
their users because users will have to do some detective work to
figure out where those files are, and in some cases they will have to
do administrative works to make sure that the location where the
program wants to store the log files is accessible, has enough free
space, is speedy enough etc.  So, from the ops perspective, whenever I
come across a program that tries to write logs to anything other than
stderr, I make an earnest effort to throw that program into the gutter
and never touch it again.  It's too much headache to babysit every
such program, to remember the location of the log files of every such
program, the required permissions, to provision storage.  If you are
in that line of work, you just want all logs to go to the same place
(journal), where you can later filter / aggregate / correlate and
perform other BI tasks as your heart desires.

Of course, if you only administer your own computer, and you have low
single digits programs to run, and their behavior doesn't change
frequently, and you don't care to drop some records every now and
then... it's OK to log to files directly from a program.  But then you
aren't really in the sysadmin / infra / ops category, as you are more
of a hobby enthusiast.

Finally, if you want your logs to go to a file, and currently, your
only option is stderr, your shell gives you a really, really simple
way of redirecting stderr to a file.  So, really, there aren't any
excuses to do that.