Trading-Bot
Trading-Bot copied to clipboard
Split logs when instance.log file is full
When the instance.log file fills up (in my case, when it reaches 89980 lines), it becomes unwriteable and the docker logs show the errors similar to this:
2021-05-31 18:09:28,339 - AgeFilter - INFO - Validated 49 pairs.
--- Logging error ---
Traceback (most recent call last):
File "/usr/local/lib/python3.9/logging/handlers.py", line 74, in emit
self.doRollover()
File "/usr/local/lib/python3.9/logging/handlers.py", line 177, in doRollover
self.rotate(self.baseFilename, dfn)
File "/usr/local/lib/python3.9/logging/handlers.py", line 115, in rotate
os.rename(source, dest)
OSError: [Errno 16] Device or resource busy: '/freqtrade/freqtrade.log' -> '/freqtrade/freqtrade.log.1'
Call stack:
File "/home/ftuser/.local/bin/freqtrade", line 33, in <module>
sys.exit(load_entry_point('freqtrade', 'console_scripts', 'freqtrade')())
File "/freqtrade/freqtrade/main.py", line 37, in main
return_code = args['func'](args)
File "/freqtrade/freqtrade/commands/trade_commands.py", line 19, in start_trading
worker.run()
File "/freqtrade/freqtrade/worker.py", line 74, in run
state = self._worker(old_state=state)
File "/freqtrade/freqtrade/worker.py", line 111, in _worker
self._throttle(func=self._process_running, throttle_secs=self._throttle_secs)
File "/freqtrade/freqtrade/worker.py", line 132, in _throttle
result = func(*args, **kwargs)
File "/freqtrade/freqtrade/worker.py", line 145, in _process_running
self.freqtrade.process()
File "/freqtrade/freqtrade/freqtradebot.py", line 164, in process
self.active_pair_whitelist = self._refresh_active_whitelist(trades)
File "/freqtrade/freqtrade/freqtradebot.py", line 223, in _refresh_active_whitelist
self.pairlists.refresh_pairlist()
File "/freqtrade/freqtrade/plugins/pairlistmanager.py", line 87, in refresh_pairlist
pairlist = pairlist_handler.filter_pairlist(pairlist, tickers)
File "/freqtrade/freqtrade/plugins/pairlist/AgeFilter.py", line 74, in filter_pairlist
logger.info(f"Validated {len(pairlist)} pairs.")
Message: 'Validated 49 pairs.'
Arguments: ()
The standard freqtrade method of handling logs is to split up the file once it fills up, but the instance.log mechanism implemented here does not do the same. Please consider adding this.