Log exception to file in c# .net core application explained

In production environment when any bug gets reported at that time as developer wants to get the exception details of bug to resolve the issue on high priority.
In some case there might be situation where exception is not logged in table but developer wants to check the bug immediately. for that purpose we need to write the
exception details including stack trace of bug in file. To implement this easily i am going to demonstrate the implementation of custom logging in file as below.

First we need to construct the exception and logger method in custom logger class as shown below.

public class CustomLogger { public static List<string> ConstructExceptionDetails(Exception ex,string FunctionName) { return new List<string>() { $"{DateTime.Now} - {FunctionName}", $"Exception: {ex.Message}", $"StackTrace: {ex.StackTrace}", $"InnerException: {ex.InnerException?.…

Source Code Beautifier And Format Source Code For Blogger and Websites

Source Code Beautifier And Formatter For Blogger and Websites, Format Source Code , Format Source code for blog or blogging & website, Online line source code formatter tool, blogger code format tool, Format source code for blog-spot,Insert formatted source code

How to format source code for blogger & website : 

You can format your source code for blogger & website in easy three steps..

1) Paste your source code into "Paste Here Your Source Code" Text-area.

2) Choose appropriate options from "formatting options" and click Format Source Code button..

3) See preview of formatted source code if it's fine then copy from "Copy Formatted Source Code" text-area otherwise repeat step 2

  •  This source code formatter allow you to format code like JavaScript, HTML, CSS, C#, PHP, ASP.net, VB.Net, Visual Basic, DOT.net, ASP & many other languages.
  •  It does not add unnecessary tags into formatted code, It use only two tag HTML tags <pre> & <code> only once with formatted source code.
  •  This is pure Javascript Application so don't worry about your code.
  •  In the first release we have build it mainly for blogger, wordpress and blog.
  •  This is compatible with table less layout so it work fine with div based website.
  •  In the next release we'll make it colorful code formatter tool for your blogger & website.
  •  Alternative backgrounds used in this tool.

Paste Here Your Source Code
Source Code Formatting Options
1) Convert Tab into Space :
2) Need Line Code Numbering :
3) Remove blank lines :
4) Embeded styles / Stylesheet :
5) Code Block Width :
6) Code Block Height :
7) Alternative Background :
Copy Formatted Source Code
Preview Of Formatted Code
1:  [HttpGet]  
2:  public ViewResult test(int id)  
3:  {  
4:    Client objClient = Clients[id];  
5:    return View("DisplayClient",objClient);  
6:  }   


Popular posts from this blog

Restore the lost focus of Auto post back controls in asp.net update Panel control

Add Comma automatically while entering amounts in textbox using Javascript

Devexpress Datebox date formatting in angular 6 with example