web2py / py4web

Other
244 stars 126 forks source link

scheduler and logging: I/O operation on closed file #900

Closed mbelletti closed 1 month ago

mbelletti commented 1 month ago

Using the scheduler the logger complain that the log file is closed.

My setting options in settings.py:

LOGGERS = [
    "debug:stdout"
]
--- Logging error ---
Traceback (most recent call last):
  File "/Users/max/.pyenv/versions/3.10.2/lib/python3.10/logging/__init__.py", line 1103, in emit
    stream.write(msg + self.terminator)
ValueError: I/O operation on closed file
Call stack:
  File "/Users/max/.pyenv/versions/3.10.2/lib/python3.10/threading.py", line 966, in _bootstrap
    self._bootstrap_inner()
  File "/Users/max/.pyenv/versions/3.10.2/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/Users/max/.pyenv/versions/3.10.2/lib/python3.10/threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/max/.pyenv/versions/py4web_3.10.2/lib/python3.10/site-packages/pydal/tools/scheduler.py", line 183, in loop
    if not self.step():
  File "/Users/max/.pyenv/versions/py4web_3.10.2/lib/python3.10/site-packages/pydal/tools/scheduler.py", line 228, in step
    self.logger.info("no new tasks")
Message: 'no new tasks'
kszys commented 1 month ago

Seems to be a duplicate of #896