You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Umbraco we use the underlying logging framework of [Serilog](https://serilog.net/).
8
8
9
-
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.
9
+
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.
10
10
11
11
The default location of this file is written to `umbraco/Logs` and contains the Machine name, along with the date too:
12
12
@@ -20,7 +20,7 @@ Serilog is a logging framework that allows us to do structured logging or write
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.
23
+
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.
24
24
25
25
```json
26
26
{
@@ -46,13 +46,13 @@ Here is an example of the same log message represented as JSON, you can see here
46
46
}
47
47
```
48
48
49
-
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)
49
+
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)
50
50
51
51
## Writing to the log
52
52
53
-
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.
53
+
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.
54
54
55
-
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
55
+
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.
Copy file name to clipboardExpand all lines: 13/umbraco-cms/fundamentals/code/debugging/logging.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
In Umbraco we use the underlying logging framework of [Serilog](https://serilog.net/).
4
4
5
-
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.
5
+
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.
6
6
7
7
The default location of this file is written to `umbraco/Logs` and contains the Machine name, along with the date too:
8
8
@@ -22,7 +22,7 @@ Serilog is a logging framework that allows us to do structured logging or write
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.
25
+
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.
26
26
27
27
```json
28
28
{
@@ -48,13 +48,13 @@ Here is an example of the same log message represented as JSON, you can see here
48
48
}
49
49
```
50
50
51
-
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)
51
+
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)
52
52
53
53
## Writing to the log
54
54
55
-
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.
55
+
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.
56
56
57
-
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
57
+
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.
Copy file name to clipboardExpand all lines: 14/umbraco-cms/fundamentals/code/debugging/logging.md
+11-14Lines changed: 11 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,16 @@
2
2
3
3
In Umbraco we use the underlying logging framework of [Serilog](https://serilog.net/).
4
4
5
-
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.
5
+
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.
6
6
7
7
The default location of this file is written to `umbraco/Logs` and contains the Machine name, along with the date too:
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.
25
+
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.
26
26
27
27
```json
28
28
{
@@ -48,26 +48,23 @@ Here is an example of the same log message represented as JSON, you can see here
48
48
}
49
49
```
50
50
51
-
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)
51
+
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)
52
52
53
53
## Writing to the log
54
54
55
-
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.
55
+
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.
56
56
57
-
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
58
-
59
-
{% hint style="warning" %}
60
-
The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15.
61
-
{% endhint %}
57
+
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.
62
58
63
59
```csharp
64
60
usingMicrosoft.AspNetCore.Mvc;
65
61
usingMicrosoft.Extensions.Logging;
66
-
usingUmbraco.Cms.Web.Common.Controllers;
67
62
68
63
namespaceUmbraco.Cms.Web.UI.NetCore;
69
64
70
-
publicclassMyApiController : UmbracoApiController
65
+
[ApiController]
66
+
[Route("/umbraco/api/myapi")]
67
+
publicclassMyApiController : Controller
71
68
{
72
69
privatereadonlyILogger<MyApiController> _logger;
73
70
@@ -77,7 +74,7 @@ public class MyApiController : UmbracoApiController
77
74
}
78
75
79
76
/// /umbraco/api/MyApi/SayHello?name=John
80
-
[HttpGet]
77
+
[HttpGet("sayhello")]
81
78
publicstringSayHello(stringname)
82
79
{
83
80
_logger.LogInformation("We are saying hello to {Name}", name);
Copy file name to clipboardExpand all lines: 15/umbraco-cms/fundamentals/code/debugging/logging.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
In Umbraco we use the underlying logging framework of [Serilog](https://serilog.net/).
4
4
5
-
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.
5
+
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.
6
6
7
7
The default location of this file is written to `umbraco/Logs` and contains the Machine name, along with the date too:
8
8
@@ -22,7 +22,7 @@ Serilog is a logging framework that allows us to do structured logging or write
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.
25
+
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.
26
26
27
27
```json
28
28
{
@@ -48,13 +48,13 @@ Here is an example of the same log message represented as JSON, you can see here
48
48
}
49
49
```
50
50
51
-
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)
51
+
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)
52
52
53
53
## Writing to the log
54
54
55
-
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.
55
+
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.
56
56
57
-
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
57
+
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.
58
58
59
59
{% hint style="warning" %}
60
60
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
63
63
```csharp
64
64
usingMicrosoft.AspNetCore.Mvc;
65
65
usingMicrosoft.Extensions.Logging;
66
-
usingUmbraco.Cms.Web.Common.Controllers;
67
66
68
67
namespaceUmbraco.Cms.Web.UI.NetCore;
69
68
70
-
publicclassMyApiController : UmbracoApiController
69
+
[ApiController]
70
+
[Route("/umbraco/api/myapi")]
71
+
publicclassMyApiController : Controller
71
72
{
72
73
privatereadonlyILogger<MyApiController> _logger;
73
74
@@ -77,7 +78,7 @@ public class MyApiController : UmbracoApiController
77
78
}
78
79
79
80
/// /umbraco/api/MyApi/SayHello?name=John
80
-
[HttpGet]
81
+
[HttpGet("sayhello")]
81
82
publicstringSayHello(stringname)
82
83
{
83
84
_logger.LogInformation("We are saying hello to {Name}", name);
0 commit comments