DEV.co
Open-Source Observability · NLog

NLog

NLog is a free, open-source logging library for .NET applications that supports both traditional and structured logging. It provides flexible log routing, formatting, and delivery to multiple targets (files, console, databases, cloud services) with AOT compatibility as of version 6.0.

Source: GitHub — github.com/NLog/NLog
6.5k
GitHub stars
1.4k
Forks
C#
Primary language
BSD-3-Clause
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
RepositoryNLog/NLog
OwnerNLog
Primary languageC#
LicenseBSD-3-Clause — OSI-approved
Stars6.5k
Forks1.4k
Open issues62
Latest releasev6.1.3 (2026-05-04)
Last updated2026-07-08
Sourcehttps://github.com/NLog/NLog

What NLog is

NLog is a BSD-3-Clause licensed C# logging framework supporting .NET Standard 2.0+, .NET Framework, ASP.NET Core, and modern platforms (MAUI, Xamarin, UWP). It enables structured and contextual logging with configurable layouts, targets, and extensions; version 6.0+ includes AOT-compatible compilation for reduced startup overhead.

Quickstart

Get the NLog source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/NLog/NLog.gitcd NLog# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Enterprise .NET Applications

Multi-tenant or large-scale .NET applications requiring centralized log routing, filtering, and archival across multiple targets (databases, file systems, cloud endpoints).

ASP.NET Core & Microservices

Web services and microservices needing structured logging integration with dependency injection, async-safe context propagation, and performance monitoring without external dependencies.

AOT-Compiled .NET Programs

High-performance or containerized workloads (MAUI, serverless, embedded) where Ahead-of-Time compilation and minimal reflection are required; NLog 6.0+ supports AOT scenarios.

Implementation considerations

  • Configuration can be XML, JSON, or code-based; validate your config early in the development lifecycle to catch layout/target issues.
  • Async logging is supported but requires careful handling of shutdown sequences to avoid message loss in graceful shutdowns.
  • Extension packages (database, email, cloud targets) must be explicitly installed; core package includes file and console targets only.
  • Structured logging requires explicit use of structured APIs; automatic detection of object properties is not built-in—plan logging schema upfront.
  • AOT compatibility (v6.0+) may require explicit configuration for reflection-heavy custom targets or renderers.

When to avoid it — and what to weigh

  • Non-.NET Technology Stack — NLog is C#/.NET-specific; projects using Java, Python, Node.js, or Go should evaluate language-native alternatives (e.g., Logback, structlog, Winston).
  • Extreme High-Throughput Logging (>100k msgs/sec) — While NLog is performant, projects logging at extreme scale with minimal latency requirements may require specialized, lower-level solutions; evaluate benchmarks for your use case.
  • Minimal Dependency Footprint — NLog is a standalone library; if your project mandates zero external dependencies, in-process logging or a custom solution may be preferable.
  • Out-of-Box Cloud Integration — Core NLog package supports file and console only; cloud logging (AWS, Azure, GCP) requires separate extension packages; not built-in.

License & commercial use

BSD-3-Clause license (permissive, OSI-approved). Permits commercial use, modification, and distribution with attribution and no warranty. No copyleft obligations. See LICENSE.txt in repository for exact terms.

BSD-3-Clause is permissive and widely accepted for commercial products. No licensing fees or restrictions on commercial deployment. Recommended to review LICENSE.txt to confirm attribution requirements in your deliverables; no legal review by this evaluation.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitStrong
Assessment confidenceHigh
Security considerations

No security vulnerabilities disclosed in the provided data; SonarCloud integration suggests ongoing scanning. Standard logging library hygiene: sanitize sensitive data (passwords, tokens) before logging; configure appropriate file permissions for log output; be cautious with layout renderers that expose environment variables or reflection. No claims of cryptographic or authentication features; it is a logging conduit, not a security tool. Review OWASP guidance on secure logging before deployment.

Alternatives to consider

Serilog

Modern .NET structured logging library with expression-based enrichment and Sink ecosystem; stronger semantic structured-logging API out-of-box than NLog.

Microsoft.Extensions.Logging

Minimal abstraction provided by .NET itself; lightweight, built-in, but offers fewer built-in targets; often used as façade with NLog or Serilog as provider.

log4net

Older, mature .NET logging library; widely deployed in legacy systems; less active maintenance than NLog; Java log4j port with different API style.

Software development agency

Build on NLog with DEV.co software developers

Review the troubleshooting guide and getting-started tutorials on the GitHub wiki. For commercial integration or enterprise logging strategies, consult your application architect or contact our DevCo team.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

NLog FAQ

Is NLog free for commercial use?
Yes. BSD-3-Clause license permits commercial use without fees. Ensure you include attribution per LICENSE.txt.
Does NLog support structured logging?
Yes, via structured logging APIs. However, you must explicitly use structured methods (e.g., LogEventInfo with properties); automatic object property extraction is not built-in. See wiki for examples.
Can NLog be used in AOT-compiled applications?
Yes, NLog 6.0+ supports AOT compilation. Custom targets or complex layout renderers may require explicit trimming/reflection configuration; test thoroughly.
What platforms does NLog support?
NLog supports .NET Framework, .NET Core/.NET (3.1+), ASP.NET Core, MAUI, Xamarin, UWP, and Mono via NetStandard 2.0+. See topics list for full scope.

Work with a software development agency

DEV.co helps companies turn open-source tools like NLog into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source observability stack.

Ready to evaluate NLog for your .NET stack?

Review the troubleshooting guide and getting-started tutorials on the GitHub wiki. For commercial integration or enterprise logging strategies, consult your application architect or contact our DevCo team.