Skip to content
Documentation

LoggingBuilderExtensions Class

Provides extension methods to add database logging to an Microsoft.Extensions.Logging.ILoggingBuilder.

public static class LoggingBuilderExtensions

Inheritance System.Object 🡒 LoggingBuilderExtensions

This class is the primary entry point for enabling HAKOM database logging. The AddHakomDatabaseLog(this ILoggingBuilder) method sets up the entire persistence pipeline including storage provider bindings for Oracle, PostgreSQL, and SQL Server.

LoggingBuilderExtensions.AddHakomDatabaseLog(this ILoggingBuilder) Method

Section titled “LoggingBuilderExtensions.AddHakomDatabaseLog(this ILoggingBuilder) Method”

Adds HAKOM database logging to the loggingBuilder.

public static Microsoft.Extensions.Logging.ILoggingBuilder AddHakomDatabaseLog(this Microsoft.Extensions.Logging.ILoggingBuilder loggingBuilder);

loggingBuilder Microsoft.Extensions.Logging.ILoggingBuilder

The Microsoft.Extensions.Logging.ILoggingBuilder to add database logging to.

Microsoft.Extensions.Logging.ILoggingBuilder
The loggingBuilder for chaining.

System.ArgumentNullException
Thrown if loggingBuilder is null.

RepositoryConfigurationRequiredForDatabaseLogException
Thrown if no Microsoft.Extensions.Configuration.IConfiguration has been registered with the underlying IContainer (i.e. configuration has not been set up via UseConfiguration(this IContainer, Action<IConfigurationBuilder>, bool)).

This method performs the following setup:

  1. Resolves the Microsoft.Extensions.Configuration.IConfiguration from the container to read repository settings.
  2. Creates an internal application context with configured repositories and storage provider bindings for Oracle, PostgreSQL, and SQL Server.
  3. Registers the ISessionFactory and IHakomDatabaseLogStoreFactory as singletons.
  4. Registers the database logger provider options from the HakomDatabase configuration section.
  5. Adds the database logger provider to the logging pipeline.

Prerequisites: An Microsoft.Extensions.Configuration.IConfiguration with at least one repository configured under Persistence:Repositories must be registered with the container before calling this method. The Logging:HakomDatabase:Repository setting must reference a configured repository name.

container
.UseConfiguration()
.UseConfiguredLogging((loggingBuilder) =>
{
loggingBuilder.AddHakomDatabaseLog();
});
© 2026 Volue.Version v0.6.38017 November 2026