Hi!
We have an application developed using Tryton 4.6.
Recently we tried it in Tryton 5.0 and discovered strange logging behavior.
Namely, strings that contain Unicode characters simply disappear in logs.
But there are no any error messages, these strings disappear “silently”.
For example, such string gets into the log: logger.info('mama')
But such string does not get into the log: logger.info('мама') # u'\u043c\u0430\u043c\u0430'
Unicode strings were logging normally in Tryton 4.6 + Python 2.7 environment.
There is no problem with logging of these strings in Python 3.6 without Tryton.
Why are Unicode strings not logging in Tryton 5.0 + Python 3.6 environment?
I tested using your example as login and I can see the logging ERROR trytond.security login failed for 'мама' from '127.0.0.1' on database 'trunk'.
I guess it is the console that does not support the encoding. Did you try to store logs in a file?
We use exactly the files for logs (info.log, debug.log, warning.log, error.log, critical.log).
If you run the logger.info() commands listed in our message, then only the result of the first command logger.info('mama') gets into file ‘info.log’:
Wed Feb 06 15:46:49 2019] INFO:trytond.modules.staff.staff_num:mama
But for some reason the result of the second command logger.info('мама') does not get into file ‘info.log’. However, no error message is displayed.
We have solved the problem by adding ‘utf-8’ parameter to the logger configuration.
For example: args = ('/usr/local/lib/python3.6/site-packages/trytond/logs/info.log', 'midnight', 1, 5, 'utf-8')
But the question remains:
Why are Unicode strings logging normally in Python 3.6 without Tryton, but they are not logging in Python 3.6 + Tryton 5.0 environment (without parameter ‘utf-8’)?