Closed KondratevAD closed 1 year ago
Hi, did you find a solution to this problem?
Hi, did you find a solution to this problem?
Hi, not yet
Hi, did you find a solution to this problem?
one of the solutions, but it's a crutch: Structure:
app
| logging.ini
| test.py
| util
| __init__.py
| my_formatter.py
my_formatter
from pythonjsonlogger.jsonlogger import JsonFormatter
class CustomJsonFormatter(JsonFormatter):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.json_ensure_ascii = False
test.py
import logging.config
logging.config.fileConfig(
'logging.ini',
defaults={'logfilename': 'text.txt'},
disable_existing_loggers=False,
)
logger = logging.getLogger(__name__)
if __name__ == '__main__':
a = 'My name Александр'
logger.error(a)
Thank you!
I use conf file, but the value json_ensure_ascii is not assigned. Conf file: