[issue18671] enhance formatting in logging package
New submission from M. Dietrich: in logging/__init__.py line 328 there is a simple line: msg = msg % self.args if that line fails this failure will be logged, not the line itself. i suggest to change the line to something like: try: msg = msg % self.args except TypeError: msg = 'logging formatting error with "%s" %% %s' % ( msg, self.args, ) to be able to pinpoint the actual wrong formatting string (the stack trace doesnt help here). -- components: Extension Modules messages: 194559 nosy: mdt priority: normal severity: normal status: open title: enhance formatting in logging package type: enhancement ___ Python tracker <http://bugs.python.org/issue18671> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18671] enhance formatting in logging package
M. Dietrich added the comment: yes, seeing the erranous line where the wrong formatstring comes from is nice but sometimes (for myself: often) i need to know what actually was tried to be logged. this information is lost in both cases. this is especially sad if you have long-running processes that encounter an error after a long time and that error is logged but the logging itself fails due to formatting issues. i suggest to log whatever is avaiable in the suggested way to at least see this valuable information. the additional information where it comes from for further fixing is apreaciated as well. btw: the stackstrace of the logging internals could be left out in my oppinion, it just pollutes the output with no means to the programer. -- status: pending -> open ___ Python tracker <http://bugs.python.org/issue18671> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18671] enhance formatting in logging package
M. Dietrich added the comment: for a logging library the important thing would be to not loose the information that was meant to log. as i said i do alot of long-running huge-data-processing scripts in py using the library. if the logging breaks but doesnt log what was intended to log i judge this a major problem. and furthermore: it is so simple to add both information: the data that was to be logged plus the state that an error occured while formatting and where the log-call was made. -- status: pending -> open ___ Python tracker <http://bugs.python.org/issue18671> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18671] enhance formatting in logging package
M. Dietrich added the comment: thanks, it will be really helpful for me to have this fixed. as i consider this a "bug" it would be possible to "fix" this for 2.7 and yes you are right, i talked about 2.7 as we are still using this version in production. -- status: pending -> open ___ Python tracker <http://bugs.python.org/issue18671> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1982] Feature: extend strftime to accept milliseconds
M. Dietrich added the comment: i am not shure what the code snippet shall proove but shouldnt't it read from datetime import datetime a_datetime = datetime.now() a_datetime = a_datetime.replace(microsecond = 1) iso_str = a_datetime.isoformat() b_datetime = datetime.strptime(iso_str, "%Y-%m-%dT%H:%M:%S.%f") assert(a_datetime == b_datetime) ? i general i would expect for each operation a reverse if possible to be complete. so if there is a strftime, i look for a strptime, if there is a isoformat, i like a isoparse. and to be complete i need a format tag for ms if there is a microseconds member in datatime object. -- nosy: +mdt ___ Python tracker <http://bugs.python.org/issue1982> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com