Исходный код вики Сценарии
Редактировал(а) Alexandr Fokin 2022/12/01 06:23
Последние авторы
author | version | line-number | content |
---|---|---|---|
1 | ---- | ||
2 | |||
3 | Форматирование даты | ||
4 | [[https:~~/~~/github.com/NLog/NLog/wiki/Date-layout-renderer>>url:https://github.com/NLog/NLog/wiki/Date-layout-renderer]] | ||
5 | |||
6 | Форматирование exception | ||
7 | [[https:~~/~~/stackoverflow.com/questions/4684399/how-to-get-the-stack-trace-when-logging-exceptions-with-nlog>>url:https://stackoverflow.com/questions/4684399/how-to-get-the-stack-trace-when-logging-exceptions-with-nlog]] | ||
8 | [[https:~~/~~/stackoverflow.com/questions/46565639/nlog-exception-layout-to-format-exception-type-message-and-stack-trace>>url:https://stackoverflow.com/questions/46565639/nlog-exception-layout-to-format-exception-type-message-and-stack-trace]] | ||
9 | |||
10 | The @ means serialize all Exception-properties into Json-format | ||
11 | ${exception:format=@} | ||
12 | |||
13 | ---- | ||
14 | |||
15 | Контекст логирования MappedDiagnosticsLogicalContext | ||
16 | |||
17 | NLog – tracking flow of requests using MappedDiagnosticsLogicalContext | ||
18 | [[https:~~/~~/tpodolak.com/blog/2016/07/05/nlog-tracking-flow-of-requests-using-mappeddiagnosticslogicalcontext/>>url:https://tpodolak.com/blog/2016/07/05/nlog-tracking-flow-of-requests-using-mappeddiagnosticslogicalcontext/]] | ||
19 | |||
20 | ---- | ||
21 | |||
22 | Обрезка строк для избежании ошибки при записи в базу. | ||
23 | |||
24 | NLog auto truncate messages | ||
25 | [[https:~~/~~/stackoverflow.com/questions/19368284/nlog-auto-truncate-messages>>url:https://stackoverflow.com/questions/19368284/nlog-auto-truncate-messages]] | ||
26 | |||
27 | ---- | ||
28 | |||
29 | Реализация кастомного target | ||
30 | |||
31 | Extending NLog is... easy! | ||
32 | [[https:~~/~~/nlog-project.org/2015/06/30/extending-nlog-is-easy.html>>url:https://nlog-project.org/2015/06/30/extending-nlog-is-easy.html]] | ||
33 | |||
34 | ---- | ||
35 | |||
36 | Параллельная запись в файл, использует mutex | ||
37 | Параметр concurrentWrites | ||
38 | |||
39 | ---- | ||
40 | |||
41 | Асинхронное логирование (буферизация и выделенный поток): | ||
42 | |||
43 | Запись события лога происходит не в target, а в очередь в оперативной памяти. Выделенный поток периодически запускается и отправляет данные события в targets. | ||
44 | Блокирующий вызов, принудительная запись всех накопившихся в очереди событий и отчистку очереди, чтобы гарантировать сохранение всех логов, находящихся в очереди. | ||
45 | Очередь событий может переполниться и возможно имеет смысл явно определить политику переполнения (отбрасывать сообщения или увеличить размер буфера). | ||
46 | |||
47 | AsyncTargetWrapper | ||
48 | [[https:~~/~~/nlog-project.org/documentation/v2.0.1/html/T_NLog_Targets_Wrappers_AsyncTargetWrapper.htm>>url:https://nlog-project.org/documentation/v2.0.1/html/T_NLog_Targets_Wrappers_AsyncTargetWrapper.htm]] | ||
49 | |||
50 | Should NLog flush all queued messages in the AsyncTargetWrapper when Flush() is called? | ||
51 | [[https:~~/~~/stackoverflow.com/questions/10492720/should-nlog-flush-all-queued-messages-in-the-asynctargetwrapper-when-flush-is>>url:https://stackoverflow.com/questions/10492720/should-nlog-flush-all-queued-messages-in-the-asynctargetwrapper-when-flush-is]] | ||
52 | |||
53 | NLog performance | ||
54 | [[https:~~/~~/stackoverflow.com/questions/3868240/nlog-performance>>url:https://stackoverflow.com/questions/3868240/nlog-performance]] |