Re: FileNotFoundError thrown due to file name in file, rather than file itself

Liste des GroupesRevenir à cl python 
Sujet : Re: FileNotFoundError thrown due to file name in file, rather than file itself
De : olegsivokon (at) *nospam* gmail.com (Left Right)
Groupes : comp.lang.python
Date : 12. Nov 2024, 20:10:55
Autres entêtes
Message-ID : <mailman.100.1731438669.4695.python-list@python.org>
References : 1 2 3 4 5
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.

Date Sujet#  Auteur
11 Nov 24 * FileNotFoundError thrown due to file name in file, rather than file itself25Loris Bennett
11 Nov 24 +* Re: FileNotFoundError thrown due to file name in file, rather than file itself17Left Right
12 Nov 24 i`* Re: FileNotFoundError thrown due to file name in file, rather than file itself16Loris Bennett
12 Nov 24 i +* Re: FileNotFoundError thrown due to file name in file, rather than file itself3Left Right
13 Nov 24 i i`* Re: FileNotFoundError thrown due to file name in file, rather than file itself2Greg Ewing
13 Nov 24 i i `- Re: FileNotFoundError thrown due to (Posting On Python-List Prohibited)1Lawrence D'Oliveiro
12 Nov 24 i +- Re: FileNotFoundError thrown due to file name in file, rather than file itself1Mats Wichmann
12 Nov 24 i +- Re: FileNotFoundError thrown due to file name in file, rather than file itself1Chris Angelico
13 Nov 24 i +* Re: FileNotFoundError thrown due to file name in file, rather than file itself2Loris Bennett
14 Nov 24 i i`- Re: FileNotFoundError thrown due to file name in file, rather than file itself1Barry
13 Nov 24 i +- Re: FileNotFoundError thrown due to file name in file, rather than file itself1Roel Schroeven
14 Nov 24 i +- Re: FileNotFoundError thrown due to file name in file, rather than file itself1Michael Torrie
14 Nov 24 i +- Re: FileNotFoundError thrown due to file name in file, rather than file itself1Left Right
14 Nov 24 i +- Re: FileNotFoundError thrown due to file name in file, rather than file itself1Chris Angelico
13 Nov 24 i +- Re: FileNotFoundError thrown due to file name in file, rather than file itself1D'Arcy Cain
14 Nov 24 i +- Re: FileNotFoundError thrown due to file name in file, rather than file itself1Ethan Furman
14 Nov 24 i `* Re: FileNotFoundError thrown due to file name in file, rather than file itself2Michael Torrie
14 Nov 24 i  `- Re: FileNotFoundError thrown due to file name in file, rather than file itself1Jon Ribbens
11 Nov 24 +- Re: FileNotFoundError thrown due to file name in file, rather than file itself1dieter.maurer
11 Nov 24 +- Re: FileNotFoundError thrown due to (Posting On Python-List Prohibited)1Lawrence D'Oliveiro
12 Nov 24 `* Re: FileNotFoundError thrown due to file name in file, rather than file itself5Chris Angelico
12 Nov 24  +* Re: FileNotFoundError thrown due to file name in file, rather than file itself3Loris Bennett
13 Nov 24  i+- Re: FileNotFoundError thrown due to file name in file, rather than file itself1dieter.maurer
14 Nov 24  i`- Re: FileNotFoundError thrown due to file name in file, rather than file itself1Kushal Kumaran
12 Nov 24  `- Re: FileNotFoundError thrown due to file name in file, rather than file itself1Loris Bennett

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal