mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-19 04:34:18 +01:00
Additional debug logging for SQLite connections (#14753)
Some checks failed
CodeQL / Analyze (csharp) (push) Has been cancelled
OpenAPI / OpenAPI - HEAD (push) Has been cancelled
OpenAPI / OpenAPI - BASE (push) Has been cancelled
OpenAPI / OpenAPI - Difference (push) Has been cancelled
OpenAPI / OpenAPI - Publish Unstable Spec (push) Has been cancelled
OpenAPI / OpenAPI - Publish Stable Spec (push) Has been cancelled
Tests / run-tests (macos-latest) (push) Has been cancelled
Tests / run-tests (ubuntu-latest) (push) Has been cancelled
Tests / run-tests (windows-latest) (push) Has been cancelled
Project Automation / Project board (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
Stale PR Check / Check PRs with merge conflicts (push) Has been cancelled
Some checks failed
CodeQL / Analyze (csharp) (push) Has been cancelled
OpenAPI / OpenAPI - HEAD (push) Has been cancelled
OpenAPI / OpenAPI - BASE (push) Has been cancelled
OpenAPI / OpenAPI - Difference (push) Has been cancelled
OpenAPI / OpenAPI - Publish Unstable Spec (push) Has been cancelled
OpenAPI / OpenAPI - Publish Stable Spec (push) Has been cancelled
Tests / run-tests (macos-latest) (push) Has been cancelled
Tests / run-tests (ubuntu-latest) (push) Has been cancelled
Tests / run-tests (windows-latest) (push) Has been cancelled
Project Automation / Project board (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
Stale PR Check / Check PRs with merge conflicts (push) Has been cancelled
This commit is contained in:
@@ -47,13 +47,25 @@ public sealed class SqliteDatabaseProvider : IJellyfinDatabaseProvider
|
|||||||
sqliteConnectionBuilder.Cache = Enum.Parse<SqliteCacheMode>(databaseConfiguration.CustomProviderOptions?.Options.FirstOrDefault(e => e.Key.Equals("cache", StringComparison.OrdinalIgnoreCase))?.Value ?? nameof(SqliteCacheMode.Default));
|
sqliteConnectionBuilder.Cache = Enum.Parse<SqliteCacheMode>(databaseConfiguration.CustomProviderOptions?.Options.FirstOrDefault(e => e.Key.Equals("cache", StringComparison.OrdinalIgnoreCase))?.Value ?? nameof(SqliteCacheMode.Default));
|
||||||
sqliteConnectionBuilder.Pooling = (databaseConfiguration.CustomProviderOptions?.Options.FirstOrDefault(e => e.Key.Equals("pooling", StringComparison.OrdinalIgnoreCase))?.Value ?? bool.FalseString).Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase);
|
sqliteConnectionBuilder.Pooling = (databaseConfiguration.CustomProviderOptions?.Options.FirstOrDefault(e => e.Key.Equals("pooling", StringComparison.OrdinalIgnoreCase))?.Value ?? bool.FalseString).Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var connectionString = sqliteConnectionBuilder.ToString();
|
||||||
|
|
||||||
|
// Log SQLite connection parameters
|
||||||
|
_logger.LogInformation("SQLite connection string: {ConnectionString}", connectionString);
|
||||||
|
|
||||||
options
|
options
|
||||||
.UseSqlite(
|
.UseSqlite(
|
||||||
sqliteConnectionBuilder.ToString(),
|
connectionString,
|
||||||
sqLiteOptions => sqLiteOptions.MigrationsAssembly(GetType().Assembly))
|
sqLiteOptions => sqLiteOptions.MigrationsAssembly(GetType().Assembly))
|
||||||
// TODO: Remove when https://github.com/dotnet/efcore/pull/35873 is merged & released
|
// TODO: Remove when https://github.com/dotnet/efcore/pull/35873 is merged & released
|
||||||
.ConfigureWarnings(warnings =>
|
.ConfigureWarnings(warnings =>
|
||||||
warnings.Ignore(RelationalEventId.NonTransactionalMigrationOperationWarning));
|
warnings.Ignore(RelationalEventId.NonTransactionalMigrationOperationWarning));
|
||||||
|
|
||||||
|
var enableSensitiveDataLoggingOption = databaseConfiguration.CustomProviderOptions?.Options.FirstOrDefault(e => e.Key.Equals("EnableSensitiveDataLogging", StringComparison.OrdinalIgnoreCase))?.Value;
|
||||||
|
if (!string.IsNullOrEmpty(enableSensitiveDataLoggingOption) && bool.TryParse(enableSensitiveDataLoggingOption, out bool enableSensitiveDataLogging) && enableSensitiveDataLogging)
|
||||||
|
{
|
||||||
|
options.EnableSensitiveDataLogging(enableSensitiveDataLogging);
|
||||||
|
_logger.LogInformation("EnableSensitiveDataLogging is enabled on SQLite connection");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|||||||
Reference in New Issue
Block a user