On 11/13/24 23:03, Left Right via Python-list wrote:
>> On any Unix system this is untrue. Rotating a log file is quite simple:
>
> I realized I posted this without cc'ing the list:
> http://jdebp.info/FGA/do-not-use-logrotate.html .
>
> The link above gives a more detailed description of why lo
On 2024-11-14, Michael Torrie wrote:
> On 11/14/24 12:03 AM, Left Right wrote:
>>> On any Unix system this is untrue. Rotating a log file is quite simple:
>>
>> I realized I posted this without cc'ing the list:
>> http://jdebp.info/FGA/do-not-use-logrotate.html .
>>
>> The link above gives a mo
On 11/14/24 12:03 AM, Left Right wrote:
>> On any Unix system this is untrue. Rotating a log file is quite simple:
>
> I realized I posted this without cc'ing the list:
> http://jdebp.info/FGA/do-not-use-logrotate.html .
>
> The link above gives a more detailed description of why log rotation
>
> On 14 Nov 2024, at 14:07, Loris Bennett via Python-list
> wrote:
>
> I don't quite understand what your suggestion is. Do you mean that I
> should log to stderr and then run my program as
>
> my_program ... 2>&1 | logger
On almost all Linux distros you would run a long running program a
On 11/13/24 02:12, Roel Schroeven via Python-list wrote:
What I most often do is use one logfile per day, with the date in the
filename. Then simply delete all files older than 7 days, or 30 days, or
whatever is useful for the task at hand. Not only does that sidestep any
issues with rotating l
Left Right writes:
>> 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 q
On Thu, 14 Nov 2024 at 18:05, Left Right via Python-list
wrote:
>
> > On any Unix system this is untrue. Rotating a log file is quite simple:
>
> I realized I posted this without cc'ing the list:
> http://jdebp.info/FGA/do-not-use-logrotate.html .
>
> The link above gives a more detailed descript
> On any Unix system this is untrue. Rotating a log file is quite simple:
I realized I posted this without cc'ing the list:
http://jdebp.info/FGA/do-not-use-logrotate.html .
The link above gives a more detailed description of why log rotation
on the Unix system is not only not simple, but is, in
On 11/12/24 12:10 PM, Left Right via Python-list wrote:
> 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.
On Wed, Nov 13 2024 at 07:36:04 PM, dieter.mau...@online.de wrote:
> Loris Bennett wrote at 2024-11-12 10:00 +0100:
>> ...
>>However, it strikes me as not immediately obvious that the logging file
>>must exist at this point. I can imagine a situation in which I want to
>>configure a default log fi
Loris Bennett wrote at 2024-11-12 10:00 +0100:
> ...
>However, it strikes me as not immediately obvious that the logging file
>must exist at this point. I can imagine a situation in which I want to
>configure a default log file and create it if it missing.
This is what happens usually:
if you ope
Op 12/11/2024 om 20:10 schreef Left Right via Python-list:
> 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 serve
On 13/11/24 8:10 am, Left Right wrote:
since logs are designed to grow indefinitely, the natural
response to this design property is log rotation.
I don't see how writing logs to stderr solves that problem in any way.
Whatever stderr is sent to still has a potentially unlimited amount
of data t
On 12/11/2024 08:52, Loris Bennett via Python-list wrote:
Cameron Simpson writes:
Generally you should put a try/except around the smallest possible
piece of code.
That is excellent advice.
Best wishes
Rob Cliffe
So:
config = configparser.ConfigParser()
try:
config.r
On Wed, 13 Nov 2024 at 07:29, Mats Wichmann via Python-list
wrote:
>
> On 11/12/24 12:10, Left Right via Python-list wrote:
>
> > 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 stder
On 11/12/24 12:10, Left Right via Python-list wrote:
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.
an awful lot of th
> 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
Left Right writes:
> Poor error reporting is a very common problem in programming. Python
> is not anything special in this case. Of course, it would've been
> better if the error reported what file wasn't found. But, usually
> these problems are stacking, like in your code. Unfortunately, it
Am Tue, Nov 12, 2024 at 09:52:31AM +0100 schrieb Loris Bennett via Python-list:
> Regarding your example above, if 'missingfile.py' contains the following
>
> import configparser
>
> config = configparser.ConfigParser()
>
> try:
> config.read('/foo/bar')
> except FileNotFoundError as
Chris Angelico writes:
> On Tue, 12 Nov 2024 at 01:59, Loris Bennett via Python-list
> wrote:
>> 2. In terms of generating a helpful error message, how should one
>>distinguish between the config file not existing and the log file not
>>existing?
>
> By looking at the exception's attribu
Cameron Simpson writes:
> On 11Nov2024 18:24, dieter.mau...@online.de wrote:
>>Loris Bennett wrote at 2024-11-11 15:05 +0100:
>>>I have the following in my program:
>>>try:
>>>logging.config.fileConfig(args.config_file)
>>>config = configparser.ConfigParser()
>>>confi
Chris Angelico writes:
> On Tue, 12 Nov 2024 at 01:59, Loris Bennett via Python-list
> wrote:
>> 2. In terms of generating a helpful error message, how should one
>>distinguish between the config file not existing and the log file not
>>existing?
>
> By looking at the exception's attribu
Cameron Simpson wrote at 2024-11-12 08:17 +1100:
>On 11Nov2024 18:24, dieter.mau...@online.de wrote:
>>Loris Bennett wrote at 2024-11-11 15:05 +0100:
>>>I have the following in my program:
>>>try:
>>>logging.config.fileConfig(args.config_file)
>>>config = configparser.ConfigPar
On Tue, 12 Nov 2024 at 01:59, Loris Bennett via Python-list
wrote:
> 2. In terms of generating a helpful error message, how should one
>distinguish between the config file not existing and the log file not
>existing?
By looking at the exception's attributes rather than assuming and
hard-c
On 12/11/24 10:17, Cameron Simpson via Python-list wrote:
On 11Nov2024 18:24, dieter.mau...@online.de
wrote:
Loris Bennett wrote at 2024-11-11 15:05 +0100:
I have the following in my program:
try:
logging.config.fileConfig(args.config_file)
config = configparser.ConfigParser()
On 11Nov2024 18:24, dieter.mau...@online.de wrote:
Loris Bennett wrote at 2024-11-11 15:05 +0100:
I have the following in my program:
try:
logging.config.fileConfig(args.config_file)
config = configparser.ConfigParser()
config.read(args.config_file)
if args.verbos
Loris Bennett wrote at 2024-11-11 15:05 +0100:
>I have the following in my program:
>try:
>logging.config.fileConfig(args.config_file)
>config = configparser.ConfigParser()
>config.read(args.config_file)
>if args.verbose:
>print(f"Configuration file:
Poor error reporting is a very common problem in programming. Python
is not anything special in this case. Of course, it would've been
better if the error reported what file wasn't found. But, usually
these problems are stacking, like in your code. Unfortunately, it's
your duty, as the language
Hi,
I have the following in my program:
try:
logging.config.fileConfig(args.config_file)
config = configparser.ConfigParser()
config.read(args.config_file)
if args.verbose:
print(f"Configuration file: {args.config_file}")
except FileNotFoundErro
29 matches
Mail list logo