This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Logging failure with timestamp messages
Type: crash Stage: test needed
Components: Windows Versions: Python 3.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: cheryl.sabella, kinow, paul.moore, steve.dower, tim.golden, xtobes, zach.ware
Priority: normal Keywords:

Created on 2019-11-06 15:10 by xtobes, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg356138 - (view) Author: xtobes (xtobes) Date: 2019-11-06 15:10
This only happings on Windows, the scripts runs some seconds and then stops and exit with: Process finished with exit code -1073740940 (0xC0000374). This happens when the format variable of a logging config object contains the identifier '%(asctime)s'.
msg357698 - (view) Author: Bruno P. Kinoshita (kinow) * Date: 2019-12-02 01:21
I think this needs a script to reproduce the problem.

Tested first with Anaconda Python 3.7.1 on Win10 Pro. Not able to reproduce the issue. Smae with the latest version.

Using Python master and Win10Pro and timezone set to NZ (not that really matter, but just in case).

    Python 3.9.0a1+ (heads/master:2fe4c48917, Dec  2 2019, 14:12:32) [MSC v.1916 64 bit (AMD64)] on win32

with the example from https://docs.python.org/3/library/logging.html:

    import logging
    FORMAT = '%(asctime)-15s %(clientip)s %(user)-8s %(message)s'
    logging.basicConfig(format=FORMAT)
    d = {'clientip': '192.168.0.1', 'user': 'fbloggs'}
    logger = logging.getLogger('tcpserver')
    
    logger.warning('Protocol problem: %s', 'connection reset', extra=d)

Gives:

    2019-12-02 14:14:46,615 192.168.0.1 fbloggs  Protocol problem: connection reset

If I modify the example to use just %(asctime)s


    import logging
    FORMAT = '%(asctime)s'
    logging.basicConfig(format=FORMAT)
    d = {'clientip': '192.168.0.1', 'user': 'fbloggs'}
    logger = logging.getLogger('tcpserver')
    
    logger.warning('Protocol problem: %s', 'connection reset', extra=d)

Now gives:

    2019-12-02 14:18:29,047

Everything looks OK, at least on my environment.
msg358424 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2019-12-15 12:49
I'm going to close this pending additional information from the OP.  @xtobes, please reopen if you are able to provide a minimally reproducing example.  Thank you!
History
Date User Action Args
2022-04-11 14:59:22adminsetgithub: 82901
2019-12-15 12:49:32cheryl.sabellasetstatus: open -> closed

nosy: + cheryl.sabella
messages: + msg358424

resolution: works for me
stage: test needed
2019-12-02 01:21:50kinowsetnosy: + kinow
messages: + msg357698
2019-11-06 15:10:27xtobescreate