commit ef744f164be26f88b6cd0be799800e58c9f63f4e
parent ec0f91942da11a6c28c6867a1ea0d8e63d510ca7
Author: SomberNight <somber.night@protonmail.com>
Date: Mon, 16 Nov 2020 14:50:22 +0100
logging: make sure file logging uses utf8 encoding
--- Logging error ---
Traceback (most recent call last):
File "...\Python38\lib\logging\__init__.py", line 1084, in emit
stream.write(msg + self.terminator)
File "...\Python38\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u26a1' in position 80: character maps to <undefined>
Call stack:
File ".../electrum/run_electrum", line 466, in <module>
main()
File ".../electrum/run_electrum", line 384, in main
handle_cmd(
File ".../electrum/run_electrum", line 402, in handle_cmd
d.run_gui(config, plugins)
File "...\electrum\electrum\daemon.py", line 572, in run_gui
self.gui_object.main()
File "...\electrum\electrum\gui\qt\__init__.py", line 391, in main
self.app.exec_()
File "...\electrum\electrum\gui\qt\channels_list.py", line 308, in new_channel_with_warning
self.new_channel_dialog()
File "...\electrum\electrum\gui\qt\channels_list.py", line 390, in new_channel_dialog
if not d.exec_():
File "...\electrum\electrum\gui\qt\channels_list.py", line 358, in on_suggest
nodeid = bh2u(lnworker.lnrater.suggest_peer() or b'')
File "...\electrum\electrum\lnrater.py", line 257, in suggest_peer
return self.suggest_node_channel_open()[0]
File "...\electrum\electrum\lnrater.py", line 248, in suggest_node_channel_open
self.logger.info(
Message: 'node rating for Bottlepay⚡:\nNodeStats(number_channels=20, total_capacity_msat=167455866000, median_capacity_msat=8460000000.0, mean_capacity_msat=8372793300.0, node_age_block_height=71003, mean_channel_age_block_height=48581.39999999991, blocks_since_last_channel=507, mean_fee_rate=1e-06) (score 0.5034595626052799)'
Arguments: ()
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/electrum/logging.py b/electrum/logging.py
@@ -91,7 +91,7 @@ def _configure_file_logging(log_directory: pathlib.Path):
PID = os.getpid()
_logfile_path = log_directory / f"electrum_log_{timestamp}_{PID}.log"
- file_handler = logging.FileHandler(_logfile_path)
+ file_handler = logging.FileHandler(_logfile_path, encoding='utf-8')
file_handler.setFormatter(file_formatter)
file_handler.setLevel(logging.DEBUG)
root_logger.addHandler(file_handler)