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.

Author vinay.sajip
Recipients SilentGhost, jonathan-lp, paul.moore, steve.dower, tim.golden, vinay.sajip, zach.ware
Date 2019-05-31.19:33:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1559331230.68.0.163862353268.issue37111@roundup.psfhosted.org>
In-reply-to
Content
> Doing something as basic as logging unicode shouldn't require knowledge of "handlers" - that's failing "simple is better than complex".

I reiterate my statement that it appears that you aren't sufficiently familiar with how logging is designed to work. Logging is more complex than print() or open() because it has to work flexibly in lots of different scenarios. Handlers are part of this, as are Formatters and Filters.

See my 2009 blog post

https://plumberjack.blogspot.com/2009/09/python-logging-101.html

for more information for why logging is designed the way it is.

If you want to configure a stream with utf-8 encoding, without explicitly using handlers, this is easily doable, as follows:

C:\Users\Vinay> \python37\python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.basicConfig(stream=open(r'c:\temp\my_log.log', 'w', encoding='utf-8'))
>>> logging.error('จุด1')
>>> ^Z

and, lo and behold, the file c:\temp\my_log.log contains

ERROR:root:จุด1

The use of the stream keyword parameter is clearly documented at

https://docs.python.org/3/library/logging.html#logging.basicConfig

Did you look at the basicConfig documentation before raising this issue?
History
Date User Action Args
2019-05-31 19:33:50vinay.sajipsetrecipients: + vinay.sajip, paul.moore, tim.golden, SilentGhost, zach.ware, steve.dower, jonathan-lp
2019-05-31 19:33:50vinay.sajipsetmessageid: <1559331230.68.0.163862353268.issue37111@roundup.psfhosted.org>
2019-05-31 19:33:50vinay.sajiplinkissue37111 messages
2019-05-31 19:33:50vinay.sajipcreate