{"id":302478,"date":"2020-04-24T21:00:14","date_gmt":"2020-04-24T21:00:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=302478"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=302478","title":{"rendered":"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Graylog \u0438 NLog \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043b\u043e\u0433\u043e\u0432 \u043e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 C#. \u041b\u0438\u0447\u043d\u044b\u0439 \u043e\u043f\u044b\u0442"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/498978\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_y\/ee\/iu\/_yeeiuyxudo9su5z6rjaloimftg.jpeg\"><br \/>  <a href=\"https:\/\/michaelscodingspot.com\/logging-in-dotnet\/\" rel=\"nofollow\">\u041a\u0414\u041f\u0412<\/a><\/p>\n<p>  \u0425\u0430\u0431\u0440, \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e!<\/p>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043d\u0438\u0436\u0435 \u043d\u0438 \u0432 \u043a\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 <i>tutorial<\/i> \u0438\u043b\u0438 <i>best practice<\/i>. \u042f \u0440\u0435\u0448\u0438\u043b \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0432 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0435.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0449\u0443\u0449\u0438\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e <a href=\"https:\/\/ru.wiktionary.org\/wiki\/%D0%BB%D0%BE%D0%B3%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5\" rel=\"nofollow\">\u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<\/a> \u043f\u043e\u0447\u0435\u0440\u043f\u043d\u0443\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0438\u043b\u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u043b\u0438\u0431\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u0418, \u0441\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439, \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0444\u0438\u0434\u0431\u0435\u043a \u043e\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430. \u042d\u0442\u043e \u0434\u0430\u0451\u0442 \u0448\u0430\u043d\u0441 \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043b\u0443\u0447\u0448\u0435.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0414\u043b\u044f \u0447\u0435\u0433\u043e? \u0414\u043b\u044f \u043a\u043e\u0433\u043e?<\/h4>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u043e\u0432 \u0441\u0432\u043e\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438:  <\/p>\n<blockquote><p>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u0437\u0438\u0442\u0438\u0432\u043d\u043e\u043c \u0438\u043b\u0438 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u043e\u0439 \u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f.  <\/p><\/blockquote>\n<p>\u0421\u043b\u043e\u0436\u043d\u0430\u044f \u0432\u044b\u0448\u043b\u0430 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430, \u043d\u043e \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u043e\u0432. \u041a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u0435 \u043b\u043e\u0433\u043e\u0432 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0435\u0433\u043e \u0436\u0438\u0437\u043d\u0438: \u043e\u0442 \u0434\u0435\u0431\u0430\u0433\u0430 \u0434\u043e \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u0438 \u0432 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044f.<\/p>\n<p>  \u0427\u0442\u043e \u0436, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u044f \u043f\u0438\u0448\u0443 \u043b\u043e\u0433\u0438.<\/p>\n<h4>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439<\/h4>\n<p>  \u041e\u043f\u0443\u0441\u0442\u0438\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u043b\u043e\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0442\u0438\u043f\u0430 \u201c<i>\u0411\u0430\u0437\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430<\/i>\u201d, \u201c<i>\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b<\/i>\u201d \u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445. \u041b\u043e\u0433\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c, \u043d\u043e \u0438\u0445 \u0447\u0430\u0441\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u043b\u043e \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0441\u0443\u0442\u0438 \u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 \u043a\u043e\u0434\u0435 \u0438\u043b\u0438 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438. \u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u0439\u0442\u0438 \u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e. \u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u043c\u043d\u0435 \u043c\u043e\u0439 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0434\u0440\u0443\u0433 \u0438 IT-\u043d\u0430\u0441\u0442\u0430\u0432\u043d\u0438\u043a: \u201c<i>\u0421\u043e\u0431\u0438\u0440\u0430\u0439 \u0432\u0441\u0451, \u043b\u0438\u0448\u043d\u0435\u0435 \u043f\u043e\u0442\u043e\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0448\u044c&#8230;<\/i>\u201d \u0412 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 framework\u2019\u0438.<\/p>\n<p>  \u0418\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0423 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0438\u0437 \u043d\u0438\u0445 \u0441\u0445\u043e\u0436\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u043e \u043d\u0438\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u0435\u0441\u044c\u043c\u0430 \u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0442\u0435\u0439, <a href=\"https:\/\/michaelscodingspot.com\/logging-in-dotnet\/\" rel=\"nofollow\">\u043e\u0431\u0437\u043e\u0440\u043e\u0432<\/a>, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0438 \u043c\u0430\u043d\u0443\u0430\u043b\u043e\u0432. \u0414\u043b\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 C# \u044f \u0432 \u0441\u0432\u043e\u0451 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u0431\u0440\u0430\u043b <a href=\"https:\/\/nlog-project.org\/\" rel=\"nofollow\">NLog<\/a>. \u0421\u0435\u0439\u0447\u0430\u0441 \u0438 \u043d\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u044e \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e, \u043d\u043e \u0442\u0430\u043a \u0443\u0436 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c.<\/p>\n<p>  \u0423 \u044d\u0442\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0432\u0435\u0441\u044c\u043c\u0430 \u043d\u0435\u043f\u043b\u043e\u0445\u0430\u044f <a href=\"https:\/\/github.com\/nlog\/nlog\/wiki\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> \u0438 \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 <a href=\"https:\/\/github.com\/NLog\/NLog\/tree\/dev\/examples\" rel=\"nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/a> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432 \u0440\u0430\u0437\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b NLog \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u041d\u043e \u043a \u043a\u0430\u043a\u043e\u043c\u0443-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u0440\u043e\u0434\u0438\u043b\u0441\u044f \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u0441\u043d\u0438\u043f\u043f\u0435\u0442 \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a \u0434\u0435\u043b\u0443! \u041f\u043e\u043a\u0430\u0436\u0438 \u043a\u043e\u0434:<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Text; using Newtonsoft.Json; using NLog; using NLog.Config; using NLog.Layouts; using NLog.Targets; using NLog.Targets.GraylogHttp;  namespace BIMLIB.Converter { \tpublic static class BimlibLogger \t{ \t\tprivate static readonly ApplicationSettings _settings = BimlibSettingsManager.Instance.AppSettings; \t\tprivate static Lazy&lt;LogFactory&gt; _instance = null; \t\tprivate static LoggingConfiguration _logConfig = null;  \t\tprivate static Lazy&lt;LogFactory&gt; Instance \t\t{ \t\t\tget \t\t\t{ \t\t\t\treturn _instance ?? (_instance = new Lazy&lt;LogFactory&gt;(BuildLogFactory)); \t\t\t} \t\t}  \t\tpublic static Logger GetLogger() \t\t{ \t\t\treturn Instance.Value.GetCurrentClassLogger(); \t\t}  \t\tprivate static LogFactory BuildLogFactory() \t\t{ \t\t\tLoggingConfiguration config = _logConfig ?? new LoggingConfiguration(); \t\t\t\/\/ \u041d\u0435 \u0441\u0430\u043c\u044b\u0439 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u041d\u043e \u0442\u0430\u043a \u0441\u0438\u043c\u043f\u0430\u0442\u0438\u0447\u043d\u0435\u0435. \t\t\tstring headerStr = _settings.LogHeader; \t\t\t\/\/ \u042d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c. \u041f\u043e \u0444\u0430\u043a\u0442\u0443 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0435, \u043d\u0430\u043f\u0440\u043c\u0435\u0440: https:\/\/github.com\/drewnoakes\/figgle \t\t\tLayout header = headerStr;  \t\t\t\/\/ \u041a\u0430\u0436\u0434\u043e\u0435 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043f\u043e\u043b\u0435\u0439 \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e: https:\/\/nlog-project.org\/config\/?tab=layout-renderers \t\t\t\/\/ \u0418\u0442\u043e\u0433 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u0435\u0439: \t\t\t\/\/ - \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f: 2020-04-24 19:13:51.1620 [BIMLIB.Converter.MainClass.Main] -&gt; I : Service starting... \t\t\t\/\/ - \u0434\u043b\u044f \u043e\u0448\u0438\u0431\u043a\u0438: 2020-04-22 09:55:33.1132 [BIMLIB.Converter.Converter.ClearFile] -&gt; E : mscorlib \t\t\t\/\/{ \t\t\t\/\/\t&quot;Type&quot;:&quot;System.IO.FileNotFoundException&quot;, &quot;Message&quot;:&quot;\u0424\u0430\u0439\u043b 'D:\\\\path\\\\to\\\\file\\\\file_name.ifc' \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d.&quot;, &quot;FileName&quot;:&quot;D:\\\\path\\\\to\\\\file\\\\file_name.ifc&quot;, &quot;Data&quot;:{ \t\t\t\/\/\t}, &quot;TargetSite&quot;:&quot;Void WinIOError(Int32, System.String)&quot;, &quot;StackTrace&quot;:&quot;   \u0432 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\\r\\n   \u0432 System.IO.FileInfo.get_Length()\\r\\n   \u0432 BIMLIB.Converter.Converter.ClearFile(String path)&quot;, &quot;Source&quot;:&quot;mscorlib&quot;, &quot;HResult&quot;:-2147024894}  \t\t\tLayout layout = &quot;${longdate} [${callsite:className=true:includeNamespace=true:fileName=false:includeSourcePath=false:methodName=true:cleanNamesOfAnonymousDelegates=true:cleanNamesOfAsyncContinuations=true}] -&gt; ${level:format=FirstCharacter} : ${message}${onexception:inner=${newline}${exception:format=@}}&quot;;  \t\t\t#region Targets ----------------------------  \t\t\t#region FileTarget ----------------------------  \t\t\tFileTarget fileTarget = FileTarget(header, layout); \t\t\tconfig.AddTarget(fileTarget); \t\t\tconfig.AddRuleForAllLevels(fileTarget);  \t\t\t#endregion  \t\t\t#region ConsoleTarget ----------------------------  \t\t\tColoredConsoleTarget consoleTarget = ConsoleTarget(header, layout); \t\t\tconfig.AddTarget(consoleTarget); \t\t\tconfig.AddRuleForAllLevels(consoleTarget);  \t\t\t#endregion  \t\t\t#region DebuggerTarget ----------------------------  \t\t\tDebuggerTarget debugTarget = DebuggerTarget(header, layout); \t\t\tconfig.AddTarget(debugTarget); \t\t\tconfig.AddRuleForAllLevels(debugTarget);  \t\t\t#endregion  \t\t\t#region GelfTarget ----------------------------  \t\t\t\/\/ \u042d\u0442\u043e \u0442\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0430\u044f \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043d\u0430\u0431\u0438\u0432\u0430\u043d\u0438\u044f Graylog \u043b\u0438\u0448\u043d\u0438\u043c\u0438 \u043b\u043e\u0433\u0430\u043c\u0438, \u043f\u043e\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0431\u043e\u0435\u0432\u043e\u0435 \t\t\tif (_settings.Statistics) \t\t\t{ \t\t\t\tGraylogHttpTarget gelfTarget = GelfTarget(headerStr); \t\t\t\tconfig.AddTarget(gelfTarget); \t\t\t\tconfig.AddRuleForAllLevels(gelfTarget); \t\t\t}  \t\t\t#endregion  \t\t\t#endregion  \t\t\tLogFactory logFactory = new LogFactory \t\t\t{ \t\t\t\tConfiguration = config \t\t\t};  \t\t\ttry \t\t\t{ \t\t\t\t\/\/\u041d\u0435 \u0438\u0437\u044f\u0449\u043d\u043e, \u043d\u043e \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \t\t\t\tconfig.LoggingRules.ToList().ForEach(r =&gt; r.SetLoggingLevels(LogLevel.AllLevels.Min(), LogLevel.AllLevels.Max()));  \t\t\t\t_logConfig = config; \t\t\t} \t\t\tcatch (Exception ex) \t\t\t{ \t\t\t\t\/\/\u041b\u043e\u0433\u0433\u0435\u0440\u0430 \u0435\u0449\u0451 \u043d\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0443\u0434\u0430 \u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \t\t\t\tDebug.Write(ex); \t\t\t}  \t\t\treturn logFactory; \t\t}  \t\t#region Target Methods  \t\tprivate static FileTarget FileTarget(Layout header, Layout layout) \t\t{ \t\t\t#region FileTarget ----------------------------  \t\t\tFileTarget fileTarget = new FileTarget(&quot;log_file_target&quot;) \t\t\t{ \t\t\t\tArchiveAboveSize = 1048576, \t\t\t\tArchiveDateFormat = &quot;yyyy.MM.dd_HH.mm.ss&quot;, \t\t\t\tArchiveEvery = FileArchivePeriod.Day, \t\t\t\tArchiveFileName = GetApplicationLogAndArchivePath(false), \t\t\t\tArchiveNumbering = ArchiveNumberingMode.Date, \t\t\t\tArchiveOldFileOnStartup = false, \t\t\t\tAutoFlush = true, \t\t\t\tConcurrentWrites = true, \t\t\t\tDeleteOldFileOnStartup = false, \t\t\t\tEnableArchiveFileCompression = true, \t\t\t\tEnableFileDelete = true, \t\t\t\tEncoding = Encoding.UTF8, \t\t\t\tFileName = GetApplicationLogAndArchivePath(true), \t\t\t\tHeader = header, \t\t\t\tLayout = layout, \t\t\t\tMaxArchiveFiles = 100, \t\t\t\tOpenFileCacheTimeout = 30, \t\t\t\tOpenFileFlushTimeout = 30, \t\t\t\tOptimizeBufferReuse = true \t\t\t};  \t\t\t#endregion  \t\t\treturn fileTarget; \t\t}  \t\tprivate static ColoredConsoleTarget ConsoleTarget(Layout header, Layout layout) \t\t{ \t\t\t#region ConsoleTarget ----------------------------  \t\t\tColoredConsoleTarget consoleTarget = new ColoredConsoleTarget(&quot;log_console_target&quot;) \t\t\t{ \t\t\t\tEncoding = Encoding.UTF8, \t\t\t\tEnableAnsiOutput = false,  \t\t\t\tUseDefaultRowHighlightingRules = true,  \t\t\t\tLayout = layout, \t\t\t\tHeader = header \t\t\t};  \t\t\tConsoleWordHighlightingRule dateHighLightRule = new ConsoleWordHighlightingRule \t\t\t{ \t\t\t\tRegex = @&quot;^(?=\\d).+(?=\\s\\[)&quot;, \t\t\t\tForegroundColor = ConsoleOutputColor.Yellow \t\t\t};  \t\t\tConsoleWordHighlightingRule methodsHighLightRule = new ConsoleWordHighlightingRule \t\t\t{ \t\t\t\tRegex = @&quot;(?&lt;=\\[).+(?=\\])&quot;, \t\t\t\tForegroundColor = ConsoleOutputColor.Blue \t\t\t};  \t\t\tConsoleWordHighlightingRule levelHighLightRule = new ConsoleWordHighlightingRule \t\t\t{ \t\t\t\tRegex = @&quot;(?&lt;=&gt;).+(?=\\s:)&quot;, \t\t\t\tForegroundColor = ConsoleOutputColor.Red \t\t\t};  \t\t\tConsoleWordHighlightingRule messageHighLightRule = new ConsoleWordHighlightingRule \t\t\t{ \t\t\t\tRegex = @&quot;(?&lt;=\\s:\\s).+&quot;, \t\t\t\tForegroundColor = ConsoleOutputColor.Green \t\t\t};  \t\t\tconsoleTarget.WordHighlightingRules.Add(dateHighLightRule); \t\t\tconsoleTarget.WordHighlightingRules.Add(methodsHighLightRule); \t\t\tconsoleTarget.WordHighlightingRules.Add(levelHighLightRule); \t\t\tconsoleTarget.WordHighlightingRules.Add(messageHighLightRule);  \t\t\t#endregion  \t\t\treturn consoleTarget; \t\t}  \t\tprivate static DebuggerTarget DebuggerTarget(Layout header, Layout layout) \t\t{ \t\t\t#region DebuggerTarget ----------------------------  \t\t\tDebuggerTarget debugTarget = new DebuggerTarget(&quot;log_debug_target&quot;) \t\t\t{ \t\t\t\tLayout = layout, \t\t\t\tHeader = header \t\t\t};  \t\t\t#endregion  \t\t\treturn debugTarget; \t\t}  \t\tprivate static GraylogHttpTarget GelfTarget(string header) \t\t{ \t\t\t#region GelfTarget ----------------------------  \t\t\tLayout gelfCommonLayout = &quot;${message}&quot;;  \t\t\tIList&lt;TargetPropertyWithContext&gt; gelfParameterInfos = \t\t\t\tnew List&lt;TargetPropertyWithContext&gt;() \t\t\t\t{ \t\t\t\t\t\/\/ \u0412\u0441\u0435 \u044d\u0442\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u043f\u0438\u0441\u0430\u043d\u044b: https:\/\/nlog-project.org\/config\/?tab=layout-renderers \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;appdomain&quot;, Layout = &quot;${appdomain}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;assembly-version&quot;, Layout = &quot;${assembly-version}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;activityid&quot;, Layout = &quot;${activityid}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;callsite&quot;, Layout = &quot;${callsite}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;callsite-linenumber&quot;, Layout = &quot;${callsite-linenumber}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;environment-user&quot;, Layout = &quot;${environment-user:userName=true:domain=true}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;exeption_json_data&quot;, Layout = &quot;${onexception:inner=${exception:format=@}}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;frameWorkInfo&quot;, Layout = $&quot;{RuntimeInformation.FrameworkDescription} ({RuntimeInformation.ProcessArchitecture})&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;guid&quot;, Layout = &quot;${guid:format=N}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;hostname&quot;, Layout = &quot;${hostname}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;identity&quot;, Layout = &quot;${identity:authType=true:separator=\\n:name=true:isAuthenticated=true}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;level_name&quot;, Layout = &quot;${level:format=Name}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;local-ip&quot;, Layout = &quot;${local-ip:addressFamily=InterNetwork}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;logger&quot;, Layout = &quot;${logger:shortName=false}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;machinename&quot;, Layout = &quot;${machinename}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;osInfo&quot;, Layout = $&quot;{RuntimeInformation.OSDescription} ({RuntimeInformation.OSArchitecture})&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;processid&quot;, Layout = &quot;${processid}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;processinfo_MainWindowHandle&quot;, Layout = &quot;${processinfo:property=MainWindowHandle}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;processinfo_PagedMemorySize&quot;, Layout = &quot;${processinfo:property=PagedMemorySize}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;processname&quot;, Layout = &quot;${processname:fullName=true}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;processtime&quot;, Layout = &quot;${processtime:invariant=false}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;sequenceid&quot;, Layout = &quot;${sequenceid}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;stacktrace&quot;, Layout = &quot;${stacktrace:format=Raw:topFrames=3:skipFrames=0:separator=&#13;&#10;}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;threadid&quot;, Layout = &quot;${threadid}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;threadname&quot;, Layout = &quot;${threadname}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;timestamp&quot;, Layout = $&quot;{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;timestamp_local&quot;, Layout = @&quot;${date:universalTime=false:format=yyyy-MM-dd HH\\:mm\\:ss zzz}&quot; }, \t\t\t\t\tnew TargetPropertyWithContext()  { Name = &quot;windows-identity&quot;, Layout = &quot;${windows-identity:userName=true:domain=true}&quot; } \t\t\t\t};  \t\t\tGraylogHttpTarget gelfUdpTarget = new GraylogHttpTarget \t\t\t{ \t\t\t\tAddNLogLevelName = true, \t\t\t\tFacility = header, \t\t\t\tGraylogServer = _settings.LogServerAddress, \t\t\t\tIncludeCallSite = true, \t\t\t\tIncludeCallSiteStackTrace = true, \t\t\t\tIncludeEventProperties = true, \t\t\t\tLayout = gelfCommonLayout, \t\t\t\tName = &quot;GelfHttp&quot;, \t\t\t\tOptimizeBufferReuse = true \t\t\t};  \t\t\tforeach (TargetPropertyWithContext gelfParameterInfo in gelfParameterInfos) \t\t\t{ \t\t\t\tgelfUdpTarget.ContextProperties.Add(gelfParameterInfo); \t\t\t}  \t\t\t#endregion  \t\t\treturn gelfUdpTarget; \t\t}  \t\t#endregion  \t\tprivate static string GetApplicationLogAndArchivePath(bool isLog) \t\t{ \t\t\tstring addition;  \t\t\tif (!isLog) \t\t\t{ \t\t\t\taddition = &quot;.{#}.zip&quot;; \t\t\t} \t\t\telse \t\t\t{ \t\t\t\taddition = &quot;.log&quot;; \t\t\t}  \t\t\ttry \t\t\t{ \t\t\t\tif (!Directory.Exists(_settings.LogsFolder)) \t\t\t\t{ \t\t\t\t\tDirectory.CreateDirectory(_settings.LogsFolder); \t\t\t\t}  \t\t\t\treturn Path.Combine(_settings.LogsFolder, _settings.ProductName + addition); \t\t\t} \t\t\tcatch (Exception ex) \t\t\t{ \t\t\t\tDebug.Write(ex); \t\t\t\treturn string.Empty; \t\t\t} \t\t} } <\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">using NLog; ...  public static class Downloader \t{ \t\t... \t\tprivate static readonly Logger log = BimlibLogger.GetLogger(); \t\t... \t\tpublic static string GetFileToConvert(ConverterRequest.Inputitem inputItem) \t\t{ \t\t\t... \t\t\ttry \t\t\t{ \t\t\t\t... \t\t\t\tlog.Debug($&quot;Downloaded file: {downloadedFile}, size: {new FileInfo(downloadedFile).Length \/ 1e6}Mb&quot;); \t\t\t} \t\t\tcatch (Exception ex) \t\t\t{ \t\t\t\tlog.Error(ex, ex.Source); \t\t\t\treturn ...; \t\t\t} \t\t} \t} <\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h4>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438<\/h4>\n<p>  \u0413\u043e\u043b\u044b\u0439 \u043a\u043e\u0434, \u0445\u043e\u0442\u044c \u0438 \u0441 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438, \u2014 \u044d\u0442\u043e \u043d\u0435 \u043a\u0440\u0443\u0442\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043f\u0438\u0448\u0443 \u0440\u044f\u0434 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u0439:<\/p>\n<ol>\n<li><b>_settings<\/b> \u2014 \u043d\u0435\u043a\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a. \u041d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0432\u0430\u0436\u043d\u043e, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0440\u0430\u043d\u044c\u0448\u0435 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u043e\u0433\u0433\u0435\u0440\u0430.<\/li>\n<li><b>_logConfig<\/b> \u2014 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f NLog, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0430\u044f \u043d\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/github.com\/NLog\/NLog\/wiki\/Tutorial#configure-nlog-targets-for-output\" rel=\"nofollow\">NLog.config<\/a>, \u0430 \u043f\u0440\u044f\u043c\u043e \u0432 \u043a\u043e\u0434\u0435.<\/li>\n<\/ol>\n<p>  \u041a\u0430\u043a \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432 <a href=\"https:\/\/github.com\/NLog\/NLog\/wiki\/Tutorial#configure-nlog-targets-for-output\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>:  <\/p>\n<blockquote><p>NLog will only produce output if having configured one (or more) NLog targets.<\/p><\/blockquote>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043c\u0435\u0442\u043e\u0434\u044b \u0432 \u0440\u0435\u0433\u0438\u043e\u043d\u0435 <i>Target Methods<\/i> \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u201c\u0446\u0435\u043b\u0435\u0439\u201d:<\/p>\n<p>  <b>FileTarget<\/b> \u2014 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u043b\u043e\u0433\u0430 \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 log-\u0444\u0430\u0439\u043b?<\/b>                         <\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bn\/fz\/iw\/bnfziwxjz-gabqdfyv92qkab3bq.png\"><\/div>\n<\/p><\/div>\n<p>   <b>ColoredConsoleTarget<\/b> \u2014 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u00ab\u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0445\u00bb \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c (\u043f\u0440\u0438 \u0435\u0451 \u043d\u0430\u043b\u0438\u0447\u0438\u0438).<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0446\u0432\u0435\u0442\u043d\u0430\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u044c?<\/b>                         <\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/9p\/b6\/b0\/9pb6b0idaxhi4t46opp5wsxk6oa.png\"><\/div>\n<\/p><\/div>\n<p>   <b>DebuggerTarget<\/b> \u2014 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043b\u043e\u0433\u0433\u0435\u0440\u0430 \u0432 output-\u043e\u043a\u043d\u043e Visual Studio \u0438\u043b\u0438 \u0436\u0435 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u0435\u0431\u0430\u0433\u0433\u0435\u0440 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0441\u043e\u0431\u0449\u0435\u043d\u0438\u044f NLog \u0432 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0435?<\/b>                         <\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qo\/4n\/0j\/qo4n0jtkpdylzlxtwhg7xplmmwo.png\"><\/div>\n<\/p><\/div>\n<p>   <b>GraylogHttpTarget<\/b> \u2014 \u0446\u0435\u043b\u044c \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0442\u0430\u043c <a href=\"https:\/\/www.graylog.org\/\" rel=\"nofollow\">Graylog<\/a>.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 Graylog-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435?<\/b>                         <\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/l9\/9j\/vu\/l99jvuf49hfnuy1attfxuxpg6hu.png\"><\/div>\n<\/p><\/div>\n<p>  \u0412 \u0441\u0432\u043e\u0435\u0439 \u043f\u0435\u0440\u0432\u043e\u0439 <a href=\"https:\/\/habr.com\/ru\/post\/498396\/\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u044f \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Graylog. \u042f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0446\u0435\u043b\u0438. \u0418\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 Graylog \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e NLog-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0435\u043c \u043c\u043d\u0435 \u043b\u0438\u0447\u043d\u043e \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442.<\/p>\n<h4>\u041f\u0440\u043e Graylog (\u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e)<\/h4>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0435 \u0432\u043e\u0439\u0434\u0451\u0442. \u0421\u043a\u0430\u0436\u0443 \u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u043b \u0435\u0433\u043e \u0432 \u0434\u043e\u043a\u0435\u0440\u0435. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 <a href=\"https:\/\/docs.graylog.org\/en\/3.2\/pages\/installation\/docker.html\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>:<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0414\u0430\u0440\u044e \u0412\u0430\u043c \u0441\u0432\u043e\u0439 compose-\u0444\u0430\u0439\u043b<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"powershell\">version: '2' services:   # MongoDB: https:\/\/hub.docker.com\/_\/mongo\/   mongodb:     image: mongo:4     restart: always     volumes:     - mongo_data:\/data\/db:rw     - \/etc\/localtime:\/etc\/localtime     # Elasticsearch: https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/6.x\/docker.html   elasticsearch:     image: docker.elastic.co\/elasticsearch\/elasticsearch-oss:6.8.2     restart: always     volumes:     - es_data:\/usr\/share\/elasticsearch\/data:rw     - \/etc\/localtime:\/etc\/localtime     environment:       - http.host=0.0.0.0       - transport.host=localhost       - network.host=0.0.0.0       - &quot;ES_JAVA_OPTS=-Xms512m -Xmx512m&quot;     ulimits:       memlock:         soft: -1         hard: -1     mem_limit: 1g   # Graylog: https:\/\/hub.docker.com\/r\/graylog\/graylog\/   # Graylog: I want to have the lastest   graylog:     image: graylog\/graylog:3.2     restart: always     volumes:     - graylog_data:\/usr\/share\/graylog\/data\/journal:rw     - \/etc\/localtime:\/etc\/localtime # \u0411\u043e\u043d\u0443\u0441: \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0432 \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c. \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0438 \u043f\u0440\u043e \u044d\u0442\u043e \u043a\u0430\u043a-\u043d\u0438\u0431\u0443\u0434\u044c \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443     - \/home\/MYUSER\/graylog-data\/plugin\/graylog-plugin-telegram-notification-2.3.0.jar:\/usr\/share\/graylog\/plugin\/graylog-plugin-telegram-notification-2.3.0.jar     environment:       # CHANGE ME (must be at least 16 characters)!       - GRAYLOG_PASSWORD_SECRET=somepasswordpepper       # Password: MYPASSWORD       - GRAYLOG_ROOT_PASSWORD_SHA2=SHA2MYPASSWORDPLEASEINANYONLINESERVICE       - GRAYLOG_HTTP_BIND_ADDRESS=0.0.0.0:9999       - GRAYLOG_WEB_LISTEN_URI=http:\/\/my.ex.ipa.dr:9999\/       - GRAYLOG_HTTP_EXTERNAL_URI=http:\/\/my.ex.ipa.dr:9999\/       - GRAYLOG_HTTP_PUBLISH_URI=http:\/\/my.ex.ipa.dr:9999\/       - GRAYLOG_ROOT_TIMEZONE=Europe\/Moscow       - GRAYLOG_PLUGIN_DIR=plugin     links:       - mongodb:mongo       - elasticsearch     depends_on:       - mongodb       - elasticsearch     ports:       - 5044:5044       # Graylog web interface and REST API       - 9999:9999       # Syslog TCP       - 1514:1514       # Syslog UDP       - 1514:1514\/udp       # GELF TCP       - 12201:12201       # GELF UDP       - 12201:12201\/udp       #Volumes volumes:   mongo_data:     driver: local   es_data:     driver: local   graylog_data:     driver: local <\/code><\/pre>\n<\/div><\/div>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044e \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/docs.graylog.org\/en\/2.1\/pages\/getting_started\/config_input.html\" rel=\"nofollow\">\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438<\/a> \u00abInput&#8217;\u0430\u00bb \u0432 Graylog:<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Graylog \u0441\u043b\u0443\u0448\u0430\u0435\u0442 http \u0442\u0440\u0430\u0444\u0438\u043a \u043d\u0430 \u043f\u043e\u0440\u0442\u0435 12201<\/b>                         <\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5o\/ya\/vj\/5oyavjsjaxvtbwjdc9bae_jrcy8.png\" align=\"left\"><\/p>\n<blockquote><p>Graylog nodes accept data via inputs. Launch or terminate as many inputs as you want here.<\/p><\/blockquote>\n<p>  <s>\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0432 \u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u0441 <a href=\"https:\/\/my.web.adress.domain\" rel=\"nofollow\">my.web.adress.domain<\/a> \u043d\u0430 \u043f\u043e\u0440\u0442 12201 \u0441\u0432\u043e\u0435\u0439 \u0434\u043e\u043a\u0435\u0440-\u043c\u0430\u0448\u0438\u043d\u044b, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u043e\u0442\u043e\u0432\u0441\u044e\u0434\u0443 \u0441\u0431\u043e\u0449\u0438\u043a \u043b\u043e\u0433\u043e\u0432. \u041d\u043e \u044d\u0442\u043e \u0444\u0430\u043a\u0443\u043b\u044c\u0442\u0430\u0442\u0438\u0432 \u0438 \u043d\u0435 \u0432\u0441\u0435\u043c \u043d\u0443\u0436\u043d\u043e&#8230;<\/s>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h4>\u041f\u0440\u043e GELF<\/h4>\n<p>  <a href=\"https:\/\/docs.graylog.org\/en\/3.2\/pages\/gelf.html\" rel=\"nofollow\">GELF<\/a> \u2014 Graylog Extended Log Format. \u0424\u043e\u0440\u043c\u0430\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 Graylog.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 GELF \u043d\u0430 \u043d\u0435\u043a\u0438\u0439 url \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e <i>target&#8217;\u0430<\/i>. \u041e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <i>Integrations<\/i> <a href=\"https:\/\/nlog-project.org\/config\/#targets\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>  \u042f \u0436\u0435 \u0432\u044b\u0431\u0440\u0430\u043b <b><a href=\"https:\/\/github.com\/dustinchilson\/NLog.Targets.GraylogHttp\" rel=\"nofollow\">NLog.Targets.GraylogHttp<\/a><\/b>. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/www.nuget.org\/packages\/NLog.Targets.GraylogHttp\/1.0.0?_src=template\" rel=\"nofollow\">nuget<\/a> \u0438 \u0441\u043c\u043e\u0433 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <i>NLog.Targets.GraylogHttp.GraylogHttpTarget<\/i> \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u043b\u043e\u0433\u0433\u0435\u0440\u0430.<\/p>\n<p>  \u0421\u0430\u043c <a href=\"https:\/\/nlog-project.org\/config\/?tab=layouts\" rel=\"nofollow\"><i>layout<\/i><\/a> \u0434\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u044f \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b \u0434\u043e <a href=\"https:\/\/github.com\/NLog\/NLog\/wiki\/Message-Layout-Renderer\" rel=\"nofollow\"><i>message<\/i><\/a>, \u043d\u043e \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u043b <i>ContextProperties<\/i> \u0441\u0432\u043e\u0435\u0433\u043e <i>target&#8217;\u0430<\/i> \u0448\u0438\u0440\u043e\u043a\u0438\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439:<\/p>\n<pre><code class=\"cs\">new TargetPropertyWithContext()  { Name = &quot;someParamName1&quot;, Layout = &quot;someStringInfo&quot; }, new TargetPropertyWithContext()  { Name = &quot;someParamName2&quot;, Layout = &quot;someNLogLayoutRendered&quot; }, new TargetPropertyWithContext()  { Name = &quot;someParamName3&quot;, Layout = (string)SomeMethodThatGetsInfo() }<\/code><\/pre>\n<p>\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b \u044f\u0441\u0435\u043d \u043f\u0440\u0438\u043d\u0446\u0438\u043f: \u00ab\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f + \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00bb. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u00ab\u0434\u043e\u0431\u044b\u0432\u0430\u0442\u044c\u0441\u044f\u00bb \u043a\u0430\u043a\u0438\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0432\u043e\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438\u043b\u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u0434\u0438\u0441\u043a\u0435. Whatever\u2026<\/p>\n<h4>\u0411\u043e\u043d\u0443\u0441<\/h4>\n<p>  \u0411\u044b\u0442\u0443\u0435\u0442 \u043c\u043d\u0435\u043d\u0438\u0435 (\u0438 \u044f \u0435\u0433\u043e \u043d\u0435 \u043e\u0441\u043f\u0430\u0440\u0438\u0432\u0430\u044e), \u0447\u0442\u043e \u043b\u043e\u0433\u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438 \u043e\u0442\u043b\u043e\u0432\u0435 \u043e\u0448\u0438\u0431\u043e\u043a. \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <i>try\/catch<\/i> \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0438 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043e\u043f\u0440\u0430\u0432\u0434\u044b\u0432\u0430\u044e\u0442 \u0441\u0435\u0431\u044f. \u0421\u0430\u043c \u00ab\u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0448\u0438\u0431\u043a\u0438\u00bb \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439, \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043f\u0440\u0438 \u0435\u0451 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c. \u0423\u0434\u043e\u0431\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0414\u043b\u044f \u0441\u0435\u0431\u044f \u0432\u044b\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0411\u043e\u043d\u0443\u0441\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043a \u043a\u043b\u0430\u0441\u0441\u0443 \u043b\u043e\u0433\u0433\u0435\u0440\u0430 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0432 Graylog \u043f\u043e\u043b\u0435\u0439 \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432:<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">\/\/ \u041c\u0435\u0442\u043e\u0434-\u0431\u043e\u043d\u0443\u0441. \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0432 Graylog \u043f\u0435\u0440\u0435\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \t\t\/\/ \u041d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0441\u0440\u0435\u0434\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 objWithProps - \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0441 \u043d\u0435\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0438\u0445 \u0432 json (\u0447\u0442\u043e \u043f\u043e\u0447\u0442\u0438 GELF)... \t\tpublic static LogEventInfo GetLogEventWithProperties(LogLevel logLevel, string logName, string message, object objWithProps) \t\t{ \t\t\t\/\/ \u041c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u0430 \u043c\u043e\u0436\u043d\u043e \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \t\t\tif (string.IsNullOrEmpty(message)) \t\t\t{ \t\t\t\tmessage = objWithProps?.GetType()?.Name ?? &quot;custom_json_data&quot;; \t\t\t}  \t\t\tLogEventInfo e = new LogEventInfo(logLevel, logName, message);  \t\t\tobject logEventProperty = null; \t\t\t\/\/ \u0417\u0434\u0435\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u043b\u044f Newtonsoft.Json: https:\/\/www.newtonsoft.com\/json \t\t\tJsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings \t\t\t{ \t\t\t\tReferenceLoopHandling = ReferenceLoopHandling.Serialize, \t\t\t\tPreserveReferencesHandling = PreserveReferencesHandling.Objects, \t\t\t\tNullValueHandling = NullValueHandling.Include \t\t\t};  \t\t\ttry \t\t\t{ \t\t\t\t\/\/ \u0421 &quot;\u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438&quot; \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 (\u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438) \u044d\u0442\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043b\u0435\u0433\u043a\u043e... \t\t\t\tlogEventProperty = JsonConvert.SerializeObject(objWithProps, Formatting.Indented, jsonSerializerSettings); \t\t\t} \t\t\tcatch (Exception ex) \t\t\t{ \t\t\t\tDebug.Write(ex);  \t\t\t\ttry \t\t\t\t{ \t\t\t\t\t\/\/ ...\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442: \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u0434\u0430\u044e\u0442\u0441\u044f, ... \t\t\t\t\tIEnumerable&lt;PropertyInfo&gt; objProps = objWithProps?.GetType()?.GetProperties()?.Where(p =&gt; p?.GetGetMethod()?.GetParameters()?.Length == 0);  \t\t\t\t\tif (objProps?.Any() == true) \t\t\t\t\t{ \t\t\t\t\t\t\/\/ ...\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c,... \t\t\t\t\t\tDictionary&lt;string, string&gt; objPropsDict = \t\t\t\t\t\t\tobjProps \t\t\t\t\t\t\t.ToDictionary( \t\t\t\t\t\t\t\tx =&gt; x?.Name, \t\t\t\t\t\t\t\tx =&gt; \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\tstring rezVal = string.Empty; \t\t\t\t\t\t\t\t\ttry \t\t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\trezVal = x?.GetValue(objWithProps, null)?.ToString(); \t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\tcatch (Exception ex0) \t\t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\tDebug.Write(ex0); \t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\treturn rezVal; \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t)? \t\t\t\t\t\t\t.OrderBy(x =&gt; x.Key)? \t\t\t\t\t\t\t.ToDictionary(obj =&gt; obj.Key, obj =&gt; obj.Value); \t\t\t\t\t\t\/\/ ...\u0438 \u0441\u043d\u043e\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c Newtonsoft.Json \t\t\t\t\t\tlogEventProperty = JsonConvert.SerializeObject(objPropsDict, Formatting.Indented, jsonSerializerSettings); \t\t\t\t\t} \t\t\t\t} \t\t\t\tcatch (Exception ex1) \t\t\t\t{ \t\t\t\t\tDebug.Write(ex1); \t\t\t\t} \t\t\t} \t\t\t\/\/ \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 json-\u0441\u0442\u0440\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e Graylog \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442 \u0432 \u043f\u043e\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u0430. \t\t\te.Properties[&quot;custom_json_data&quot;] = logEventProperty; \t\t\treturn e; \t\t} <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">log.Debug(BimlibLogger.GetLogEventWithProperties(LogLevel.Debug, log.Name, $&quot;Got the task&quot;, message));<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 Graylog?<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u041f\u043e\u043b\u0435 <i>exeption_json_data<\/i> \u2014 <i>exception<\/i>, \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0451\u043d\u043d\u044b\u0439 \u0432 json.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/q0\/fw\/tz\/q0fwtze_zbep1dbbwzlqecz2e3q.png\"><\/p>\n<p>  \u0422\u043e\u0442 \u0436\u0435 <i>exception<\/i>, \u0440\u0430\u0437\u0431\u0438\u0442\u044b\u0439 \u043d\u0430 \u043f\u043e\u043b\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/m3\/7b\/km\/m37bkmo_szukwtunyvkxukrw9hm.png\">  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h4>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h4>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0438 \u0440\u0430\u0437\u0443\u043c\u043d\u043e\u0433\u043e \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0432 \u0442\u0435\u043b\u043e \u043a\u043e\u0434\u0430 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043b\u043e\u0433\u0433\u0435\u0440\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0431\u043e\u0440 \u043b\u043e\u0433\u043e\u0432 \u0441 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0434\u043b\u044f \u0438\u0445 \u0447\u0442\u0435\u043d\u0438\u044f, \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430, \u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u0418\u043c\u0435\u0435\u043c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0439 \u043e\u0431 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u0432 \u043b\u043e\u0433\u0430\u0445.<br \/>  \u0422\u0430\u043a\u0436\u0435 \u043d\u0438\u043a\u0443\u0434\u0430 \u043d\u0435 \u0434\u0435\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 log-\u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b. \u042d\u0442\u043e \u043d\u0435 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442 \u0438 \u043d\u0435 \u0437\u0430\u043c\u0435\u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430. \u041d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u00ab\u043c\u043e\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 100+ \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u0445 \u0432 3+ \u0438\u043d\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0430\u0445 \u0438 \u0432\u0434\u0440\u0443\u0433 \u0433\u0434\u0435-\u0442\u043e \u043f\u043e\u043b\u043e\u043c\u0430\u043b\u043e\u0441\u044c\u00bb \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0433\u0447\u0435 \u0438 \u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<h4>\u042d\u0442\u043e \u0432\u0441\u0451?<\/h4>\n<p>   \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b \u0432\u0441\u0451, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u043d\u043e\u0433\u043e \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0413\u043e\u0442\u043e\u0432 \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u0432\u0435\u0442\u044b.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0447\u043b\u0438. \u0423\u0432\u0438\u0434\u0438\u043c\u0441\u044f \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/498978\/\"> https:\/\/habr.com\/ru\/post\/498978\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/498978\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_y\/ee\/iu\/_yeeiuyxudo9su5z6rjaloimftg.jpeg\"><br \/>  <a href=\"https:\/\/michaelscodingspot.com\/logging-in-dotnet\/\" rel=\"nofollow\">\u041a\u0414\u041f\u0412<\/a><\/p>\n<p>  \u0425\u0430\u0431\u0440, \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e!<\/p>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043d\u0438\u0436\u0435 \u043d\u0438 \u0432 \u043a\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 <i>tutorial<\/i> \u0438\u043b\u0438 <i>best practice<\/i>. \u042f \u0440\u0435\u0448\u0438\u043b \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0432 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0435.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0449\u0443\u0449\u0438\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e <a href=\"https:\/\/ru.wiktionary.org\/wiki\/%D0%BB%D0%BE%D0%B3%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5\" rel=\"nofollow\">\u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<\/a> \u043f\u043e\u0447\u0435\u0440\u043f\u043d\u0443\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0438\u043b\u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u043b\u0438\u0431\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u0418, \u0441\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439, \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0444\u0438\u0434\u0431\u0435\u043a \u043e\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430. \u042d\u0442\u043e \u0434\u0430\u0451\u0442 \u0448\u0430\u043d\u0441 \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043b\u0443\u0447\u0448\u0435.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-302478","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/302478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=302478"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/302478\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=302478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=302478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=302478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}