{"id":7174,"date":"2020-06-03T17:34:34","date_gmt":"2020-06-03T12:04:34","guid":{"rendered":"https:\/\/lgconsultancy.wpcomstaging.com\/?p=2365"},"modified":"2022-08-02T12:51:08","modified_gmt":"2022-08-02T12:51:08","slug":"logging-the-backup-plan-serilog","status":"publish","type":"post","link":"https:\/\/lng-consultancy.com\/staging\/5474\/logging-the-backup-plan-serilog\/","title":{"rendered":"Logging The backup plan-  Serilog"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Serilog is a sure shot <strong>analytical Logging library<\/strong> for .Net Applications. While it works wonderfully with Simple Apps, it <strong>results extraordinarily<\/strong>  when the structures become composite and application becomes asynchronous.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this article, we will be learning about <strong>Serilog<\/strong>, Its <strong>usage<\/strong>, <strong>Features<\/strong>, Its <strong>implementation<\/strong> in console App, .Net core 3.1 apps with logging targets Console, File, Rolling file, MongoDb, and Application Insight. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Git Repo<\/strong> link can be found at the end.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>By the end<\/strong>, you will be sure enough to use <strong>Serilog <\/strong>in any of the <strong>new\/Existing applications or small\/enterprise-level applications<\/strong>.<\/p>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\"><strong>So, Let\u2019s START the learning process:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What is Logging<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Logging is one of the most basic things that every application needs. It is fundamental to troubleshoot any application problems.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What is Serilog<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Serilog is a Logging framework which makes it easy to send your logs to different places via simple configurations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Installation<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Go to View \u2013 Other windows \u2013 Package Manager Console.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/nvaLANGRWr8MiJkGhsXNoYDydqFASn_NJqXK7lDpXgD5IB802Qfkp_YiCVQrYOe_we0JmBra0gqTTLxIGMjW33n2k4FuGb8SCSr31NwkR7X6emPeiFQSXeZJ2MhPoqoXRuRtwto\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Then run the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Package Serilog <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/pv1LZc8zQxgD_VpMVoWzfv4wFsBqdec4JAb5Pgu-t1qm1XPMXdgBjFsAO1LWTT_K2rW9J8DVu4MgDjal5x4tIZw-IVb3526SS838L4UL_e2Wj7RUWekGvSn-HYSFjEogSAQono0\" width=\"624\" height=\"177\"><\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\"><\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">link to Nuget: <a href=\"https:\/\/www.nuget.org\/packages\/Serilog\/\">https:\/\/www.nuget.org\/packages\/Serilog\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What are Sinks<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Serilog itself does not save information anywhere. So we need to configure to save those logs. And, location is specified by <strong>using sinks<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Serilog provides <em>sinks<\/em> for writing log events to be stored in various formats. In easy words, sink is responsible for saving your logged information to places according to the selection made. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, if you use the console sink, then logs will be printed in the console window or if you choose the file sink, then logs will be saved in files.\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">link to <strong>86<\/strong> provided sinks: <a href=\"https:\/\/github.com\/serilog\/serilog\/wiki\/Provided-Sinks\">https:\/\/github.com\/serilog\/serilog\/wiki\/Provided-Sinks<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Sinks that we are going to use:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Package Serilog.Sinks.ApplicationInsights \nInstall-Package Serilog.Sinks.MongoDB \nInstall-Package Serilog.Sinks.RollingFile\nInstall-Package Serilog.Sinks.Console \nInstall-Package Serilog.Sinks.ColoredConsole\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Structured logging<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">From the beginning, I am saying logging is very important, very useful for troubleshooting. <strong>But will it be useful if you can\u2019t even understand(human eye\/tool) written log?<\/strong>\u00a0 <br>A popular quote demonstrating the purpose of saving the data.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><em><strong>The goal is to turn data into information and information into insight.\u00a0<\/strong><\/em><\/p><cite><em>Carly Fiorina<\/em><\/cite><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Here are some examples of structure logging:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you write below code to log information given;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>log.Debug(\"this is testing Serilog message\");<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It results in;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DEBUG 2020-05-18 16:17:58 \u2013 this is testing Serilog message<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output Formatting<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As you noticed in the above result, time and level are also added. We also have the provision to change the format of the output, it is called output formatting.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Following fields can be used in a custom output template:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Exception<\/li><li>Level<\/li><li>Message<\/li><li>NewLine<\/li><li>Properties<\/li><li>Timestamp<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">An example is being given for your reference:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{Timestamp:yyyy-MM-dd} [{Level}] {Properties}{Message}{NewLine}{Exception}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Enrichment<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Most logging frameworks provide some way to log additional context values across all logging statements. This is perfect for setting something like a UserId at the beginning for a request and having it included in every log statement. In Serilog, it is called <strong>Enrichments<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Log events can be <em>enriched<\/em> with properties in various ways. A number of pre-built enrichers can be found here <a href=\"https:\/\/www.nuget.org\/packages?q=serilog.Enrichers\">https:\/\/www.nuget.org\/packages?q=serilog.Enrichers<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Or Log Context can be used to push property. To set up a logging context use the below code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>new LoggerConfiguration()\n    .Enrich.FromLogContext()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Properties can be added as below and will be added automatically.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> LogContext.PushProperty(\"userId\",user.UserId)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Masking<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In real-world application domains like banking, there are restrictions on what information should be logged. In those scenarios, we need some kind of provision to prevent those information to be logged. Let\u2019s say, we have an account class having a password as private information.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class Account\n{\n  public int Id { get; set; }\n  public string Name { get; set; }\n  public string Password { get; set; }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Password should not be logged if the whole object of the Account class is logged.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here are are some of the useful Serilog Destructure nuget helpers:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Masking.Serilog<\/li><li>Destructurama.Attributed<\/li><li>Destructurama.ByIgnoring<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For instance, we can use Destructurama.Attributed;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> To setup it with Serilog, Install Nuget package as follows;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Package Destructurama.Attributed<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then use the below code to setup\u00a0masking;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> new LoggerConfiguration()\n .Destructure.UsingAttributes()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And then in the class, we can specify a <em>LogMasked <\/em>attribute to mask it as below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class Account\n{\n  public int Id { get; set; }\n  public string Name { get; set; }\n  [LogMasked]\n  public string Password { get; set; }\n}\n\ufeff<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Asp.net Core <strong>ConfigureServices<\/strong> method can be updated as follows (one way out of many);<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public void ConfigureServices(IServiceCollection services)\n{\n   Log.Logger = new LoggerConfiguration()\n              .Enrich.FromLogContext()\n              .WriteTo.MongoDB(\"mongodb:\/\/localhost:27017\/Serilog_Examples\")\n              .WriteTo.ApplicationInsights(\"9fxx6977-5797-4fba-9022-2275axxx5c66\", TelemetryConverter.Traces, LogEventLevel.Verbose)\n              .WriteTo.RollingFile(\"log-{Date}.txt\", outputTemplate: \"{Timestamp:yyyy-MM-dd} [{Level}] {Properties}{Message}{NewLine}{Exception}\", shared: true)\n              .CreateLogger();\n\n  services.AddControllersWithViews();\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> you have to install required packages for above code to work.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check the Link to MongoDB community server <a href=\"https:\/\/www.mongodb.com\/download-center\/community\">Here<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For Application Insight Key steps are being given <a href=\"https:\/\/lgconsultancy.wpcomstaging.com\/software-development\/create-application-insight-in-azure\/(opens in a new tab)\">here<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Summary\u00a0<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We learnt the  following major points about Serilog:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>What is Serilog<\/li><li>Installation<\/li><li>Serilog Sinks<\/li><li>Structure logging<\/li><li>Output formatting<\/li><li>Serilog Enrichers<\/li><li>Serilog Destructure(Masking)\u00a0<br><br>Now, you can use the above information beneficially and Increase your knowledge.<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Git repo link can be found <a href=\"https:\/\/github.com\/RakeshYadvanshi\/Serilog_Examples\">here\u00a0<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2013Rakesh Kumar<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Serilog is a sure shot analytical Logging library for .Net Applications. While it works wonderfully with Simple Apps, it results extraordinarily when the structures become composite and application becomes asynchronous. In this article, we will be learning about Serilog, Its usage, Features, Its implementation in console App, .Net core 3.1 apps with logging targets Console, [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":7311,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"nf_dc_page":"","om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[32],"tags":[36,37,38,39,40],"class_list":["post-7174","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development","tag-application-insight-sink","tag-azure-application-insight","tag-logging","tag-mongodb-sink","tag-serilog"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Logging The backup plan- Serilog - L&amp;G Consultancy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Logging The backup plan- Serilog - L&amp;G Consultancy\" \/>\n<meta property=\"og:description\" content=\"Serilog is a sure shot analytical Logging library for .Net Applications. While it works wonderfully with Simple Apps, it results extraordinarily when the structures become composite and application becomes asynchronous. In this article, we will be learning about Serilog, Its usage, Features, Its implementation in console App, .Net core 3.1 apps with logging targets Console, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/\" \/>\n<meta property=\"og:site_name\" content=\"L&amp;G Consultancy\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-03T12:04:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-02T12:51:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/landg-consultancy.com\/wp-content\/uploads\/2020\/06\/Untitled-design-30.jpg?fit=1200%2C628&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Charanpreet Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Charanpreet Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/logging-the-backup-plan-serilog\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/logging-the-backup-plan-serilog\\\/\"},\"author\":{\"name\":\"Charanpreet Singh\",\"@id\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/#\\\/schema\\\/person\\\/5dc3b323c5f0797bdc776ae36267fda4\"},\"headline\":\"Logging The backup plan- Serilog\",\"datePublished\":\"2020-06-03T12:04:34+00:00\",\"dateModified\":\"2022-08-02T12:51:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/logging-the-backup-plan-serilog\\\/\"},\"wordCount\":728,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/logging-the-backup-plan-serilog\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/lng-consultancy.com\\\/staging\\\/5474\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Untitled-design-30.jpg?fit=1200%2C628&ssl=1\",\"keywords\":[\"Application Insight Sink\",\"Azure Application Insight\",\"Logging\",\"Mongodb Sink\",\"Serilog\"],\"articleSection\":[\"Software Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/landg-consultancy.com\\\/logging-the-backup-plan-serilog\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/logging-the-backup-plan-serilog\\\/\",\"url\":\"https:\\\/\\\/landg-consultancy.com\\\/logging-the-backup-plan-serilog\\\/\",\"name\":\"Logging The backup plan- Serilog - L&amp;G Consultancy\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/logging-the-backup-plan-serilog\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/logging-the-backup-plan-serilog\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/lng-consultancy.com\\\/staging\\\/5474\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Untitled-design-30.jpg?fit=1200%2C628&ssl=1\",\"datePublished\":\"2020-06-03T12:04:34+00:00\",\"dateModified\":\"2022-08-02T12:51:08+00:00\",\"author\":{\"@id\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/#\\\/schema\\\/person\\\/5dc3b323c5f0797bdc776ae36267fda4\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/logging-the-backup-plan-serilog\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/landg-consultancy.com\\\/logging-the-backup-plan-serilog\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/logging-the-backup-plan-serilog\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/lng-consultancy.com\\\/staging\\\/5474\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Untitled-design-30.jpg?fit=1200%2C628&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/lng-consultancy.com\\\/staging\\\/5474\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Untitled-design-30.jpg?fit=1200%2C628&ssl=1\",\"width\":1200,\"height\":628},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/landg-consultancy.com\\\/logging-the-backup-plan-serilog\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/lng-consultancy.com\\\/staging\\\/5474\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Logging The backup plan- Serilog\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/#website\",\"url\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/\",\"name\":\"L&amp;G Consultancy\",\"description\":\"Your Technology Partner\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/sh024.global.temp.domains\\\/~landgcon\\\/#\\\/schema\\\/person\\\/5dc3b323c5f0797bdc776ae36267fda4\",\"name\":\"Charanpreet Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/60f39e431ff12acc271104a91c55cf1c75285d9be16fe4a8db4ac997fa1b4e7e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/60f39e431ff12acc271104a91c55cf1c75285d9be16fe4a8db4ac997fa1b4e7e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/60f39e431ff12acc271104a91c55cf1c75285d9be16fe4a8db4ac997fa1b4e7e?s=96&d=mm&r=g\",\"caption\":\"Charanpreet Singh\"},\"url\":\"https:\\\/\\\/lng-consultancy.com\\\/staging\\\/5474\\\/author\\\/charanpreetsingh83\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Logging The backup plan- Serilog - L&amp;G Consultancy","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:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/","og_locale":"en_US","og_type":"article","og_title":"Logging The backup plan- Serilog - L&amp;G Consultancy","og_description":"Serilog is a sure shot analytical Logging library for .Net Applications. While it works wonderfully with Simple Apps, it results extraordinarily when the structures become composite and application becomes asynchronous. In this article, we will be learning about Serilog, Its usage, Features, Its implementation in console App, .Net core 3.1 apps with logging targets Console, [&hellip;]","og_url":"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/","og_site_name":"L&amp;G Consultancy","article_published_time":"2020-06-03T12:04:34+00:00","article_modified_time":"2022-08-02T12:51:08+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/i0.wp.com\/landg-consultancy.com\/wp-content\/uploads\/2020\/06\/Untitled-design-30.jpg?fit=1200%2C628&ssl=1","type":"image\/jpeg"}],"author":"Charanpreet Singh","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Charanpreet Singh","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/#article","isPartOf":{"@id":"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/"},"author":{"name":"Charanpreet Singh","@id":"http:\/\/sh024.global.temp.domains\/~landgcon\/#\/schema\/person\/5dc3b323c5f0797bdc776ae36267fda4"},"headline":"Logging The backup plan- Serilog","datePublished":"2020-06-03T12:04:34+00:00","dateModified":"2022-08-02T12:51:08+00:00","mainEntityOfPage":{"@id":"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/"},"wordCount":728,"commentCount":0,"image":{"@id":"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/lng-consultancy.com\/staging\/5474\/wp-content\/uploads\/2020\/06\/Untitled-design-30.jpg?fit=1200%2C628&ssl=1","keywords":["Application Insight Sink","Azure Application Insight","Logging","Mongodb Sink","Serilog"],"articleSection":["Software Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/","url":"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/","name":"Logging The backup plan- Serilog - L&amp;G Consultancy","isPartOf":{"@id":"http:\/\/sh024.global.temp.domains\/~landgcon\/#website"},"primaryImageOfPage":{"@id":"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/#primaryimage"},"image":{"@id":"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/lng-consultancy.com\/staging\/5474\/wp-content\/uploads\/2020\/06\/Untitled-design-30.jpg?fit=1200%2C628&ssl=1","datePublished":"2020-06-03T12:04:34+00:00","dateModified":"2022-08-02T12:51:08+00:00","author":{"@id":"http:\/\/sh024.global.temp.domains\/~landgcon\/#\/schema\/person\/5dc3b323c5f0797bdc776ae36267fda4"},"breadcrumb":{"@id":"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/#primaryimage","url":"https:\/\/i0.wp.com\/lng-consultancy.com\/staging\/5474\/wp-content\/uploads\/2020\/06\/Untitled-design-30.jpg?fit=1200%2C628&ssl=1","contentUrl":"https:\/\/i0.wp.com\/lng-consultancy.com\/staging\/5474\/wp-content\/uploads\/2020\/06\/Untitled-design-30.jpg?fit=1200%2C628&ssl=1","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/landg-consultancy.com\/logging-the-backup-plan-serilog\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/lng-consultancy.com\/staging\/5474\/"},{"@type":"ListItem","position":2,"name":"Logging The backup plan- Serilog"}]},{"@type":"WebSite","@id":"http:\/\/sh024.global.temp.domains\/~landgcon\/#website","url":"http:\/\/sh024.global.temp.domains\/~landgcon\/","name":"L&amp;G Consultancy","description":"Your Technology Partner","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/sh024.global.temp.domains\/~landgcon\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/sh024.global.temp.domains\/~landgcon\/#\/schema\/person\/5dc3b323c5f0797bdc776ae36267fda4","name":"Charanpreet Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/60f39e431ff12acc271104a91c55cf1c75285d9be16fe4a8db4ac997fa1b4e7e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/60f39e431ff12acc271104a91c55cf1c75285d9be16fe4a8db4ac997fa1b4e7e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/60f39e431ff12acc271104a91c55cf1c75285d9be16fe4a8db4ac997fa1b4e7e?s=96&d=mm&r=g","caption":"Charanpreet Singh"},"url":"https:\/\/lng-consultancy.com\/staging\/5474\/author\/charanpreetsingh83\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/lng-consultancy.com\/staging\/5474\/wp-content\/uploads\/2020\/06\/Untitled-design-30.jpg?fit=1200%2C628&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/posts\/7174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/comments?post=7174"}],"version-history":[{"count":1,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/posts\/7174\/revisions"}],"predecessor-version":[{"id":7312,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/posts\/7174\/revisions\/7312"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/media\/7311"}],"wp:attachment":[{"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/media?parent=7174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/categories?post=7174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lng-consultancy.com\/staging\/5474\/wp-json\/wp\/v2\/tags?post=7174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}