{"id":14340,"date":"2023-11-01T06:41:22","date_gmt":"2023-11-01T06:41:22","guid":{"rendered":"https:\/\/positiwise.com\/blog\/?p=14340"},"modified":"2023-12-27T07:37:59","modified_gmt":"2023-12-27T07:37:59","slug":"how-to-implement-nlog-with-asp-net-core","status":"publish","type":"post","link":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core","title":{"rendered":"How to Implement NLog with ASP.NET Core"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong class=\"pw-highlight-text-color\"><em>Quick Overview:<\/em><\/strong><br>The blog helps you learn about the procedure to implement NLog in the ASP.NET Core project fully. You will perform every step necessary to implement the logging logic in the application, causing it to store the logs in a text file. From creating a project from scratch and testing it, you will find every necessary aspect in this guide.<\/p><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#A_Run-Through_NET_Core_vs_Nodejs\" >A Run-Through: .NET Core vs Node.js<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#NET_Core\" >.NET Core<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Pros_of_using_NET_Core\" >Pros of using .NET Core<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Nodejs\" >Node.js<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#A_Deep_Dive_into_NET_Core_vs_Nodejs\" >A Deep Dive into .NET Core vs. Node.js<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Processing_Approach_and_Performance\" >Processing Approach and Performance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Security\" >Security<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Scalability\" >Scalability<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Platform_Adaptability\" >Platform Adaptability<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Support_from_Community\" >Support from Community<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Comparison_Table_between_NET_Core_and_Nodejs\" >Comparison Table between .NET Core and Node.js<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\/#Wrapping_Up_on_NET_Core_vs_Nodejs\" >Wrapping Up on .NET Core vs Node.js<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n\n<h2 class=\"wp-block-heading\">Configuring NLog with ASP.NET Core<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When any .NET application goes live and if it encounters an unexpected error, the support team first checks the logs. It helps them to escalate the issue and identify the root cause of the problem. However, if there is no mechanism that stores the logs, then it can be a highly time-consuming and cost-consuming task.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For every business to resolve application complexity within minimal time, we recommend fully integrating NLog with <a href=\"https:\/\/positiwise.com\/blog\/embed-reporting-asp-net-core-web-applications\">ASP.NET Core applications<\/a>. NLog in ASP.NET Core helps to store logs in an easy-to-read format, helping to identify the cause seamlessly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To learn this logging framework for .NET, continue with this blog. It will aid you in understanding its working and complete implementation procedure.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is NLog in ASP.NET Core?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">NLog is a freely available technology that fully integrates with the <a href=\"https:\/\/positiwise.com\/blog\/a-descriptive-guide-to-dot-net-framework\">.NET framework<\/a>, .NET standard, and other .NET-based technologies. Its primary purpose is to help store the application logs in a file, database, and console. <a href=\"https:\/\/positiwise.com\/hire-asp-net-developers\">.NET professionals<\/a> consider it a highly popular platform due to its high performance and easy integration curve.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The NLog platform is compatible with the following .NET technologies:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>.NET 5<\/li>\n\n\n\n<li>.NET 6<\/li>\n\n\n\n<li>.NET Standard 2.0<\/li>\n\n\n\n<li>.NET Core up to 3.1 version<\/li>\n\n\n\n<li>Mono 4<\/li>\n\n\n\n<li>ASP.NET Core<\/li>\n\n\n\n<li>ASP.NET Classic<\/li>\n\n\n\n<li>Xamarin Android<\/li>\n\n\n\n<li>Xamarin iOS<\/li>\n\n\n\n<li>UWP<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In addition, the top features of the NLog logging framework for .NET applications are listed below:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You can change its configuration on the go. It means that you don&#8217;t need to restart the application to let it work.<\/li>\n\n\n\n<li>You can use the layout renders to template the log messages.<\/li>\n\n\n\n<li>It enables the addition of custom layouts and targets to fulfill business requirements.<\/li>\n\n\n\n<li>It supports structured logging and enables the management of log event properties.<\/li>\n\n\n\n<li>You can configure it using two methods per convenience. The first method uses the <strong><em>appSettings.json file<\/em><\/strong>, and the other uses <strong><em>NLog.Config XML file<\/em><\/strong>.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">The Procedure To Fully Implement NLog in ASP.NET Core<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To learn the configuration of NLog, we&#8217;ll be creating an ASP.NET Core Web API project using the Visual Studio IDE. 2019 or later, the version of the IDE is preferred, as it comes with all required mechanisms and a built-in NuGet package manager.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The procedure to create an ASP.NET Core project is pretty streamlined. You only need to open the Visual Studio IDE, select the project from the provided template, fill in the details, and lastly, hit the create button. Once the Web API project is generated, follow the below procedure, which is divided into five phases for better insight.<\/p>\n\n\n\n<div class=\"wp-block-group border rounded bg-light has-global-padding is-layout-constrained wp-container-core-group-is-layout-71df2e02 wp-block-group-is-layout-constrained\" style=\"padding-top:var(--wp--preset--spacing--40);padding-right:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--40);padding-left:var(--wp--preset--spacing--40)\">\n<p class=\"has-text-align-center fs-2 text-blue lh-sm has-contrast-color has-text-color wp-block-paragraph\"><strong>Ready to Build an ASP.NET Core Web Applications for Your Organization?<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center mt-2 wp-block-paragraph\">Empower your organization with custom ASP.NET Core Web Applications crafted by our team of 10+ years of experienced .NET developers. Let&#8217;s build excellence together!<\/p>\n\n\n\n<div class=\"wp-block-buttons mt-3 is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-20959078 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-base-color has-text-color has-background wp-element-button\" href=\"https:\/\/positiwise.com\/hire\/hire-dot-net-core-developers\" style=\"border-radius:100px;background-color:#ed7923;padding-top:10px;padding-right:30px;padding-bottom:10px;padding-left:30px\"><strong>Hire ASP.NET Core Developers<\/strong><\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Phase 1: Creating the Projects<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Besides our main API project, we&#8217;ll need two more projects to learn the NLog configuration and work. Now, you should create two projects with the names \u201c<strong><em>Contracts<\/em><\/strong>\u201d and \u201c<strong><em>LoggerService.<\/em><\/strong>&#8221; The Contract project will be used inside the main project for storing interfaces. The LoggerService will be used for implementing the logging logic.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To create the project, follow the below steps.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 1:<\/strong> Go to the solutions window and right-click on it.<\/li>\n\n\n\n<li><strong>Step 2:<\/strong> Select the &#8220;<strong><em>Add<\/em><\/strong>&#8221; button and, under it, &#8220;<strong><em>New Project.<\/em><\/strong>&#8220;<\/li>\n\n\n\n<li><strong>Step 3:<\/strong> Select the \u201c<strong><em>Class Library<\/em><\/strong>\u201d option and set its name as \u201c<strong><em>Contracts<\/em><\/strong>.\u201d<\/li>\n\n\n\n<li><strong>Step 4:<\/strong> Now repeat the step 1 to 3 for creating the &#8220;<strong><em>LoggerService<\/em><\/strong>\u201d project.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">After you create both projects, reference them to the main project. You can do it by following the procedure.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step #1:<\/strong> In the <strong><em>solutions explorer<\/em><\/strong>, go to the main project.<\/li>\n\n\n\n<li><strong>Step #2:<\/strong> Use right-click on the main project and select <strong><em>Dependencies<\/em><\/strong>.<\/li>\n\n\n\n<li><strong>Step #3:<\/strong> Select the \u201c<strong><em>Add Project Reference<\/em><\/strong>\u201d option.<\/li>\n\n\n\n<li><strong>Step #4:<\/strong> Choose the \u201c<strong><em>Solution<\/em><\/strong>\u201d option, available under Project.<\/li>\n\n\n\n<li><strong>Step #5:<\/strong> Select the <strong><em>LoggerService<\/em><\/strong> project option. As a result, a reference will be created.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Now, perform the same procedure, but this time, instead of the main project, add the &#8220;<strong><em>Contracts<\/em><\/strong>&#8221; reference to the &#8220;<strong><em>LoggerService<\/em><\/strong>&#8221; project.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Phase 2: NLog Installation and Interface Development<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In the logger service, we\u2019ll be implementing the four methods, which will log the info, debug, warning, and error messages. The interface (ILoggerManager) for all these four methods will be created inside the \u201c<strong><em>Contracts<\/em><\/strong>\u201d project.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now, execute the following steps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1:<\/strong> Create an <strong><em>ILoggerManager<\/em><\/strong> interface with the following code block.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>namespace Contracts\n{\n    public interface ILoggerManager\n    {\n        void LogInfo(string message);\n        void LogWarn(string message);\n        void LogDebug(string message);\n        void LogError(string message);\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Before this interface is configured inside the LoggerService project, you should install the NLog.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 2:<\/strong> Right-click on the <strong><em>LoggerService &gt;&gt; Dependencies &gt;&gt; Manage NuGet Packages.<\/em><\/strong> It will open the NuGet manager window. You need to input the framework name below to find and install it.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"703\" height=\"56\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/11\/nlog-extensions-logging.png\" alt=\"NLog.Extensions.Logging\" class=\"wp-image-14368\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/11\/nlog-extensions-logging.png 703w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/11\/nlog-extensions-logging-300x24.png 300w\" sizes=\"auto, (max-width: 703px) 100vw, 703px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Besides, there\u2019s an alternative way of installing this platform. By navigating to <strong><em>View &gt;&gt; Other Windows &gt;&gt; Package Manager Console<\/em><\/strong>. It will open a command line interface, on which you need to run the following command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Package NLog.Extensions.Logging<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You will have your NLog mechanism installed and ready to use within a few minutes. You can use any of the installation methods at your convenience.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Phase 3: NLog.Config File and Interface Implementation<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To implement the interface created in Phase 2, follow the below-listed steps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1:<\/strong> Inside the LoggerService project, create a new class file with the name &#8220;<strong><em>LoggerManager.<\/em><\/strong>&#8220;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2:<\/strong> Modify the <strong><em>LoggerManager class<\/em><\/strong> file with the below code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using Contracts;\nusing NLog;\n\nnamespace LoggerService\n{\n    public class LoggerManager : ILoggerManager\n    {\n        private static ILogger logger = LogManager.GetCurrentClassLogger();\n\n        public void LogDebug(string message) =&gt; logger.Debug(message);\n\n        public void LogError(string message) =&gt; logger.Error(message);\n\n        public void LogInfo(string message) =&gt; logger.Info(message);\n\n        public void LogWarn(string message) =&gt; logger.Warn(message);\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3:<\/strong> In the main project, create a text file that will store the logs created by the NLog mechanism. Name the file &#8220;<strong><em>nlog.config<\/em><\/strong>&#8221; in the main project and populate it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Further, add the following code to the file. But ensure that you change the \u201c<strong><em>filename<\/em><\/strong>\u201d and \u201c<strong><em>internal log<\/em><\/strong>\u201d parameters per your system specifications.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\" ?&gt;\n&lt;nlog xmlns=\"http:\/\/www.nlog-project.org\/schemas\/NLog.xsd\"\n      xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n      autoReload=\"true\"\n      internalLogLevel=\"Trace\"\n      internalLogFile=\"d:Projects\\Blog-AccountOwner\\Project\\internal_logs\\internallog.txt\"&gt;\n\n  &lt;targets&gt;\n    &lt;target name=\"logfile\" xsi:type=\"File\"\n            fileName=\"d:\/Projects\/Blog-AccountOwner\/Project\/logs\/${shortdate}_logfile.txt\"\n            layout=\"${longdate} ${level:uppercase=true} ${message}\"\/&gt;\n  &lt;\/targets&gt;\n\n  &lt;rules&gt;\n    &lt;logger name=\"*\" minlevel=\"Debug\" writeTo=\"logfile\" \/&gt;\n  &lt;\/rules&gt;\n&lt;\/nlog&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Phase 4: Logging Server Configuration<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To configure the Logger Service, follow the below-listed steps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1:<\/strong> Open the \u201c<strong><em>Program<\/em><\/strong>\u201d class and modify it per the following code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using NLog;\nvar builder = WebApplication.CreateBuilder(args);\nLogManager.LoadConfiguration(string.Concat(Directory.GetCurrentDirectory(), \"\/nlog.config\"));<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you are utilizing the .NET 5 version, modify the &#8220;<strong><em>Startup<\/em><\/strong>&#8221; constructor as follows.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public Startup(IConfiguration configuration)\n{   \n    LogManager.LoadConfiguration(String.Concat(Directory.GetCurrentDirectory(), \"\/nlog.config\"));\n    Configuration = configuration;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 2:<\/strong> Inside the .NET Core IOC container, add the logger service. You can do it by calling the service through the following three ways.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>builder.Services.AddScoped:<\/strong> It will call the service and create an instance for every HTTP request received by the application.<\/li>\n\n\n\n<li><strong>builder.Services.AddSingleton:<\/strong> It will call and create the instance only once. Further, the same instance will be shared every time an HTTP request is received.<\/li>\n\n\n\n<li><strong>builder.Services.AddTransiet:<\/strong> It calls and creates a service instance for every component in the request. For instance, if four components are requesting service through one HTTP request, the app will create four instances instead of one.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">So, you should add any of the methods in the \u201c<strong><em>ServiceExtensions<\/em><\/strong>\u201d class. In this tutorial, we are using the <strong><em>builder.Services.AddSingleton<\/em><\/strong> method.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public static void ConfigureLoggerService(this IServiceCollection services)\n{\n    services.AddSingleton&lt;ILoggerManager, LoggerManager&gt;();\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 3:<\/strong> Now, <strong><em>invoke this extension<\/em><\/strong> method in the Program class by using the below code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>builder.Services.ConfigureLoggerService();<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You need to put this code above the \u201c<strong><em>builder.Services.AddControllers()<\/em><\/strong>\u201d method. Mainly, here, we have taken the benefit of DI (dependency injection). It helps ASP.NET Core applications to automatically call the service from the IOC (Inversion of Control) container.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Phase 5: Testing the NLog Configuration<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After completing all the above four phases, you should test the ASP.NET Core logging using the NLog. But, before you run the application, navigate to <strong><em>Main Project &gt;&gt; Controllers folder &gt;&gt; WeatherForecastController.cs.<\/em><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open the <strong><em>WeatherForecastController.cs<\/em><\/strong> and modify it per the following code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ApiController]\n&#91;Route(\"&#91;controller]\")]\npublic class WeatherForecastController : ControllerBase\n{\n    private readonly ILoggerManager _logger;\n\n    public WeatherForecastController(ILoggerManager logger)\n    {\n        _logger = logger;\n    }\n\n    &#91;HttpGet]\n    public IEnumerable&lt;string&gt; Get()\n    {\n        _logger.LogInfo(\"Here is info message from the controller.\");\n        _logger.LogDebug(\"Here is debug message from the controller.\");\n        _logger.LogWarn(\"Here is warn message from the controller.\");\n        _logger.LogError(\"Here is error message from the controller.\");\n\n        return new string&#91;] { \"value1\", \"value2\" };\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, run the application and open the <strong><em>http:\/\/localhost:5000\/weatherforecast<\/em><\/strong>. On the output screen, an array of strings will be displayed. But you should check the \u201c<strong><em>nlog.config<\/em><\/strong>\u201d file in the main project. If this file contains the logs, then you have successfully implemented the NLog logging framework for .NET applications.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Similarly, you can use NLog for other projects to store the logs and make your development and troubleshooting tasks effortless.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Concluding Up on Implement NLog in ASP.NET Core<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">NLog is considered a reliable platform for fulfilling the requirements of logging info, debugging, errors, alerts, and other log messages. You can install it using the <a href=\"https:\/\/positiwise.com\/blog\/understanding-nuget-packages\">NuGet Package Manager for ASP.NET<\/a> Core applications. In the practical example above, we implemented it for a <a href=\"https:\/\/positiwise.com\/hire\/net-web-api-development\">.NET Core Web API<\/a> project, resulting in the storage of all logs in a file with a path defined in the business logic.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For enterprise software, logging is crucial, as it assists in efficiently troubleshooting and resolving errors. Also, it supports developers in checking the functionality of each application component. So, you should always consider implementing NLog in ASP.NET Core applications, as it provides an efficient logging framework to log errors and application workflow in ASP.NET Core web apps. Implementing NLog in ASP.NET Core ensures robust logging for enterprise-level web applications.<\/p>\n  <div class=\"related-post slider\">\r\n        <div class=\"headline\">Related Posts<\/div>\r\n    <div class=\"post-list owl-carousel\">\r\n\r\n            <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\".Net Core vs. Java \u2013 Which One You Should Use for Your Projects?\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-java-technology\">\r\n\r\n      <img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"800\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1.jpg\" class=\"attachment-full size-full wp-post-image\" alt=\".Net Core vs. Java \u2013 Which One You Should Use for Your Projects?\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1.jpg 1200w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1-300x200.jpg 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1-1024x683.jpg 1024w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1-768x512.jpg 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\".Net Core vs. Java \u2013 Which One You Should Use for Your Projects?\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-java-technology\">\r\n        .Net Core vs. Java \u2013 Which One You Should Use for Your Projects?  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Precise Road Map for ASP.NET Developers\" href=\"https:\/\/positiwise.com\/blog\/roadmap-for-asp-dot-net-developers\">\r\n\r\n      <img loading=\"lazy\" decoding=\"async\" width=\"1021\" height=\"621\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1.jpg\" class=\"attachment-full size-full wp-post-image\" alt=\"Hire ASP.NET Developers - A Precise Road Map to Employ ASP.NET Developers\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1.jpg 1021w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1-300x182.jpg 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1-768x467.jpg 768w\" sizes=\"auto, (max-width: 1021px) 100vw, 1021px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Precise Road Map for ASP.NET Developers\" href=\"https:\/\/positiwise.com\/blog\/roadmap-for-asp-dot-net-developers\">\r\n        Precise Road Map for ASP.NET Developers  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\".NET Core vs Node.js: The Difference Explained by Web Expert\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\">\r\n\r\n      <img loading=\"lazy\" decoding=\"async\" width=\"1021\" height=\"621\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/NET-Core-VS-Node-js-jpg.webp\" class=\"attachment-full size-full wp-post-image\" alt=\"NET-Core-VS-Node-js\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/NET-Core-VS-Node-js-jpg.webp 1021w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/NET-Core-VS-Node-js-300x182.webp 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/NET-Core-VS-Node-js-768x467.webp 768w\" sizes=\"auto, (max-width: 1021px) 100vw, 1021px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\".NET Core vs Node.js: The Difference Explained by Web Expert\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-node-js\">\r\n        .NET Core vs Node.js: The Difference Explained by Web Expert  <\/a>\r\n\r\n        <\/div>\r\n      \r\n  <\/div>\r\n\r\n  <script>\r\n      <\/script>\r\n  <style>\r\n    .related-post {}\r\n\r\n    .related-post .post-list {\r\n      text-align: left;\r\n          }\r\n\r\n    .related-post .post-list .item {\r\n      margin: 5px;\r\n      padding: 0px;\r\n          }\r\n\r\n    .related-post .headline {\r\n      font-size: 2rem !important;\r\n      color: #212529 !important;\r\n          }\r\n\r\n    .related-post .headline {\r\nmargin-top: 0;\r\npadding-left: 1%;\r\n}.related-post .post-list .item .post_thumb {\r\n      max-height: 220px;\r\n      margin: 0px 0px 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n          }\r\n\r\n    .related-post .post-list .item .post_title {\r\n      font-size: 1rem;\r\n      color: #212529;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .post-list .item .post_excerpt {\r\n      font-size: 13px;\r\n      color: #3f3f3f;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .owl-dots .owl-dot {\r\n          }\r\n\r\n      <\/style>\r\n      <script>\r\n      jQuery(document).ready(function($) {\r\n        $(\".related-post .post-list\").owlCarousel({\r\n          items: 3,\r\n          responsiveClass: true,\r\n          responsive: {\r\n            0: {\r\n              items: 1,\r\n            },\r\n            768: {\r\n              items: 2,\r\n            },\r\n            1200: {\r\n              items: 3,\r\n            }\r\n          },\r\n                      rewind: true,\r\n                                loop: true,\r\n                                center: true,\r\n                                autoplay: true,\r\n            autoplayHoverPause: true,\r\n                                nav: true,\r\n            navSpeed: 1000,\r\n            navText: ['<i class=\"fas fa-chevron-left\"><\/i>', '<i class=\"fas fa-chevron-right\"><\/i>'],\r\n                                dots: true,\r\n            dotsSpeed: 1200,\r\n                                                    rtl: false,\r\n          \r\n        });\r\n      });\r\n    <\/script>\r\n  <\/div>\r\n","protected":false},"excerpt":{"rendered":"<p>Quick Overview:The blog helps you learn about the procedure to implement NLog in the ASP.NET Core project fully. [&hellip;]<\/p>\n  <div class=\"related-post slider\">\r\n        <div class=\"headline\">Related Posts<\/div>\r\n    <div class=\"post-list owl-carousel\">\r\n\r\n            <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\".Net Core vs. Java \u2013 Which One You Should Use for Your Projects?\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-java-technology\">\r\n\r\n      <img width=\"1200\" height=\"800\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1.jpg\" class=\"attachment-full size-full wp-post-image\" alt=\".Net Core vs. Java \u2013 Which One You Should Use for Your Projects?\" decoding=\"async\" loading=\"lazy\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1.jpg 1200w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1-300x200.jpg 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1-1024x683.jpg 1024w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2021\/12\/web-security-partner-1-768x512.jpg 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\".Net Core vs. Java \u2013 Which One You Should Use for Your Projects?\" href=\"https:\/\/positiwise.com\/blog\/net-core-vs-java-technology\">\r\n        .Net Core vs. Java \u2013 Which One You Should Use for Your Projects?  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Precise Road Map for ASP.NET Developers\" href=\"https:\/\/positiwise.com\/blog\/roadmap-for-asp-dot-net-developers\">\r\n\r\n      <img width=\"1021\" height=\"621\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1.jpg\" class=\"attachment-full size-full wp-post-image\" alt=\"Hire ASP.NET Developers - A Precise Road Map to Employ ASP.NET Developers\" decoding=\"async\" loading=\"lazy\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1.jpg 1021w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1-300x182.jpg 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/dealership-1200x800-1-768x467.jpg 768w\" sizes=\"auto, (max-width: 1021px) 100vw, 1021px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Precise Road Map for ASP.NET Developers\" href=\"https:\/\/positiwise.com\/blog\/roadmap-for-asp-dot-net-developers\">\r\n        Precise Road Map for ASP.NET Developers  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"A Descriptive Guide to .NET Framework\" href=\"https:\/\/positiwise.com\/blog\/a-descriptive-guide-to-dot-net-framework\">\r\n\r\n      <img width=\"1021\" height=\"621\" src=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/a-descriptive-guide-to-dot-net-framework.jpg\" class=\"attachment-full size-full wp-post-image\" alt=\"A Descriptive Guide to .NET Framework\" decoding=\"async\" loading=\"lazy\" srcset=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/a-descriptive-guide-to-dot-net-framework.jpg 1021w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/a-descriptive-guide-to-dot-net-framework-300x182.jpg 300w, https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2022\/01\/a-descriptive-guide-to-dot-net-framework-768x467.jpg 768w\" sizes=\"auto, (max-width: 1021px) 100vw, 1021px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"A Descriptive Guide to .NET Framework\" href=\"https:\/\/positiwise.com\/blog\/a-descriptive-guide-to-dot-net-framework\">\r\n        A Descriptive Guide to .NET Framework  <\/a>\r\n\r\n        <\/div>\r\n      \r\n  <\/div>\r\n\r\n  <script>\r\n      <\/script>\r\n  <style>\r\n    .related-post {}\r\n\r\n    .related-post .post-list {\r\n      text-align: left;\r\n          }\r\n\r\n    .related-post .post-list .item {\r\n      margin: 5px;\r\n      padding: 0px;\r\n          }\r\n\r\n    .related-post .headline {\r\n      font-size: 2rem !important;\r\n      color: #212529 !important;\r\n          }\r\n\r\n    .related-post .headline {\r\nmargin-top: 0;\r\npadding-left: 1%;\r\n}.related-post .post-list .item .post_thumb {\r\n      max-height: 220px;\r\n      margin: 0px 0px 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n          }\r\n\r\n    .related-post .post-list .item .post_title {\r\n      font-size: 1rem;\r\n      color: #212529;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .post-list .item .post_excerpt {\r\n      font-size: 13px;\r\n      color: #3f3f3f;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .owl-dots .owl-dot {\r\n          }\r\n\r\n      <\/style>\r\n      <script>\r\n      jQuery(document).ready(function($) {\r\n        $(\".related-post .post-list\").owlCarousel({\r\n          items: 3,\r\n          responsiveClass: true,\r\n          responsive: {\r\n            0: {\r\n              items: 1,\r\n            },\r\n            768: {\r\n              items: 2,\r\n            },\r\n            1200: {\r\n              items: 3,\r\n            }\r\n          },\r\n                      rewind: true,\r\n                                loop: true,\r\n                                center: true,\r\n                                autoplay: true,\r\n            autoplayHoverPause: true,\r\n                                nav: true,\r\n            navSpeed: 1000,\r\n            navText: ['<i class=\"fas fa-chevron-left\"><\/i>', '<i class=\"fas fa-chevron-right\"><\/i>'],\r\n                                dots: true,\r\n            dotsSpeed: 1200,\r\n                                                    rtl: false,\r\n          \r\n        });\r\n      });\r\n    <\/script>\r\n  <\/div>\r\n","protected":false},"author":3,"featured_media":14363,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","footnotes":""},"categories":[7],"tags":[],"class_list":["post-14340","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dot-net-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Implement NLog in ASP.NET Core<\/title>\n<meta name=\"description\" content=\"Learn how to implement NLog logging in ASP.NET Core web apps easily. Tutorial on configuring NLog in ASP.NET Core.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Implement NLog in ASP.NET Core\" \/>\n<meta property=\"og:description\" content=\"Learn how to implement NLog logging in ASP.NET Core web apps easily. Tutorial on configuring NLog in ASP.NET Core.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core\" \/>\n<meta property=\"og:site_name\" content=\"Positiwise\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/positiwise\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-01T06:41:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-27T07:37:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/11\/implement-nlong-in-asp-net-core.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1021\" \/>\n\t<meta property=\"og:image:height\" content=\"621\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Parag Mehta\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@positiwise\" \/>\n<meta name=\"twitter:site\" content=\"@positiwise\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Parag Mehta\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/how-to-implement-nlog-with-asp-net-core#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/how-to-implement-nlog-with-asp-net-core\"},\"author\":{\"name\":\"Parag Mehta\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#\\\/schema\\\/person\\\/b4b3d9970ea94f5914a615f70345353a\"},\"headline\":\"How to Implement NLog with ASP.NET Core\",\"datePublished\":\"2023-11-01T06:41:22+00:00\",\"dateModified\":\"2023-12-27T07:37:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/how-to-implement-nlog-with-asp-net-core\"},\"wordCount\":1490,\"publisher\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/how-to-implement-nlog-with-asp-net-core#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/11\\\/implement-nlong-in-asp-net-core.jpg\",\"articleSection\":[\".NET Development\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2022\",\"copyrightHolder\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/how-to-implement-nlog-with-asp-net-core\",\"url\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/how-to-implement-nlog-with-asp-net-core\",\"name\":\"How to Implement NLog in ASP.NET Core\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/how-to-implement-nlog-with-asp-net-core#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/how-to-implement-nlog-with-asp-net-core#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/11\\\/implement-nlong-in-asp-net-core.jpg\",\"datePublished\":\"2023-11-01T06:41:22+00:00\",\"dateModified\":\"2023-12-27T07:37:59+00:00\",\"description\":\"Learn how to implement NLog logging in ASP.NET Core web apps easily. Tutorial on configuring NLog in ASP.NET Core.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/how-to-implement-nlog-with-asp-net-core#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/positiwise.com\\\/blog\\\/how-to-implement-nlog-with-asp-net-core\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/how-to-implement-nlog-with-asp-net-core#primaryimage\",\"url\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/11\\\/implement-nlong-in-asp-net-core.jpg\",\"contentUrl\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/11\\\/implement-nlong-in-asp-net-core.jpg\",\"width\":1021,\"height\":621,\"caption\":\"Implement NLog in ASP.NET Core\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/how-to-implement-nlog-with-asp-net-core#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/positiwise.com\\\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Implement NLog with ASP.NET Core\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/\",\"name\":\"Positiwise\",\"description\":\"Providing Full-cycle Software Development Services\",\"publisher\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#organization\"},\"alternateName\":\"Positiwise Software Pvt Ltd\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#organization\",\"name\":\"Positiwise\",\"alternateName\":\"Positiwise Software Pvt Ltd\",\"url\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/logo.png\",\"width\":202,\"height\":29,\"caption\":\"Positiwise\"},\"image\":{\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/positiwise\\\/\",\"https:\\\/\\\/x.com\\\/positiwise\",\"https:\\\/\\\/github.com\\\/positiwise\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/positiwise\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/#\\\/schema\\\/person\\\/b4b3d9970ea94f5914a615f70345353a\",\"name\":\"Parag Mehta\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/072ea4a638415a77610a840228d51b8225ad88856ed34d69cbe1fcd638390535?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/072ea4a638415a77610a840228d51b8225ad88856ed34d69cbe1fcd638390535?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/072ea4a638415a77610a840228d51b8225ad88856ed34d69cbe1fcd638390535?s=96&r=g\",\"caption\":\"Parag Mehta\"},\"description\":\"Parag Mehta, the CEO and Founder of Positiwise Software Pvt Ltd has extensive knowledge of the development niche. He is implementing custom strategies to craft highly-appealing and robust applications for its clients and supporting employees to grow and ace the tasks. He is a consistent learner and always provides the best-in-quality solutions, accelerating productivity.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/paragcmehta\"],\"url\":\"https:\\\/\\\/positiwise.com\\\/blog\\\/author\\\/parag-mehta\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Implement NLog in ASP.NET Core","description":"Learn how to implement NLog logging in ASP.NET Core web apps easily. Tutorial on configuring NLog in ASP.NET Core.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core","og_locale":"en_US","og_type":"article","og_title":"How to Implement NLog in ASP.NET Core","og_description":"Learn how to implement NLog logging in ASP.NET Core web apps easily. Tutorial on configuring NLog in ASP.NET Core.","og_url":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core","og_site_name":"Positiwise","article_publisher":"https:\/\/www.facebook.com\/positiwise\/","article_published_time":"2023-11-01T06:41:22+00:00","article_modified_time":"2023-12-27T07:37:59+00:00","og_image":[{"width":1021,"height":621,"url":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/11\/implement-nlong-in-asp-net-core.jpg","type":"image\/jpeg"}],"author":"Parag Mehta","twitter_card":"summary_large_image","twitter_creator":"@positiwise","twitter_site":"@positiwise","twitter_misc":{"Written by":"Parag Mehta","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core#article","isPartOf":{"@id":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core"},"author":{"name":"Parag Mehta","@id":"https:\/\/positiwise.com\/blog\/#\/schema\/person\/b4b3d9970ea94f5914a615f70345353a"},"headline":"How to Implement NLog with ASP.NET Core","datePublished":"2023-11-01T06:41:22+00:00","dateModified":"2023-12-27T07:37:59+00:00","mainEntityOfPage":{"@id":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core"},"wordCount":1490,"publisher":{"@id":"https:\/\/positiwise.com\/blog\/#organization"},"image":{"@id":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core#primaryimage"},"thumbnailUrl":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/11\/implement-nlong-in-asp-net-core.jpg","articleSection":[".NET Development"],"inLanguage":"en-US","copyrightYear":"2022","copyrightHolder":{"@id":"https:\/\/positiwise.com\/blog\/#organization"}},{"@type":"WebPage","@id":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core","url":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core","name":"How to Implement NLog in ASP.NET Core","isPartOf":{"@id":"https:\/\/positiwise.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core#primaryimage"},"image":{"@id":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core#primaryimage"},"thumbnailUrl":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/11\/implement-nlong-in-asp-net-core.jpg","datePublished":"2023-11-01T06:41:22+00:00","dateModified":"2023-12-27T07:37:59+00:00","description":"Learn how to implement NLog logging in ASP.NET Core web apps easily. Tutorial on configuring NLog in ASP.NET Core.","breadcrumb":{"@id":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core#primaryimage","url":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/11\/implement-nlong-in-asp-net-core.jpg","contentUrl":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/11\/implement-nlong-in-asp-net-core.jpg","width":1021,"height":621,"caption":"Implement NLog in ASP.NET Core"},{"@type":"BreadcrumbList","@id":"https:\/\/positiwise.com\/blog\/how-to-implement-nlog-with-asp-net-core#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/positiwise.com\/blog"},{"@type":"ListItem","position":2,"name":"How to Implement NLog with ASP.NET Core"}]},{"@type":"WebSite","@id":"https:\/\/positiwise.com\/blog\/#website","url":"https:\/\/positiwise.com\/blog\/","name":"Positiwise","description":"Providing Full-cycle Software Development Services","publisher":{"@id":"https:\/\/positiwise.com\/blog\/#organization"},"alternateName":"Positiwise Software Pvt Ltd","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/positiwise.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/positiwise.com\/blog\/#organization","name":"Positiwise","alternateName":"Positiwise Software Pvt Ltd","url":"https:\/\/positiwise.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/positiwise.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/07\/logo.png","contentUrl":"https:\/\/positiwise.com\/blog\/wp-content\/uploads\/2023\/07\/logo.png","width":202,"height":29,"caption":"Positiwise"},"image":{"@id":"https:\/\/positiwise.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/positiwise\/","https:\/\/x.com\/positiwise","https:\/\/github.com\/positiwise","https:\/\/www.linkedin.com\/company\/positiwise"]},{"@type":"Person","@id":"https:\/\/positiwise.com\/blog\/#\/schema\/person\/b4b3d9970ea94f5914a615f70345353a","name":"Parag Mehta","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/072ea4a638415a77610a840228d51b8225ad88856ed34d69cbe1fcd638390535?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/072ea4a638415a77610a840228d51b8225ad88856ed34d69cbe1fcd638390535?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/072ea4a638415a77610a840228d51b8225ad88856ed34d69cbe1fcd638390535?s=96&r=g","caption":"Parag Mehta"},"description":"Parag Mehta, the CEO and Founder of Positiwise Software Pvt Ltd has extensive knowledge of the development niche. He is implementing custom strategies to craft highly-appealing and robust applications for its clients and supporting employees to grow and ace the tasks. He is a consistent learner and always provides the best-in-quality solutions, accelerating productivity.","sameAs":["https:\/\/www.linkedin.com\/in\/paragcmehta"],"url":"https:\/\/positiwise.com\/blog\/author\/parag-mehta"}]}},"_links":{"self":[{"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/posts\/14340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/comments?post=14340"}],"version-history":[{"count":19,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/posts\/14340\/revisions"}],"predecessor-version":[{"id":14643,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/posts\/14340\/revisions\/14643"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/media\/14363"}],"wp:attachment":[{"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/media?parent=14340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/categories?post=14340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/positiwise.com\/blog\/wp-json\/wp\/v2\/tags?post=14340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}