Skip to content

shagi9/peex-sample-logging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PeEx Sample Logging Application with Serilog

This is a minimal ASP.NET Core Web API application created to demonstrate:

  • Controllers and minimal endpoints
  • Background services
  • Structured logging using Serilog
  • Logging to multiple sinks (Console and File)

Prerequisites

  • .NET SDK 8.0 or later
  • Git

How to Run the Application

From the project root:

dotnet restore dotnet run

Available Endpoints

Health Check (Minimal API) GET /health

Sample Controller Endpoint GET /api/sample/hello?name=Hello

Background Service The application includes a background service (HeartbeatBackgroundService) that:

  1. Starts when the application starts
  2. Logs a heartbeat message every 10 seconds
  3. Stops gracefully when the application shuts down

How to See Logs

Serilog is configured via appsettings.json with two active sinks:

  1. Console
  2. File

Log File Location Logs/log-YYYYMMDD.txt

Start the application:

  1. dotnet run

Observe logs in:

  1. The terminal (console sink)

  2. The Logs/ folder (file sink)

  3. Call the endpoint: GET /api/sample/hello?name=Test

Watch new log entries appear in both sinks.

PeEx Sample Logging Application with Nlog

This is a minimal ASP.NET Core Web API application created to demonstrate:

  • Controllers and minimal endpoints
  • Background services
  • Structured logging using Nlog
  • Logging to multiple sinks (Console and File)

Prerequisites

  • .NET SDK 8.0 or later
  • Git

How to Run the Application

From the project root:

dotnet restore dotnet run

Available Endpoints

Health Check (Minimal API) GET /health

Sample Controller Endpoint GET /api/sample/hello?name=Hello

Background Service The application includes a background service (HeartbeatBackgroundService) that:

  1. Starts when the application starts
  2. Logs a heartbeat message every 10 seconds
  3. Stops gracefully when the application shuts down

How to See Logs

Serilog is configured via nlog.config with two active sinks:

  1. Console
  2. File

Log File Location Logs/test.log.tsx

Start the application:

  1. dotnet run

Observe logs in:

  1. The terminal (console sink)

  2. The Logs/ folder (file sink)

  3. Call the endpoint: GET /api/sample/hello?name=Test

Watch new log entries appear in both sinks.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages