Conversation
|
@frankmccarry I added the file configuration and it performs as expected. The only downside is that we have to pass the filepath to the configuration as it's a requirement from WriteTo.File . I tested with a default name, but then the template doesn't get applied onto the file mentioned in .ReadFrom.Configuration(configuration). Here is a sample of call: |
Also moved the source files alongside the project per .NET conventions
caf-logging-serilog/Sanitizer.cs
Outdated
| { | ||
| if (char.IsControl(c)) | ||
| { | ||
| return true; |
There was a problem hiding this comment.
So we're saying that if the message being logged contains a control character that it is safe to log!!
caf-logging-serilog/Sanitizer.cs
Outdated
| // http://www.csc.villanova.edu/~tway/resources/ascii-table.html | ||
| foreach (char c in message) | ||
| { | ||
| if (char.IsControl(c)) |
There was a problem hiding this comment.
This check doesn't relate to the comment above. Are we checking if the characters are ASCII, or are we checking if they are control characters?
There was a problem hiding this comment.
I updated to match what we do here Note that we consider non-latin characters as unsafe.
|
|
||
| ## Examples | ||
|
|
||
| `[2022-05-10 13:29:45.444Z #217.001 WARN john-tenant Cidi] c.m.d.f.f.f.FieldFullTextFixer: "Greek test: κόσμε"` |
There was a problem hiding this comment.
Why does the strings being logged have quotes around them? And also why are there extra quotes in the strings in the message field?
I.e. I tried this: Log.Error(ex, "Caught an exception");
I expected: {"message":"Caught an exception","exception":"..."}
But I got: {"message":"\"Caught an exception\"","exception":"..."}
|
|
||
| ## Pattern | ||
|
|
||
| `[{@t:yyyy-MM-dd HH:mm:ss.fffZ} {Tid(ProcessId,ThreadId)} {Log(@l):5} {Sanitize(tenantId, 12, 12)} {Sanitize(correlationId, 4, 4)}] {Sanitize(logger, 30, 30)}: {MaybeJsonMsgAndEx(@m,@x)}\n` |
There was a problem hiding this comment.
- When I tested this I did not see the time coming out in UTC.
- Tenant Id and Correlation Id are not defaulting to a dash if they are not present
There was a problem hiding this comment.
Both should be fixed now. I am getting: [2022-05-13 15:10:53.160Z #272.001 ERROR - -] c.m.d.f.f.f.FieldFullTextFixer: {"message":"{FirstName"}
caf-logging-serilog/README.md
Outdated
| # CAF Logging Serilog | ||
| This project configures Serilog to meet the CAF Logging Standard. | ||
|
|
||
| The log level is controllable via value that can be provided on Logger initialization. The default used is `INFO`. |
There was a problem hiding this comment.
Can't we control the log level by setting the CAF_LOG_LEVEL environment variable the same way we do with the Logback and the Log4j 2 versions?
https://internal.almoctane.com/ui/entity-navigation?p=131002/6001&entityType=work_item&id=354240