Skip to content
Documentation

HAKOM Logging

The core module provides extension methods to register loggers with the HAKOM dependency injection system.

The following sets up an ITsm instance for managing time series data to log messages to the console.

Logging messages from time series management to console
var tsm = ITsm.Create(container)=>{
container.UseLogging((loggingBuilder)=>{
loggingBuilder
.AddConsole((options)=>{
//configure console logging here..
})
// add more providers as needed
;
});
});

Of course this can be done with any application built on top of HAKOM.DependencyInjection.

Adding logging to an application
var customApp = IApplicationContext.Create(container)=>{
container
.Use<ICustomApplication,CustomApplication>()
.UseLogging((loggingBuilder)=>{
loggingBuilder
.AddConsole()
.AddFile()
// add more providers as needed
;
});
}).Start<ICustomApplication>();

The custom loggers provided by HAKOM, such as the file logger or the database logger can also be used in conjunction with a common IServiceCollection as used by .NET web applications for example

Using HAKOM loggers with .NET web applications
var builder = WebApplication.CreateBuilder(args);
builder.Logging.ClearProviders();
builder.Logging.AddFile(); // provided by HAKOM.Logging.Core
builder.Logging.AddHakomDatabaseLog(); // provided by HAKOM.Logging.HakomDatabaseLog

or

Using HAKOM loggers with .NET web applications
var builder = WebApplication.CreateBuilder();
builder.Host.ConfigureLogging(loggingBuilder =>
{
loggingBuilder.ClearProviders();
loggingBuilder.AddFile(); // provided by HAKOM.Logging.Core
loggingBuilder.Logging.AddHakomDatabaseLog(); // provided by HAKOM.Logging.HakomDatabaseLog
});

or, if additional HAKOM services are required:

Using HAKOM loggers with .NET web applications
var builder = WebApplication.CreateBuilder();
builder.Services.AddHakomServices((container)=>{
container
.UseLogging(loggingBuilder =>
{
loggingBuilder.ClearProviders();
loggingBuilder.AddFile(); // provided by HAKOM.Logging.Core
loggingBuilder.Logging.AddHakomDatabaseLog(); // provided by HAKOM.Logging.HakomDatabaseLog
})
//register other HAKOM services here
;
});

Of course this means that HAKOM applications are also compatible with any other logging provider that supports the Microsoft.Extensions.Logging system. See Microsofts list of third-party logging providers for more information.

The following example sets up an ITsm instance to use Serilog for logging.

This requires a NuGet reference to Serilog.Extensions.Logging

Using serilog with the TSM
Log.Logger = new LoggerConfiguration()
.Enrich.FromLogContext()
.WriteTo.Console()
.CreateLogger();
var tsm = ITsm.Create(container)=>{
container.UseLogging((loggingBuilder)=>{
loggingBuilder
.AddSerilog(dispose:true);
.AddFile()
// add more providers as needed
;
});
});

This module provides an implementation to write structured logs into one of the following databases

  • Oracle
  • PostgreSql
  • Microsoft SQL Server

HAKOM also provides a tool for inspecting these logs as a standard plug-in for the TSM App: Log Monitor

Enabling database logs is as simple as adding the following when configuring the Microsoft.Extensions.Logging.ILoggingBuilder:

loggingBuilder.AddHakomDatabaseLog();

Note that some additional configuration is necessary for the logger to work correctly. See HakomDatabaseLog for details.

© 2026 Volue.Version v0.6.38017 November 2026