- Home
- .NET code examples
- Create your own file logger
Create your own file logger
.NET Core comes with a nice feature for logging.
Software
This is the software that will need to be installed onto your machine.
- Visual Studio 2019. Version 16.8.2 or above. It will work with the free community version.
- SQL Server 2017, or above.
- .NET 5.0 SDK, or above.
Get The Application Working
These are the steps to get the application working.
- Fill out the code example form. We will send you an email where you can download the source code.
- Inside the source code, there is a folder called
Database. Within that folder, there is a file calledFileLogger.bak. This needs to be imported as a database into your SQL Server.
From there, you will need to open up the RoundTheCode.FileLogger/Web/RoundTheCode.FileLogger.Api/appsettings.json file and change this setting:
- Check the database connection is correct in
ConnectionStrings > FileLoggerDbContext.
You are now ready to go.
Open the Project in Visual Studio
Open up RoundTheCode.FileLogger.sln in Visual Studio. Make sure that the project RoundTheCode.FileLogger.Api is set as the start up project.
https://localhost:3510.
https://localhost:3510.
RoundTheCode.FileLogger/Web/RoundTheCode.FileLogger.Api folder, there should have been a logs folder created.
More Information
You can read our Create Your Own Logging Provider to Log to Text Files in .NET Core article for more information on this subject.
Give us your anonymous feedback regarding this page, or any other areas of the website.
Watch .NET tutorials
Subscribe to our YouTube channel
Related code examples