RasaHQ / rasa

💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
https://rasa.com/docs/rasa/
Apache License 2.0
18.82k stars 4.62k forks source link

Default logging file encoding config set #3025

Closed XiaofeiQian closed 5 years ago

XiaofeiQian commented 5 years ago
**Rasa Core version**: rasa-core 0.13.2 pypi_0 pypi **Python version**: python 3.6.7 h9f7ef89_2 defaults **Operating system** (windows, osx, ...): Windows 10 Pro 1809 **Issue**: Default logging file encoding config not set enconding to utf8, and when I build a chinese bot and set --debug mode in : `python -m rasa_core.run -d models/core -u nlu/ --endpoints data/endpoints.yml --credentials data/credentials.yml -o logs/core.log --debug` default output log file some text like this: ``` Bot utterance 'BotUttered(text: ��Ǹ����Ϊ���˳����������½��м�¼��, data: { "elements": null, "buttons": null, "attachment": null })' ``` it can't show chinese char. I can fix it by edit `D:\Programs\Anaconda3\envs\nlp\Lib\site-packages\rasa_core\utils.py` line 31 ``` def configure_file_logging(loglevel, logfile): if logfile: fh = logging.FileHandler(logfile) fh.setLevel(loglevel) logging.getLogger('').addHandler(fh) logging.captureWarnings(True) ``` to ``` fh = logging.FileHandler(logfile, encoding='utf-8') ``` so can we default use utf8 like #1041 #1100 Thanks a lot ! **Content of domain file** (if used & relevant): ```yaml ```
akelad commented 5 years ago

@HatuneMiku would you be able to submit a PR for this?

XiaofeiQian commented 5 years ago

OK, I just submit #1784. this can be fix.