Log Each "Library Maintenance" job in info level

(this is for version 23.8.0)

The “Run Library Maintenance Jobs” button on the health page does the following:

  • Vacuum expired log and cache files
  • Runs a db validation, vacuum, and backup
  • Recounts tags
  • Rebuilds the search indices

I understand that these will produce “debug” level logs.

I’d like to request that each of those areas logs an “info” level log to indicate that the job has started.

For example:

vacuum expired logs started
vacuum expired cache file started
database validation started
database vacuum started
database backup started

It may also be useful if it also logs when that area has finished.

I just checked, and what I said in discord was wrong: it’s already emitting as warn:

export async function cleanup() {
  const library = Library.instance()
  if (library == null) {
    logger().warn("No library to vacuum.")
  } else {
    logger().warn("Running tag and search maintenance...")
    await forceRunTagMaintenance()
    logger().warn("Vacuuming db...")
    await (await library.dbModelSetup_()).db.vacuum()
    if (isDbJanitorService()) {
      logger().warn("Running database maintenance...")
      await library.runDbBackup()

  logger().warn("Cleaning child processes...")
  await Pids.instance()?.killOldProcs()

  logger().warn("Cleaning stale stat db directories...")
  await vacuumStatDbDirs()

  logger().warn("Cleaning stale and temp files...")
  await Promise.all(fileCleanups().map(ea => ea.cleanup()))

Ah, so since I did not get any log messages at all, this may be a bug (either the logging is not working, or the jobs themselves are not being triggered).

Just to provide more info…

When I click on “Run Library Maintenance jobs”, it pops up a toast saying “blah blah (I didn’t catch the verbiage)” with a progress bar. The progress bar gets about halfway through, and then the page reloads back to the home page.

Nothing is logged at log level info