How do you log in your projects?

Lars Liedtke liedtke at punkt.de
Tue Feb 8 09:13:07 EST 2022


Hello,

inspired by this thread 
https://mail.python.org/pipermail/python-list/2022-February/905167.html 
I finally came around to send in this question.

I know how to use python logging generally. Being on the DevOps-Side of 
things at the moment, I naturally began liking to run tools, which not 
only have logging, but also have different levels of logging 
configurable, because often when you run a couple of different services 
and software projects, logging is often the first help you turn to, and 
sometimes it is the only way to know what is going on. Not that the code 
of most (FLOSS) software is not available, but you simply do not have 
the time to read into the code of every piece of software you run.

So of course I want to write software on my own, if I have to or wpuld 
like to, that has got a decent amount of logging. But how often to 
actually log things? Of course the obvious answer is "it depends".

So how do you do your logging?
- On a line per line basis? on a function/method basis?
- Do you use decorators to mark beginnings and ends of methods/functions 
in log files?
- Which kind of variable contents do you write into your logfiles? Of 
course you shouldn't leak secrets...
- How do you decide, which kind of log message goes into which level?
- How do you prevent logging cluttering your actual code?

Maybe there are some questions I forgot, so please feel free to add 
whatever you think might help finding the best way of logging (tm)

Cheers

Lars

-- 
punkt.de GmbH
Lars Liedtke
.infrastructure

Kaiserallee 13a	
76133 Karlsruhe

Tel. +49 721 9109 500
https://infrastructure.punkt.de
info at punkt.de

AG Mannheim 108285
Geschäftsführer: Jürgen Egeling, Daniel Lienert, Fabian Stein



More information about the Python-list mailing list