Skip to content

terryaney/aspnetcore-effective-logging

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

ASP.NET Core -- Effective Logging

This repo contains code that was used (and is kept up-to-date) from the Effective Logging in ASP.NET Core course on Pluralsight, which I authored.

It includes references to BOTH Serilog and NLog and various commits will change the logging framework from one to the other.

A couple of key recent updates have been made that might be of interest:

Approach

Since I needed to be able to switch from one logging framework to another, I took an approach with this set of applications to tap primarily into the Microsoft.Logging.Extensions functionality rather than use Serilog Enrichers.

Getting Started

There are two projects that should be set to run in this repo:

  • BookClub.UI (this is the user interface - and it makes calls to the API project)
  • BookClub.API (this is the API which has all of the database interactions)

The API projects appsettings.json file has a connection string that looks for a BookClub database on a local SQLExpress instance. If you don't have one BookClub database:

  • Optional: Download Microsoft® SQL Server® 2017 Express and SQL Server Management Studio (SSMS).
  • Create a database called BookClub in some instance of SQL Server. Express is fine, so is the Docker version.
  • Use the 4 files in the BookClub.Data/Schema folder to set up the BookClub database:
    • Create the Book table by running the SQL in Book.sql
    • Insert a couple of rows by running the SQL in InitialData.sql
    • Create stored procedures by running the SQL in both the GetAllBooks.sql and InsertBook.sql (each creates a proc)
  • Update the connection string in BookClub.API/appsettings.json to point to the database.

Run the solution! :)

Exploring

There aren't that many pages / API methods here, and the best way to really explore what's going on is to simply try some of the pages and look at the code inside them, along with setting some breakpoints both in the UI and the API code.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 73.1%
  • HTML 23.8%
  • CSS 1.8%
  • Other 1.3%