Configures Serilog structured logging in Orchard Core CMS. Covers package references, appsettings.json sinks (Console, File), Program.cs initialization, tenant-aware enrichment, output templates, and replacing default NLog.
Ships in orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an Orchard Core expert. Generate configuration and code for Serilog integration including structured logging, Console and File sinks, tenant-aware enrichment, and output template customization.
PackageReference to OrchardCore.Logging.Serilog in the web (startup) project. It is a host-level library, not a module: there is no feature to enable and no recipe step.builder.Host.UseNLogHost()); remove that call (and the OrchardCore.Logging.NLog reference) when switching to Serilog.appsettings.json under the Serilog section.Program.cs using UseSerilog() and ReadFrom.Configuration().Enrich.FromLogContext() to enable log context enrichment.UseSerilogTenantNameLogging() in the Orchard Core pipeline to add TenantName to the log context.{TenantName} token in output templates to include the tenant name in log entries.{RequestId} token to correlate log entries across a single HTTP request.restrictedToMinimumLevel on individual sinks to control per-sink log verbosity.OrchardCore.OpenTelemetry (see orchardcore-opentelemetry). Its logger runs next to Serilog or NLog and tags tenant log records with orchardcore.tenant.name.sealed modifier.<Project Sdk="Microsoft.NET.Sdk.Web">
<ItemGroup>
<PackageReference Include="OrchardCore.Application.Cms.Targets" Version="3.*" />
<PackageReference Include="OrchardCore.Logging.Serilog" Version="3.*" />
</ItemGroup>
</Project>
Add the sink packages you configure (for example Serilog.Sinks.Console, Serilog.Sinks.File) if they are not already brought in transitively.
Configure Console and File sinks with minimum levels, output templates, and rolling intervals:
{
"Serilog": {
"MinimumLevel": {
"Default": "Warning",
"Override": {
"Default": "Warning",
"Microsoft": "Error",
"System": "Error"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console",
"outputTemplate": "{Timestamp:HH:mm:ss}|{TenantName}|{RequestId}|{SourceContext}|{Level:u3}|{Message:lj}{NewLine}{Exception}",
"restrictedToMinimumLevel": "Information"
}
},
{
"Name": "File",
"Args": {
"path": "App_Data/logs/orchard-log.txt",
"rollingInterval": "Day",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.ffff}|{TenantName}|{RequestId}|{SourceContext}|{Level:u3}|{Message:lj}{NewLine}{Exception}",
"restrictedToMinimumLevel": "Warning"
}
}
]
}
}
| Token | Description |
|---|---|
{Timestamp:format} | Log entry timestamp in the specified format |
{TenantName} | Name of the Orchard Core tenant processing the request |
{RequestId} | Unique ID for correlating log entries within a single HTTP request |
{SourceContext} | Fully qualified name of the class that generated the log entry |
{Level:u3} | Log level as a 3-character uppercase string (e.g., INF, WRN, ERR) |
{Message:lj} | The log message with JSON literals inline |
{NewLine} | Platform-appropriate line break |
{Exception} | Exception details, if present |
Use Override to control log verbosity per namespace. This reduces noise from framework internals:
{
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Error",
"System": "Error",
"OrchardCore": "Warning"
}
}
}
}
Configure Serilog in Program.cs by clearing default providers and reading from configuration:
using Serilog;
var builder = WebApplication.CreateBuilder(args);
builder.Host
.ConfigureLogging(logging => logging.ClearProviders())
.UseSerilog((hostingContext, configBuilder) =>
{
configBuilder
.ReadFrom.Configuration(hostingContext.Configuration)
.Enrich.FromLogContext();
});
builder.Services.AddOrchardCms();
var app = builder.Build();
app.UseStaticFiles();
app.UseOrchardCore(c => c.UseSerilogTenantNameLogging());
app.Run();
OrchardCore.Logging also provides builder.Host.UseSerilogWeb(), a shortcut for UseSerilog() with ReadFrom.Configuration() and Enrich.FromLogContext():
using OrchardCore.Logging;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.ClearProviders();
builder.Host.UseSerilogWeb();
builder.Services.AddOrchardCms();
var app = builder.Build();
app.UseStaticFiles();
app.UseOrchardCore(c => c.UseSerilogTenantNameLogging());
app.Run();
UseSerilogTenantNameLogging() must be called inside UseOrchardCore(...) so the middleware runs in the tenant pipeline where the tenant name is known.
The UseSerilogTenantNameLogging() middleware enriches every log entry with the current tenant's name. This is critical for multi-tenant deployments where logs from different tenants are written to the same output.
The {TenantName} token in the output template renders the tenant name:
14:32:05|Default|0HN4K5...|MyApp.Services.ProductService|INF|Product created: Widget
14:32:06|Tenant2|0HN4K5...|MyApp.Services.ProductService|INF|Product created: Gadget
For production, use the File sink with daily rolling to manage log file sizes:
{
"Serilog": {
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "App_Data/logs/orchard-log.txt",
"rollingInterval": "Day",
"retainedFileCountLimit": 31,
"fileSizeLimitBytes": 104857600,
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.ffff}|{TenantName}|{RequestId}|{SourceContext}|{Level:u3}|{Message:lj}{NewLine}{Exception}",
"restrictedToMinimumLevel": "Warning"
}
}
]
}
}
| File Sink Property | Description |
|---|---|
path | Base file path for log output |
rollingInterval | How often to roll to a new file (Day, Hour, Month) |
retainedFileCountLimit | Maximum number of rolled log files to retain |
fileSizeLimitBytes | Maximum size of a single log file before rolling |
restrictedToMinimumLevel | Minimum log level for this sink |
Use environment-specific appsettings.{Environment}.json files to vary logging:
appsettings.Development.json — verbose console output:
{
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Information"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "{Timestamp:HH:mm:ss}|{TenantName}|{Level:u3}|{SourceContext}|{Message:lj}{NewLine}{Exception}",
"restrictedToMinimumLevel": "Debug"
}
}
]
}
}
appsettings.Production.json — file-only, warnings and above:
{
"Serilog": {
"MinimumLevel": {
"Default": "Warning",
"Override": {
"Microsoft": "Error",
"System": "Error"
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "App_Data/logs/orchard-log.txt",
"rollingInterval": "Day",
"retainedFileCountLimit": 14,
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.ffff}|{TenantName}|{RequestId}|{SourceContext}|{Level:u3}|{Message:lj}{NewLine}{Exception}",
"restrictedToMinimumLevel": "Warning"
}
}
]
}
}
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/orchardcore:orchardcore-logging-serilogfrom orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin orchardcore140 skills in this plugin
/orchardcore-adminGuidance for the Orchard Core admin panel, including admin controllers and routes, admin menu registration with AdminNavigationProvider, ocat editor forms grouped in cards, admin pages rendering Model.Editor, the UI text casing standard, TheAdmin layout and menu colors, admin branding, the Navbar shape, the Ctrl+K quick navigation palette and QuickNavigationSource, AdminSettings such as MenuBehavior, ShowBreadcrumb, DisplayQuickNavigation, DisplayTitlesInTopbar and ActionsLayout, the AdminDashboard shape, settings pages, and admin filters and zones. Use this skill when requests mention the Orchard Core admin panel, TheAdmin, admin controllers, admin menu registration, an icon on an admin menu item, the AdminSettings recipe step, quick navigation, navigation menu behavior, the admin URL prefix, UI text casing. Strong matches include OrchardCore.Admin, AdminSettings, AdminPermissions, AdminOptions, AdminAttribute, SiteDisplayDriver, IDisplayManager./orchardcore-admin-dashboardSkill for creating admin dashboard widgets in Orchard Core. Covers the DashboardWidget stereotype, DashboardPart position and sizing, the built-in HtmlDashboardWidget, ContentsMetadata and ContentsTags widget types, custom widget content types via recipe or migration, arranging widgets in Manage Dashboard mode, widget template customization, provisioning widgets with recipes, dashboard permissions, the DashboardBreadcrumbProvider Dashboard ancestor, and the AdminDashboardContent shape used when the feature is disabled. Use this skill when requests mention Orchard Core Admin Dashboard, Create and Configure Dashboard Widgets, Enabling Admin Dashboard, Widget Configuration Properties, dashboard widget recipes, Dashboard breadcrumb, or related implementation, setup, or troubleshooting work. Strong matches include OrchardCore.AdminDashboard, DashboardPart, DashboardBreadcrumbProvider, AccessAdminDashboard, ManageAdminDashboard.Other plugins' skills for the same job