[Issue]: Plugins unable to log #5606

Closed
opened 2025-12-22 02:04:33 +01:00 by backuprepo · 5 comments
Owner

Originally created by @polyfruitism on GitHub (Apr 14, 2024).

Please describe your bug

When developing a plugin, I noticed that no matter the log settings defined in the logging.json or logging.default.json file, my plugin would not log. After discovery, I found that the ILoggerFactory that is registered with the ServiceProvider used to instantiate objects is the default Microsoft.LoggerFactory, not the SerilogLoggerFactory instantiated in Program.

I believe registering the LoggingFactory instance and Logger<> type in ApplicationHost.RegisterServices the same way that LoggingServiceCollectionExtensions.AddLogging does should resolve this issue.

Reproduction Steps

Environment: Should not matter. I used Docker image latest at time of the report.
Config: logging.json or logging.default.json should be configured such that a plugin is able to log a message at any level.

Steps:

  1. Load or enable the plugin configured to log a message.
  2. Trigger the log message.
  3. Review the logs. No log message.

Jellyfin Version

10.8.13

if other:

No response

Environment

- OS: Debian 12
- Linux Kernel: 7.1.0-20-amd64
- Virtualization: Docker
- Clients: N/A
- Browser: N/A
- FFmpeg Version: N/A
- Playback Method: N/A
- Hardware Acceleration: N/A
- GPU Model: N/A
- Plugins: Any should work (AniSearch for example)
- Reverse Proxy: N/A
- Base URL: N/A
- Networking: N/A
- Storage: N/A

Jellyfin logs

There is no relevant log output, since it is not logging.

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
Originally created by @polyfruitism on GitHub (Apr 14, 2024). ### Please describe your bug When developing a plugin, I noticed that no matter the log settings defined in the logging.json or logging.default.json file, my plugin would not log. After discovery, I found that the ILoggerFactory that is registered with the ServiceProvider used to instantiate objects is the default Microsoft.LoggerFactory, not the SerilogLoggerFactory instantiated in Program. I believe registering the LoggingFactory instance and Logger<> type in ApplicationHost.RegisterServices the same way that LoggingServiceCollectionExtensions.AddLogging does should resolve this issue. ### Reproduction Steps Environment: Should not matter. I used Docker image latest at time of the report. Config: logging.json or logging.default.json should be configured such that a plugin is able to log a message at any level. Steps: 1) Load or enable the plugin configured to log a message. 2) Trigger the log message. 3) Review the logs. No log message. ### Jellyfin Version 10.8.13 ### if other: _No response_ ### Environment ```markdown - OS: Debian 12 - Linux Kernel: 7.1.0-20-amd64 - Virtualization: Docker - Clients: N/A - Browser: N/A - FFmpeg Version: N/A - Playback Method: N/A - Hardware Acceleration: N/A - GPU Model: N/A - Plugins: Any should work (AniSearch for example) - Reverse Proxy: N/A - Base URL: N/A - Networking: N/A - Storage: N/A ``` ### Jellyfin logs ```shell There is no relevant log output, since it is not logging. ``` ### FFmpeg logs _No response_ ### Please attach any browser or client logs here _No response_ ### Please attach any screenshots here _No response_ ### Code of Conduct - [X] I agree to follow this project's Code of Conduct
backuprepo 2025-12-22 02:04:33 +01:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@crobibero commented on GitHub (Apr 14, 2024):

Logging from a plugin has worked in 10.8, so you will need to provide a specific plugin and what was entered in logging.config

@crobibero commented on GitHub (Apr 14, 2024): Logging from a plugin has worked in 10.8, so you will need to provide a specific plugin and what was entered in logging.config
Author
Owner

@polyfruitism commented on GitHub (Apr 14, 2024):

For reproducible steps, I performed the following:

  1. I enabled the AniSearch plugin from the Jellyfin repository (v4.0.0)
  2. I updated the default logging.default.json file and added the line "Jellyfin.Plugin": "Debug" in the "Override" section after the "System" line.
  3. Restarted Jellyfin.
  4. Enabled the plugin for a library.
  5. For a show in the library, I attempted to "Refresh Metadata" by both "Searching for missing metadata" and "Replace all metadata".
  6. Reviewed the logs and no logs appear from the plugin.

As this show has not been previously associated to the AniSearch provider, I would expect to see the log message "Start AniSearch... Searching ({Name})" when searching for metadata for the show.

@polyfruitism commented on GitHub (Apr 14, 2024): For reproducible steps, I performed the following: 1) I enabled the AniSearch plugin from the Jellyfin repository (v4.0.0) 2) I updated the default logging.default.json file and added the line "Jellyfin.Plugin": "Debug" in the "Override" section after the "System" line. 3) Restarted Jellyfin. 4) Enabled the plugin for a library. 5) For a show in the library, I attempted to "Refresh Metadata" by both "Searching for missing metadata" and "Replace all metadata". 6) Reviewed the logs and no logs appear from the plugin. As this show has not been previously associated to the AniSearch provider, I would expect to see the log message "Start AniSearch... Searching ({Name})" when searching for metadata for the show.
Author
Owner

@crobibero commented on GitHub (Apr 14, 2024):

I just tested with Jellyfin v10.9.0 (master) and plugin v5.2403.6.0 and saw those log lines.

[17:17:41] [INF] [12] Jellyfin.Plugin.AniSearch.Providers.AniSearch.AniSearchSeriesProvider: Start AniSearch... Searching(Good Omens)
[17:17:41] [INF] [56] Jellyfin.Plugin.AniSearch.Providers.AniSearch.AniSearchSeriesProvider: Start AniSearch... Searching(Invincible)
[17:17:41] [INF] [61] Jellyfin.Plugin.AniSearch.Providers.AniSearch.AniSearchSeriesProvider: Start AniSearch... Searching(Ted Lasso)
@crobibero commented on GitHub (Apr 14, 2024): I just tested with Jellyfin v10.9.0 (master) and plugin v5.2403.6.0 and saw those log lines. ``` [17:17:41] [INF] [12] Jellyfin.Plugin.AniSearch.Providers.AniSearch.AniSearchSeriesProvider: Start AniSearch... Searching(Good Omens) [17:17:41] [INF] [56] Jellyfin.Plugin.AniSearch.Providers.AniSearch.AniSearchSeriesProvider: Start AniSearch... Searching(Invincible) [17:17:41] [INF] [61] Jellyfin.Plugin.AniSearch.Providers.AniSearch.AniSearchSeriesProvider: Start AniSearch... Searching(Ted Lasso) ```
Author
Owner

@polyfruitism commented on GitHub (Apr 16, 2024):

Master and 10.8.13 are pretty different right now, given that 10.8.13 appears to be roughly 5 months old and several hundred commits worth of differences. I don't see any code that would resolve this in master (at least based on how I think it should be fixed).

I could accept that it works right now, but are there any other details I can provide to help assess why this consistently fails to work for me?

@polyfruitism commented on GitHub (Apr 16, 2024): Master and 10.8.13 are pretty different right now, given that 10.8.13 appears to be roughly 5 months old and several hundred commits worth of differences. I don't see any code that would resolve this in master (at least based on how I think it should be fixed). I could accept that it works right now, but are there any other details I can provide to help assess why this consistently fails to work for me?
Author
Owner

@crobibero commented on GitHub (Apr 16, 2024):

In 10.8 it was possible for a plugin to disable logging if it registered a service before logging was configured. That has been resolved in 10.9.

@crobibero commented on GitHub (Apr 16, 2024): In 10.8 it was possible for a plugin to disable logging if it registered a service before logging was configured. That has been resolved in 10.9.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: starred/jellyfin#5606
No description provided.