From b8881ee830f4e80dff36157d9daf2ba816e76c71 Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Fri, 4 Oct 2024 09:41:30 +0200 Subject: [PATCH 1/8] Update controller --- 14/umbraco-cms/fundamentals/code/debugging/logging.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/14/umbraco-cms/fundamentals/code/debugging/logging.md b/14/umbraco-cms/fundamentals/code/debugging/logging.md index 61b9589a2d7..9440da79ff6 100644 --- a/14/umbraco-cms/fundamentals/code/debugging/logging.md +++ b/14/umbraco-cms/fundamentals/code/debugging/logging.md @@ -63,11 +63,12 @@ The example below uses UmbracoApiController which is obsolete in Umbraco 14 and ```csharp using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Umbraco.Cms.Web.Common.Controllers; namespace Umbraco.Cms.Web.UI.NetCore; -public class MyApiController : UmbracoApiController +[ApiController] +[Route("/umbraco/api/myapi")] +public class MyApiController : Controller { private readonly ILogger _logger; @@ -77,7 +78,7 @@ public class MyApiController : UmbracoApiController } /// /umbraco/api/MyApi/SayHello?name=John - [HttpGet] + [HttpGet("sayhello")] public string SayHello(string name) { _logger.LogInformation("We are saying hello to {Name}", name); From d3001014b716fb0eb32599a402fef21245642269 Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Fri, 4 Oct 2024 09:42:06 +0200 Subject: [PATCH 2/8] Delete obsolete message --- 14/umbraco-cms/fundamentals/code/debugging/logging.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/14/umbraco-cms/fundamentals/code/debugging/logging.md b/14/umbraco-cms/fundamentals/code/debugging/logging.md index 9440da79ff6..06cacd6fd97 100644 --- a/14/umbraco-cms/fundamentals/code/debugging/logging.md +++ b/14/umbraco-cms/fundamentals/code/debugging/logging.md @@ -56,10 +56,6 @@ Umbraco writes log messages, but you are also able to use the Umbraco logger to Here is an example of using the logger to write an Information message to the log which will contain one property of **Name** which will output the name variable that is passed into the method -{% hint style="warning" %} -The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15. -{% endhint %} - ```csharp using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; From 75bd098acb1132455145e5889edcba0dec49f453 Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Fri, 4 Oct 2024 09:48:11 +0200 Subject: [PATCH 3/8] Improve readability --- 14/umbraco-cms/fundamentals/code/debugging/logging.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/14/umbraco-cms/fundamentals/code/debugging/logging.md b/14/umbraco-cms/fundamentals/code/debugging/logging.md index 06cacd6fd97..eaf917e3aa8 100644 --- a/14/umbraco-cms/fundamentals/code/debugging/logging.md +++ b/14/umbraco-cms/fundamentals/code/debugging/logging.md @@ -2,7 +2,7 @@ In Umbraco we use the underlying logging framework of [Serilog](https://serilog.net/). -Out of the box we write a JSON log file that contains a more rich logfile, that allows tools to perform searches & correlation on log patterns a lot easier. +Out of the box, we write a JSON log file that contains a more detailed logfile. This allows tools to perform searches and correlations on log patterns more efficiently. The default location of this file is written to `umbraco/Logs` and contains the Machine name, along with the date too: @@ -22,7 +22,7 @@ Serilog is a logging framework that allows us to do structured logging or write 2021-08-10 09:33:23,677 [P25776/D1/T22] INFO Umbraco.Cms.Core.Services.Implement.ContentService - Document Home (id=1062) has been published. ``` -Here is an example of the same log message represented as JSON, you can see here we have much more information that would allow us to search & filter logs based on these properties with an appropriate logging system. +Here is an example of the same log message represented as JSON. You can see that we have much more information. This would allow us to search and filter logs based on these properties with an appropriate logging system. ```json { @@ -48,13 +48,13 @@ Here is an example of the same log message represented as JSON, you can see here } ``` -To learn more about structured logging and message templates you can read more about it over on the [https://messagetemplates.org](https://messagetemplates.org) website or alternatively watch this video from the Serilog creator - [https://www.youtube.com/watch?v=OhmNp8UPEEg](https://www.youtube.com/watch?v=OhmNp8UPEEg) +To learn more about structured logging and message templates you can read more about it over on the [https://messagetemplates.org](https://messagetemplates.org) website. Alternatively watch this video from the Serilog creator - [https://www.youtube.com/watch?v=OhmNp8UPEEg](https://www.youtube.com/watch?v=OhmNp8UPEEg) ## Writing to the log -Umbraco writes log messages, but you are also able to use the Umbraco logger to write the log file as needed, so you can get further insights and details about your implementation. +Umbraco writes log messages, but you are also able to use the Umbraco logger to write the log file as needed. This allows you to gain further insights and details about your implementation. -Here is an example of using the logger to write an Information message to the log which will contain one property of **Name** which will output the name variable that is passed into the method +Here is an example of using the logger to write an Information message to the log. It will contain one property, **Name**, which will output the name variable that is passed into the method. ```csharp using Microsoft.AspNetCore.Mvc; From 32e6cc774b40a12a5da686fe37704b58fb64b29e Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Fri, 4 Oct 2024 09:50:26 +0200 Subject: [PATCH 4/8] Update v15 --- .../fundamentals/code/debugging/logging.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/15/umbraco-cms/fundamentals/code/debugging/logging.md b/15/umbraco-cms/fundamentals/code/debugging/logging.md index 61b9589a2d7..bf2084b6766 100644 --- a/15/umbraco-cms/fundamentals/code/debugging/logging.md +++ b/15/umbraco-cms/fundamentals/code/debugging/logging.md @@ -2,7 +2,7 @@ In Umbraco we use the underlying logging framework of [Serilog](https://serilog.net/). -Out of the box we write a JSON log file that contains a more rich logfile, that allows tools to perform searches & correlation on log patterns a lot easier. +Out of the box, we write a JSON log file that contains a more detailed logfile. This allows tools to perform searches and correlations on log patterns more efficiently. The default location of this file is written to `umbraco/Logs` and contains the Machine name, along with the date too: @@ -22,7 +22,7 @@ Serilog is a logging framework that allows us to do structured logging or write 2021-08-10 09:33:23,677 [P25776/D1/T22] INFO Umbraco.Cms.Core.Services.Implement.ContentService - Document Home (id=1062) has been published. ``` -Here is an example of the same log message represented as JSON, you can see here we have much more information that would allow us to search & filter logs based on these properties with an appropriate logging system. +Here is an example of the same log message represented as JSON. You can see that we have much more information. This would allow us to search and filter logs based on these properties with an appropriate logging system. ```json { @@ -48,13 +48,13 @@ Here is an example of the same log message represented as JSON, you can see here } ``` -To learn more about structured logging and message templates you can read more about it over on the [https://messagetemplates.org](https://messagetemplates.org) website or alternatively watch this video from the Serilog creator - [https://www.youtube.com/watch?v=OhmNp8UPEEg](https://www.youtube.com/watch?v=OhmNp8UPEEg) +To learn more about structured logging and message templates you can read more about it over on the [https://messagetemplates.org](https://messagetemplates.org) website. Alternatively watch this video from the Serilog creator - [https://www.youtube.com/watch?v=OhmNp8UPEEg](https://www.youtube.com/watch?v=OhmNp8UPEEg) ## Writing to the log -Umbraco writes log messages, but you are also able to use the Umbraco logger to write the log file as needed, so you can get further insights and details about your implementation. +Umbraco writes log messages, but you are also able to use the Umbraco logger to write the log file as needed. This allows you to gain further insights and details about your implementation. -Here is an example of using the logger to write an Information message to the log which will contain one property of **Name** which will output the name variable that is passed into the method +Here is an example of using the logger to write an Information message to the log. It will contain one property, **Name**, which will output the name variable that is passed into the method. {% hint style="warning" %} The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15. @@ -63,11 +63,12 @@ The example below uses UmbracoApiController which is obsolete in Umbraco 14 and ```csharp using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Umbraco.Cms.Web.Common.Controllers; namespace Umbraco.Cms.Web.UI.NetCore; -public class MyApiController : UmbracoApiController +[ApiController] +[Route("/umbraco/api/myapi")] +public class MyApiController : Controller { private readonly ILogger _logger; @@ -77,7 +78,7 @@ public class MyApiController : UmbracoApiController } /// /umbraco/api/MyApi/SayHello?name=John - [HttpGet] + [HttpGet("sayhello")] public string SayHello(string name) { _logger.LogInformation("We are saying hello to {Name}", name); From 25363c9076f86bc6b93190ea81719bee2f1d780f Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Tue, 8 Oct 2024 08:35:13 +0200 Subject: [PATCH 5/8] Update 14/umbraco-cms/fundamentals/code/debugging/logging.md Co-authored-by: sofietoft --- 14/umbraco-cms/fundamentals/code/debugging/logging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/14/umbraco-cms/fundamentals/code/debugging/logging.md b/14/umbraco-cms/fundamentals/code/debugging/logging.md index eaf917e3aa8..467cbec5f41 100644 --- a/14/umbraco-cms/fundamentals/code/debugging/logging.md +++ b/14/umbraco-cms/fundamentals/code/debugging/logging.md @@ -22,7 +22,7 @@ Serilog is a logging framework that allows us to do structured logging or write 2021-08-10 09:33:23,677 [P25776/D1/T22] INFO Umbraco.Cms.Core.Services.Implement.ContentService - Document Home (id=1062) has been published. ``` -Here is an example of the same log message represented as JSON. You can see that we have much more information. This would allow us to search and filter logs based on these properties with an appropriate logging system. +Here is an example of the same log message represented as JSON. More information is available and allows you to search and filter logs based on these properties with an appropriate logging system. ```json { From f44576bfe92b84f0929719a1a13d730cc4e227af Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Tue, 8 Oct 2024 08:35:19 +0200 Subject: [PATCH 6/8] Update 15/umbraco-cms/fundamentals/code/debugging/logging.md Co-authored-by: sofietoft --- 15/umbraco-cms/fundamentals/code/debugging/logging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/15/umbraco-cms/fundamentals/code/debugging/logging.md b/15/umbraco-cms/fundamentals/code/debugging/logging.md index bf2084b6766..ddc48731308 100644 --- a/15/umbraco-cms/fundamentals/code/debugging/logging.md +++ b/15/umbraco-cms/fundamentals/code/debugging/logging.md @@ -22,7 +22,7 @@ Serilog is a logging framework that allows us to do structured logging or write 2021-08-10 09:33:23,677 [P25776/D1/T22] INFO Umbraco.Cms.Core.Services.Implement.ContentService - Document Home (id=1062) has been published. ``` -Here is an example of the same log message represented as JSON. You can see that we have much more information. This would allow us to search and filter logs based on these properties with an appropriate logging system. +Here is an example of the same log message represented as JSON. More information is available and allows you to search and filter logs based on these properties with an appropriate logging system. ```json { From 0cea743a2a165b674672a485f28a1cee965273cb Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Tue, 8 Oct 2024 08:40:05 +0200 Subject: [PATCH 7/8] Update v10 & 13 --- 10/umbraco-cms/fundamentals/code/debugging/logging.md | 10 +++++----- 13/umbraco-cms/fundamentals/code/debugging/logging.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/10/umbraco-cms/fundamentals/code/debugging/logging.md b/10/umbraco-cms/fundamentals/code/debugging/logging.md index e4927cc7d83..a294a184301 100644 --- a/10/umbraco-cms/fundamentals/code/debugging/logging.md +++ b/10/umbraco-cms/fundamentals/code/debugging/logging.md @@ -6,7 +6,7 @@ keywords: logging serilog messagetemplates logs v9 version9 In Umbraco we use the underlying logging framework of [Serilog](https://serilog.net/). -Out of the box we write a JSON log file that contains a more rich logfile, that allows tools to perform searches & correlation on log patterns a lot easier. +Out of the box, we write a JSON log file that contains a more detailed logfile. This allows tools to perform searches and correlations on log patterns more efficiently. The default location of this file is written to `umbraco/Logs` and contains the Machine name, along with the date too: @@ -20,7 +20,7 @@ Serilog is a logging framework that allows us to do structured logging or write 2021-08-10 09:33:23,677 [P25776/D1/T22] INFO Umbraco.Cms.Core.Services.Implement.ContentService - Document Home (id=1062) has been published. ``` -Here is an example of the same log message represented as JSON, you can see here we have much more information that would allow us to search & filter logs based on these properties with an appropriate logging system. +Here is an example of the same log message represented as JSON. More information is available and allows you to search and filter logs based on these properties with an appropriate logging system. ```json { @@ -46,13 +46,13 @@ Here is an example of the same log message represented as JSON, you can see here } ``` -To learn more about structured logging and message templates you can read more about it over on the [https://messagetemplates.org](https://messagetemplates.org) website or alternatively watch this video from the Serilog creator - [https://www.youtube.com/watch?v=OhmNp8UPEEg](https://www.youtube.com/watch?v=OhmNp8UPEEg) +To learn more about structured logging and message templates you can read more about it over on the [https://messagetemplates.org](https://messagetemplates.org) website. Alternatively watch this video from the Serilog creator - [https://www.youtube.com/watch?v=OhmNp8UPEEg](https://www.youtube.com/watch?v=OhmNp8UPEEg) ## Writing to the log -Umbraco writes log messages, but you are also able to use the Umbraco logger to write the log file as needed, so you can get further insights and details about your implementation. +Umbraco writes log messages, but you are also able to use the Umbraco logger to write the log file as needed. This allows you to gain further insights and details about your implementation. -Here is an example of using the logger to write an Information message to the log which will contain one property of **Name** which will output the name variable that is passed into the method +Here is an example of using the logger to write an Information message to the log. It will contain one property, **Name**, which will output the name variable that is passed into the method. ```csharp using Microsoft.AspNetCore.Mvc; diff --git a/13/umbraco-cms/fundamentals/code/debugging/logging.md b/13/umbraco-cms/fundamentals/code/debugging/logging.md index 00f3caa2b66..6bd163e7a86 100644 --- a/13/umbraco-cms/fundamentals/code/debugging/logging.md +++ b/13/umbraco-cms/fundamentals/code/debugging/logging.md @@ -2,7 +2,7 @@ In Umbraco we use the underlying logging framework of [Serilog](https://serilog.net/). -Out of the box we write a JSON log file that contains a more rich logfile, that allows tools to perform searches & correlation on log patterns a lot easier. +Out of the box, we write a JSON log file that contains a more detailed logfile. This allows tools to perform searches and correlations on log patterns more efficiently. The default location of this file is written to `umbraco/Logs` and contains the Machine name, along with the date too: @@ -22,7 +22,7 @@ Serilog is a logging framework that allows us to do structured logging or write 2021-08-10 09:33:23,677 [P25776/D1/T22] INFO Umbraco.Cms.Core.Services.Implement.ContentService - Document Home (id=1062) has been published. ``` -Here is an example of the same log message represented as JSON, you can see here we have much more information that would allow us to search & filter logs based on these properties with an appropriate logging system. +Here is an example of the same log message represented as JSON. More information is available and allows you to search and filter logs based on these properties with an appropriate logging system. ```json { @@ -48,13 +48,13 @@ Here is an example of the same log message represented as JSON, you can see here } ``` -To learn more about structured logging and message templates you can read more about it over on the [https://messagetemplates.org](https://messagetemplates.org) website or alternatively watch this video from the Serilog creator - [https://www.youtube.com/watch?v=OhmNp8UPEEg](https://www.youtube.com/watch?v=OhmNp8UPEEg) +To learn more about structured logging and message templates you can read more about it over on the [https://messagetemplates.org](https://messagetemplates.org) website. Alternatively watch this video from the Serilog creator - [https://www.youtube.com/watch?v=OhmNp8UPEEg](https://www.youtube.com/watch?v=OhmNp8UPEEg) ## Writing to the log -Umbraco writes log messages, but you are also able to use the Umbraco logger to write the log file as needed, so you can get further insights and details about your implementation. +Umbraco writes log messages, but you are also able to use the Umbraco logger to write the log file as needed. This allows you to gain further insights and details about your implementation. -Here is an example of using the logger to write an Information message to the log which will contain one property of **Name** which will output the name variable that is passed into the method +Here is an example of using the logger to write an Information message to the log. It will contain one property, **Name**, which will output the name variable that is passed into the method. ```csharp using Microsoft.AspNetCore.Mvc; From f8a4ffbd2c48a0e19fafd4af1a937feb038b5039 Mon Sep 17 00:00:00 2001 From: sofietoft Date: Tue, 8 Oct 2024 09:25:32 +0200 Subject: [PATCH 8/8] Small change to trigger checks --- 14/umbraco-cms/fundamentals/code/debugging/logging.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/14/umbraco-cms/fundamentals/code/debugging/logging.md b/14/umbraco-cms/fundamentals/code/debugging/logging.md index 467cbec5f41..a7bff707caa 100644 --- a/14/umbraco-cms/fundamentals/code/debugging/logging.md +++ b/14/umbraco-cms/fundamentals/code/debugging/logging.md @@ -8,10 +8,10 @@ The default location of this file is written to `umbraco/Logs` and contains the * `umbraco/Logs/UmbracoTraceLog.DELLBOOK.20210809.json` -## Video overview +## Video Overview {% embed url="" %} -Watch this video to get an overview of how to view and manage logs and logfiles for your Umbraco CMS website. +Watch this video to get an overview of how to view and manage logs and log files for your Umbraco CMS website. {% endembed %} ## Structured logging