Skip to content

[BUGFIX] Refactor logging & exception handling#1696

Merged
microtechno9000 merged 20 commits intoautomatic-ripping-machine:mainfrom
xieve:refactor-logging-exceptions
Feb 17, 2026
Merged

[BUGFIX] Refactor logging & exception handling#1696
microtechno9000 merged 20 commits intoautomatic-ripping-machine:mainfrom
xieve:refactor-logging-exceptions

Conversation

@xieve
Copy link
Copy Markdown
Contributor

@xieve xieve commented Feb 8, 2026

Description

The most important changes are:

  • Simplified logging logic and setup
  • Changed log format to be more consistent and readable (to me)
  • Replaced all calls to sys.exit() and all bare Exceptions in the ripper with RipperExceptions
    • This allowed me to make sure that discs are always ejected when the ripper exits,
    • which in turn allowed me to remove the flawed UNIDENTIFIED_EJECT logic entirely

Fixes #1360, #779

For the complete changelog, please check the individual commit messages, I did my best to justify each change individually and in detail. That is the mode I recommend doing code review in (per commit, not per file).

I believe that my commits are atomic and for this reason I would ask if they could possibly be spared from being squashed before being merged, since squashing them would remove quite a lot of information. If they are squashed, one cannot easily connect the justification to the singular change anymore. The reason I am not splitting this into more PRs is because that would take a lot of time to coordinate, since almost all of the commits in this PR depend on the ones before them.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor

How Has This Been Tested?

  • Ripped at least one disc using:
    • Docker
    • Other (My NixOS module)
  • Diffed the log output before and after my changes to make sure no information was lost
  • Tested with different LOGLEVELs
  • Made media output folder read-only to test the logging of errors
  • Put a PS3 disc in the drive to ensure it is ejected automatically (I will re-test this soon, it has been a while)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have tested that my fix is effective or that my feature works

Logs

DVDVIDEO_177054228848.log

@xieve
Copy link
Copy Markdown
Contributor Author

xieve commented Feb 8, 2026

I don't understand why the CI is complaining about code I did not touch :(

@xieve
Copy link
Copy Markdown
Contributor Author

xieve commented Feb 8, 2026

Huh? I did not touch that part either, at least in this PR 😅

xieve added 18 commits February 8, 2026 20:33
Before:

	[2026-02-06 18:40:20] DEBUG ARM: Class.method <message>

After:

	2026-02-08 10:18:08 ARM: DEBUG: Class.method: <message>

- stdout now uses short formatting (eg. for journald, which timestamps stdout)
- Handling of debug level formatting is more consistent now
- Removed `clean_loggers()`:
	- This function wasn't really doing what it said it was, since it was only removing at most one handler. Instead, I opted to only remove FileHandlers, such that if a more specific log file is created, the messages are not also logged to arm.log, but they are still logged to stdout and syslog.
Some containers don't have or need a syslog
Replaces all bare Exceptions and all sys.exit() calls with
RipperExceptions.

- more consistent error handling
- simplified make_dir helper function
- removed try-catch where we were calling sys.exit() anyways
Closes automatic-ripping-machine#1360

UNIDENTIFIED_EJECT is not necessary anymore, since the ripper will now
always eject at the end (if AUTO_EJECT is set), even if an error is
thrown, so we can do away with the unreliable pre-check entirely and
rest assured that the ripper itself is much more capable of correctly
identifying whether a disc is rippable or not.
Copy link
Copy Markdown
Collaborator

@microtechno9000 microtechno9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on improving the log handling, will make future updates easier

@sonarqubecloud
Copy link
Copy Markdown

@microtechno9000 microtechno9000 merged commit 9850e69 into automatic-ripping-machine:main Feb 17, 2026
11 of 12 checks passed
@xieve xieve deleted the refactor-logging-exceptions branch March 12, 2026 11:08
uprightbass360 added a commit to uprightbass360/automatic-ripping-machine-neu that referenced this pull request Apr 3, 2026
Wrap the arm.yaml write during config migration in try/except OSError
so startup doesn't crash when the config file is mounted read-only
(e.g. Docker bind-mount). The API settings layer already handles this
case, but the startup migration path did not.

Also removes redundant explicit file.close() — the with-statement
handles cleanup.

Ref: upstream automatic-ripping-machine#1696
uprightbass360 added a commit to uprightbass360/automatic-ripping-machine-neu that referenced this pull request Apr 4, 2026
Wrap the arm.yaml write during config migration in try/except OSError
so startup doesn't crash when the config file is mounted read-only
(e.g. Docker bind-mount). The API settings layer already handles this
case, but the startup migration path did not.

Also removes redundant explicit file.close() — the with-statement
handles cleanup.

Ref: upstream automatic-ripping-machine#1696
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🔧 Move everything that is not strictly part of the docker wrapper out of docker_arm_wrapper.sh

2 participants