TCIS.Logging.Hosting 1.0.8

dotnet add package TCIS.Logging.Hosting --version 1.0.8
                    
NuGet\Install-Package TCIS.Logging.Hosting -Version 1.0.8
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TCIS.Logging.Hosting" Version="1.0.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TCIS.Logging.Hosting" Version="1.0.8" />
                    
Directory.Packages.props
<PackageReference Include="TCIS.Logging.Hosting" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TCIS.Logging.Hosting --version 1.0.8
                    
#r "nuget: TCIS.Logging.Hosting, 1.0.8"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TCIS.Logging.Hosting@1.0.8
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TCIS.Logging.Hosting&version=1.0.8
                    
Install as a Cake Addin
#tool nuget:?package=TCIS.Logging.Hosting&version=1.0.8
                    
Install as a Cake Tool

TCIS.Logging.Hosting

Composition package for application logging: real TCIS writers, ECS Serilog defaults, Autofac interception, exception classification, request context, lifecycle logging, and original failing service propagation over internal HTTP/gRPC calls.

Request rejection is enabled by default on net6/net8. Set RequestErrors.Enabled=false to disable it. Net6 uses existing netstandard2.0 backend assets and Hosting-owned request adapters; full gRPC/EF/Pluggable/OpenTelemetry composition remains net8-only.

Targets: net6.0, net8.0, net48, and net472. The ASP.NET Core entrypoints below work on both .NET 6 and .NET 8; Framework applications use RunFramework.

using TCIS.Logging.Hosting.Extensions;

var builder = WebApplication.CreateBuilder(args);
builder.AddTLoggingHost();
var app = builder.Build();
app.MapControllers();
await app.RunAsync();

To capture builder/configuration/build failures as well, use the lifecycle wrapper:

using TCIS.Logging.Hosting;

await TLoggingHost.RunAsync(args,
    builder => builder.Services.AddScoped<IOrderService, OrderService>(),
    app => app.MapControllers());

Only this package needs to be referenced. Business registrations and endpoints remain application responsibilities. No logging endpoint is exposed by default.

Destination readiness

Startup fails with CONFIG_LOG_SINK (logging-host) if the runtime logger has no declared real destination, and CONFIG_LOG_PIPELINE if the writer/queue/processor pipeline has been removed or replaced by TCIS's no-op fallback. Validation runs before business hosted services start, on both modern and Framework/Desktop hosts. Standalone AddTLogging and library-only registrations retain their existing behavior.

Facade file/console destinations and a registered Collector outbox are recognized. Explicit Serilog:WriteTo/AuditTo routes suppress the default console fallback; a callback alone is not evidence that a custom destination was attached. When relying on a custom sink, implement ILogSinkReadiness from TCIS.Logging.Abstractions.Abstractions and declare the same sink object:

builder.AddTLoggingHost(options =>
{
    options.EnableFile = options.EnableConsole = false;
    options.ConfigureSerilog = logger => logger.WriteTo.Sink(customSink);
    options.CustomSinkReadiness.Add(customSink); // customSink implements ILogSinkReadiness
});

DestinationId must be unique and nonblank. ValidateConfiguration() validates local configuration and resource usability, throws for invalid configuration, and must support repeated calls during bootstrap/DI handoff. It must not wait for remote availability. This declaration is the custom sink's contract; Hosting does not inspect Serilog internals or prove remote delivery. Missing Collector endpoint configuration or temporary network failure keeps the existing outbox/buffer behavior. For a Collector-only runtime, bootstrap retains its provisional diagnostic logger until the DI-owned outbox is available.

An A → B → C failure records service.name = a, custom.error.origin_service = c, and custom.error.propagation_path = [a,b,c] at A (these fields are outside the OPS v1.4 field catalog; they are written by default and omitted when TLogSettings:EmitExtensionFields=false). All participating applications must adopt the new package, using TCIS internal client extensions. Without peer metadata, only the immediate dependency can be identified.

Ngữ cảnh truy vết tự điền trên mọi bản ghi, kể cả log của framework (Wolverine, EF Core, Kestrel...) và consumer không có request HTTP: trace.id/span.id lấy từ Activity.Current; transaction.id lấy từ WorkContext (correlation id), không có thì dùng span gốc cục bộ của tiến trình, không có Activity thì sinh Guid; user.name là anonymous khi chưa có người dùng. Giá trị caller đã đặt không bị ghi đè.

application.site_code lấy từ WorkContext.Tenant.SiteCode (kể cả accessor tự dựng ngữ cảnh lúc đọc), không có thì dùng TLogSettings:SiteCode. Log của framework cũng đi theo thứ tự này.

message luôn là một dòng, tối đa 512 ký tự (OPS mục 5): xuống dòng/tab gộp thành dấu cách, quá dài thì cắt và thêm .... Nội dung lỗi đầy đủ vẫn nằm ở error.message và error.stack_trace.

Log của framework mức ERROR/FATAL không kèm exception (driver Oracle, EF Core...) vẫn là bản ghi lỗi: custom.log_type=error, error.code=SYS-UNK-9999 (chưa phân loại), error.type=UnclassifiedError. Bản ghi framework có custom.code.namespace/class lấy từ tên logger. log.origin.function của log lỗi framework lấy từ stack tại nơi ghi log (frame đầu tiên ngoài hạ tầng logging, đã gỡ tên <Run>d__5.MoveNext của async/lambda); chỉ chụp stack cho mức ERROR/FATAL. Mã tenant ghi ở user.tenant_id (danh mục OPS v1.4), song song với organization.id (tên cũ, dashboard OPS và log eBerth đang đọc). Thời gian xử lý ghi ở event.duration_ms (mili giây, tên trường OPS), kèm event.duration (nano giây) và custom.duration_ms. Các trường mở rộng này (cùng custom.tcis_logging_version, custom.error.owner/origin_*) mặc định bật; đặt TLogSettings:EmitExtensionFields=false để bản ghi chỉ còn đúng trường của danh mục.

See the configuration and migration guide.

Ứng dụng WinForms (.NET Framework) dùng gói riêng TCIS.Logging.Hosting.WinForms (TDesktopLoggingHost.Start), dựng trên gói này. Ứng dụng IIS có gọi AddTLogCollector thì log của framework (ILogger) cũng được ghi vào outbox gửi về Log Collector (xem README của TCIS.Logging). Đăng ký trong callback của RunFramework: builder.Services.AddTLogCollector(o => { … }) (builder.Configuration ở đó là IConfigurationBuilder, không dùng được cho overload nhận IConfiguration). App pool dừng/recycle (và host ASP.NET Core dừng) ⇒ shipper gửi nốt outbox trong LogCollector:ShutdownSendBudget trước khi container được dispose; phần chưa gửi kịp nằm trên đĩa tới lần chạy sau (README TCIS.Logging, mục "Dừng host").

Ecosystem logging contract

See severity, readiness, diagnostic ownership and migration.

Startup identity diagnostics

Hosting emits one identity summary at startup with the resolved appname/site, their sources, service identity and loaded Logging/Hosting assembly versions. Missing required identity produces a warning; it does not change startup success. Settings are under TLogSettings:Hosting:Identity:

{
  "TLogSettings": {
    "Hosting": {
      "Identity": {
        "Enabled": true,
        "RequireAppName": true,
        "RequireSiteCode": false
      }
    }
  }
}

RequireAppName warns when neither Jenkins TCIS.App.Name artifact metadata nor the compatibility environment variable TCIS_APP is present. Jenkins remains the source of product identity; no application code constant is needed. Both framework/bootstrap and writer logs use the same identity resolver, while configured formatter instances retain their own host snapshot.

Set RequireSiteCode=true only for a deployment serving one site, and provide TLogSettings:SiteCode through configuration. Multi-site applications normally keep it false and populate WorkContext.Tenant.SiteCode per request/message/job. The process site is a logging label and does not establish business context or authorization. Recurring workers can explicitly configure TCIS.Hangfire's DefaultSiteCode/DefaultTenantId separately (see that package's README).

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net472 is compatible.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on TCIS.Logging.Hosting:

Package Downloads
TCIS.Logging.Hosting.WinForms

Centralized TCIS logging for WinForms desktop applications on .NET Framework: one-call host, deferred writer, crash handlers, user actions and UI hang watchdog.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.8 38 11/3/2026
1.0.8-rc.11 62 10/30/2026
1.0.8-rc.10 58 10/30/2026
1.0.8-rc.9 54 10/30/2026
1.0.8-rc.8 55 10/29/2026
1.0.8-rc.7 62 10/27/2026
1.0.8-rc.6 60 10/27/2026
1.0.8-rc.5 63 10/23/2026
1.0.8-rc.4 59 10/23/2026
1.0.8-rc.3 61 10/23/2026
1.0.8-rc.2 54 10/22/2026
1.0.8-rc.1 55 10/22/2026
1.0.7 80 10/22/2026
1.0.6 68 10/20/2026
1.0.6-rc.1 53 10/20/2026
1.0.5 72 10/19/2026
1.0.4 66 10/13/2026
1.0.3 70 10/13/2026
1.0.2 77 10/12/2026
1.0.2-rc.1 63 10/12/2026
Loading failed