Skip to content

Logs not rotating #2549

@BrutuZ

Description

@BrutuZ

Expected behaviour:

Logs to be properly rotated from flexget.log to flexget.log.1-9 when reaching the criteria

Actual behaviour:

Loguru tells it can't rotate flexget.log because the file is supposedly in use by another application, copies it to the same folder appending a timestamp to the filename and flexget.log is neither erased nor updated.

Steps to reproduce:

  • Step 1: Fill flexget.log close to the 1MB rotation mark
  • Step 2: Have the Flexget daemon in Windows fill the remaining bytes to trigger a log rotation

Log:

(click to expand)
--- Logging error in Loguru Handler #3 ---
Record was: {'elapsed': datetime.timedelta(seconds=62, microseconds=308763), 'exception': None, 'extra': {'task': 'clean-anime-series-list', 'session_id': None, 'task_id': '121378'}, 'file': (name='verbose_details.py', path='%USERPROFILE%\\github\\flexget\\flexget\\plugins\\operate\\verbose_details.py'), 'function': 'on_task_download', 'level': (name='VERBOSE', no=15, icon='?'), 'line': 36, 'message': 'Summary - Accepted: 0 (Rejected: 0 Undecided: 0 Failed:
0)', 'module': 'verbose_details', 'name': 'details', 'process': (id=9684, name='MainProcess'), 'thread': (id=9940, name='task_queue'), 'time': datetime(2019, 12, 30, 0, 33, 26, 805511, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=75600), 'E. South America Standard Time'))}
Traceback (most recent call last):
  File "%USERPROFILE%\github\flexget\lib\site-packages\loguru\_handler.py", line 153, in emit
    self._sink.write(str_record)
  File "%USERPROFILE%\github\flexget\lib\site-packages\loguru\_file_sink.py", line 175, in write
    self._initialize_file(rename_existing=True)
  File "%USERPROFILE%\github\flexget\lib\site-packages\loguru\_file_sink.py", line 189, in _initialize_file
    os.rename(new_path, renamed_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: '%USERPROFILE%\\flexget\\flexget.log' -> '%USERPROFILE%\\flexget\\flexget.2019-12-28_19-13-58_544131.log'
--- End of logging error ---

Additional information:

Checked flexget.log with LockHunter to find the culprit for the file being in use, and all it returned was the pythonw.exe instance that's running Flexget

  • FlexGet version: 3.0.27
  • Python version: 3.7
  • Installation method: git \ virtualenv
  • Using daemon (yes/no): yes
  • OS and version: Win10
  • Link to crash log:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions