"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[7365],{9740:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>l,metadata:()=>d,toc:()=>g});var i=r(5893),s=r(1151),o=r(510),t=r(4996);const l={id:"logging",title:"18. \u65e5\u5fd7\u8bb0\u5f55",sidebar_label:"18. \u65e5\u5fd7\u8bb0\u5f55"},c=void 0,d={id:"logging",title:"18. \u65e5\u5fd7\u8bb0\u5f55",description:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7",source:"@site/docs/logging.mdx",sourceDirName:".",slug:"/logging",permalink:"/docs/logging",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/logging.mdx",tags:[],version:"current",lastUpdatedBy:"\u767e\u5c0f\u50e7",lastUpdatedAt:1699327093,formattedLastUpdatedAt:"Nov 7, 2023",frontMatter:{id:"logging",title:"18. \u65e5\u5fd7\u8bb0\u5f55",sidebar_label:"18. \u65e5\u5fd7\u8bb0\u5f55"},sidebar:"docs",previous:{title:"17. \u89c6\u56fe/\u6a21\u677f\u5f15\u64ce",permalink:"/docs/view-engine"},next:{title:"19. \u8fdc\u7a0b\u8bf7\u6c42 (HttpClient)",permalink:"/docs/http"}},a={},g=[{value:"18.1 \u5173\u4e8e\u65e5\u5fd7",id:"181-\u5173\u4e8e\u65e5\u5fd7",level:2},{value:"18.2 \u65e5\u5fd7\u4f5c\u7528",id:"182-\u65e5\u5fd7\u4f5c\u7528",level:2},{value:"18.3 \u65e5\u5fd7\u7ea7\u522b",id:"183-\u65e5\u5fd7\u7ea7\u522b",level:2},{value:"18.4 \u5982\u4f55\u4f7f\u7528",id:"184-\u5982\u4f55\u4f7f\u7528",level:2},{value:"18.4.1 ILogger<T>
\u6cdb\u578b\u65b9\u5f0f",id:"1841-iloggert-\u6cdb\u578b\u65b9\u5f0f",level:3},{value:"18.4.2 ILoggerFactory
\u5de5\u5382\u65b9\u5f0f",id:"1842-iloggerfactory-\u5de5\u5382\u65b9\u5f0f",level:3},{value:"18.4.3 Log
\u9759\u6001\u7c7b\u65b9\u5f0f",id:"1843-log-\u9759\u6001\u7c7b\u65b9\u5f0f",level:3},{value:"18.4.4 \u61d2\u4eba\u6a21\u5f0f
\ud83d\ude01",id:"1844-\u61d2\u4eba\u6a21\u5f0f-",level:3},{value:"18.5 \u8f93\u51fa\u5230\u63a7\u5236\u53f0",id:"185-\u8f93\u51fa\u5230\u63a7\u5236\u53f0",level:2},{value:"18.5.1 \u65e5\u5fd7\u8fc7\u6ee4/\u7b5b\u9009",id:"1851-\u65e5\u5fd7\u8fc7\u6ee4\u7b5b\u9009",level:3},{value:"18.5.2 \u65e5\u5fd7\u6807\u51c6\u5316\uff08\u7f8e\u5316\uff09\u6a21\u677f",id:"1852-\u65e5\u5fd7\u6807\u51c6\u5316\u7f8e\u5316\u6a21\u677f",level:3},{value:"18.5.3 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u6a21\u677f",id:"1853-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u6a21\u677f",level:3},{value:"18.5.4 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f93\u51fa\u65f6\u95f4\u683c\u5f0f",id:"1854-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f93\u51fa\u65f6\u95f4\u683c\u5f0f",level:3},{value:"18.5.5 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f93\u51fa\u7a0b\u5e8f",id:"1855-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f93\u51fa\u7a0b\u5e8f",level:3},{value:"18.5.6 \u8f93\u51fa\u65e5\u5fd7 TraceId/HttpContextId
",id:"1856-\u8f93\u51fa\u65e5\u5fd7-traceidhttpcontextid",level:3},{value:"18.5.7 \u8f93\u51fa\u65e5\u5fd7 \u7a0b\u5e8f\u96c6/\u7c7b\u578b/\u65b9\u6cd5
",id:"1857-\u8f93\u51fa\u65e5\u5fd7-\u7a0b\u5e8f\u96c6\u7c7b\u578b\u65b9\u6cd5",level:3},{value:"18.6 \u8f93\u51fa\u5230\u6587\u4ef6",id:"186-\u8f93\u51fa\u5230\u6587\u4ef6",level:2},{value:"18.6.1 \u57fa\u7840\u4f7f\u7528",id:"1861-\u57fa\u7840\u4f7f\u7528",level:3},{value:"18.6.2 \u4ece\u914d\u7f6e\u6587\u4ef6\u8bfb\u53d6\u914d\u7f6e",id:"1862-\u4ece\u914d\u7f6e\u6587\u4ef6\u8bfb\u53d6\u914d\u7f6e",level:3},{value:"18.6.3 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u6587\u4ef6\u540d\u89c4\u5219",id:"1863-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u6587\u4ef6\u540d\u89c4\u5219",level:3},{value:"18.6.4 \u65e5\u5fd7\u8fc7\u6ee4\u5668/\u7b5b\u9009\u5668",id:"1864-\u65e5\u5fd7\u8fc7\u6ee4\u5668\u7b5b\u9009\u5668",level:3},{value:"18.6.5 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u6a21\u677f",id:"1865-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u6a21\u677f",level:3},{value:"18.6.6 \u65e5\u5fd7\u5199\u5165\u5931\u8d25\u5904\u7406",id:"1866-\u65e5\u5fd7\u5199\u5165\u5931\u8d25\u5904\u7406",level:3},{value:"18.6.7 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f93\u51fa\u65f6\u95f4\u683c\u5f0f",id:"1867-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f93\u51fa\u65f6\u95f4\u683c\u5f0f",level:3},{value:"18.6.8 \u8f93\u51fa\u65e5\u5fd7 TraceId/HttpContextId
",id:"1868-\u8f93\u51fa\u65e5\u5fd7-traceidhttpcontextid",level:3},{value:"18.6.9 \u8f93\u51fa\u65e5\u5fd7 \u7a0b\u5e8f\u96c6/\u7c7b\u578b/\u65b9\u6cd5
",id:"1869-\u8f93\u51fa\u65e5\u5fd7-\u7a0b\u5e8f\u96c6\u7c7b\u578b\u65b9\u6cd5",level:3},{value:"18.7 \u8f93\u51fa\u5230\u6570\u636e\u5e93/\u5176\u4ed6\u5b58\u50a8\u4ecb\u8d28",id:"187-\u8f93\u51fa\u5230\u6570\u636e\u5e93\u5176\u4ed6\u5b58\u50a8\u4ecb\u8d28",level:2},{value:"18.7.1 \u57fa\u7840\u4f7f\u7528",id:"1871-\u57fa\u7840\u4f7f\u7528",level:3},{value:"18.7.2 \u4ece\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bfb\u53d6",id:"1872-\u4ece\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bfb\u53d6",level:3},{value:"18.7.3 \u65e5\u5fd7\u8fc7\u6ee4\u5668/\u7b5b\u9009\u5668",id:"1873-\u65e5\u5fd7\u8fc7\u6ee4\u5668\u7b5b\u9009\u5668",level:3},{value:"18.7.4 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u6a21\u677f",id:"1874-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u6a21\u677f",level:3},{value:"18.7.5 \u65e5\u5fd7\u5199\u5165\u5931\u8d25\u5904\u7406",id:"1875-\u65e5\u5fd7\u5199\u5165\u5931\u8d25\u5904\u7406",level:3},{value:"18.7.6 \u8f93\u51fa\u65e5\u5fd7 TraceId/HttpContextId
",id:"1876-\u8f93\u51fa\u65e5\u5fd7-traceidhttpcontextid",level:3},{value:"18.7.7 \u8f93\u51fa\u65e5\u5fd7 \u7a0b\u5e8f\u96c6/\u7c7b\u578b/\u65b9\u6cd5
",id:"1877-\u8f93\u51fa\u65e5\u5fd7-\u7a0b\u5e8f\u96c6\u7c7b\u578b\u65b9\u6cd5",level:3},{value:"18.7.8 \u5173\u4e8e\u9ad8\u9891\u5199\u5165\u5b58\u50a8\u4ecb\u8d28",id:"1878-\u5173\u4e8e\u9ad8\u9891\u5199\u5165\u5b58\u50a8\u4ecb\u8d28",level:3},{value:"18.7.9 \u5173\u4e8e\u6570\u636e\u5e93\u65e5\u5fd7\u5faa\u73af\u8f93\u51fa\u65e5\u5fd7",id:"1879-\u5173\u4e8e\u6570\u636e\u5e93\u65e5\u5fd7\u5faa\u73af\u8f93\u51fa\u65e5\u5fd7",level:3},{value:"18.8 \u6dfb\u52a0\u65e5\u5fd7\u63d0\u4f9b\u5668\u65b9\u5f0f",id:"188-\u6dfb\u52a0\u65e5\u5fd7\u63d0\u4f9b\u5668\u65b9\u5f0f",level:2},{value:"18.8.1 LoggerFactory
\u65b9\u5f0f",id:"1881-loggerfactory-\u65b9\u5f0f",level:3},{value:"18.8.2 ILoggingBuilder
\u65b9\u5f0f",id:"1882-iloggingbuilder-\u65b9\u5f0f",level:3},{value:"18.9 \u8bb0\u5f55\u8bf7\u6c42\u65e5\u5fd7",id:"189-\u8bb0\u5f55\u8bf7\u6c42\u65e5\u5fd7",level:2},{value:"18.10 Debug
\u548c Trace
\u9ed8\u8ba4\u4e0d\u8f93\u51fa\u95ee\u9898",id:"1810-debug-\u548c-trace-\u9ed8\u8ba4\u4e0d\u8f93\u51fa\u95ee\u9898",level:2},{value:"18.11 [LoggingMonitor]
\u76d1\u542c\u65e5\u5fd7",id:"1811-loggingmonitor-\u76d1\u542c\u65e5\u5fd7",level:2},{value:"18.11.1 \u7279\u6027\u914d\u7f6e",id:"18111-\u7279\u6027\u914d\u7f6e",level:3},{value:"18.11.2 \u5168\u5c40\u914d\u7f6e",id:"18112-\u5168\u5c40\u914d\u7f6e",level:3},{value:"18.11.3 \u66f4\u591a\u914d\u7f6e",id:"18113-\u66f4\u591a\u914d\u7f6e",level:3},{value:"18.11.4 JSON
\u683c\u5f0f",id:"18114-json-\u683c\u5f0f",level:3},{value:"18.11.5 \u5168\u5c40\u8fc7\u6ee4 WriteFilter
",id:"18115-\u5168\u5c40\u8fc7\u6ee4-writefilter",level:3},{value:"18.11.6 \u8f93\u51fa JSON
\u652f\u6301\u5ffd\u7565\u5c5e\u6027\u540d\u6216\u5c5e\u6027\u7c7b\u578b",id:"18116-\u8f93\u51fa-json-\u652f\u6301\u5ffd\u7565\u5c5e\u6027\u540d\u6216\u5c5e\u6027\u7c7b\u578b",level:3},{value:"18.11.7 \u5c06 LoggingMonitor
\u5199\u5165\u6570\u636e\u5e93",id:"18117-\u5c06-loggingmonitor-\u5199\u5165\u6570\u636e\u5e93",level:3},{value:"18.11.8 \u652f\u6301 [DisplayName]
\u7279\u6027",id:"18118-\u652f\u6301-displayname-\u7279\u6027",level:3},{value:"18.11.9 \u8f93\u51fa\u5e8f\u5217\u5316\u952e\u683c\u5f0f\u914d\u7f6e\uff08\u5c5e\u6027\u5927\u5c0f\u5199\uff09",id:"18119-\u8f93\u51fa\u5e8f\u5217\u5316\u952e\u683c\u5f0f\u914d\u7f6e\u5c5e\u6027\u5927\u5c0f\u5199",level:3},{value:"18.11.10 \u8df3\u8fc7\u7279\u5b9a\u53c2\u6570\u8bb0\u5f55",id:"181110-\u8df3\u8fc7\u7279\u5b9a\u53c2\u6570\u8bb0\u5f55",level:3},{value:"18.12 \u6253\u5370\u65e5\u5fd7\u5230 Swagger
\u4e2d",id:"1812-\u6253\u5370\u65e5\u5fd7\u5230-swagger-\u4e2d",level:2},{value:"18.13 \u9759\u6001 Default()
\u65b9\u5f0f\u6784\u5efa",id:"1813-\u9759\u6001-default-\u65b9\u5f0f\u6784\u5efa",level:2},{value:"18.14 \u89c4\u8303\u65e5\u5fd7\u6a21\u677f",id:"1814-\u89c4\u8303\u65e5\u5fd7\u6a21\u677f",level:2},{value:"18.15 \u65e5\u5fd7\u4e0a\u4e0b\u6587",id:"1815-\u65e5\u5fd7\u4e0a\u4e0b\u6587",level:2},{value:"18.15.1 \u6dfb\u52a0\u4e0a\u4e0b\u6587\u6570\u636e",id:"18151-\u6dfb\u52a0\u4e0a\u4e0b\u6587\u6570\u636e",level:3},{value:"18.15.2 \u8bfb\u53d6\u4e0a\u4e0b\u6587\u6570\u636e",id:"18152-\u8bfb\u53d6\u4e0a\u4e0b\u6587\u6570\u636e",level:3},{value:"18.15.3 \u65e5\u5fd7\u4e0a\u4e0b\u6587\u6570\u636e\u5171\u4eab",id:"18153-\u65e5\u5fd7\u4e0a\u4e0b\u6587\u6570\u636e\u5171\u4eab",level:3},{value:"18.16 \u5173\u95ed .NET Core
\u5e95\u5c42\u65e5\u5fd7",id:"1816-\u5173\u95ed-net-core-\u5e95\u5c42\u65e5\u5fd7",level:2},{value:"18.17 \u5168\u5c40\u65e5\u5fd7\u8fc7\u6ee4/\u7b5b\u9009",id:"1817-\u5168\u5c40\u65e5\u5fd7\u8fc7\u6ee4\u7b5b\u9009",level:2},{value:"18.18 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"1818-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function h(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",hr:"hr",li:"li",mdxAdmonitionTitle:"mdxAdmonitionTitle",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,s.a)(),...e.components},{Details:r}=n;return r||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Details",!0),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(r,{children:[(0,i.jsx)("summary",{children:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7"}),(0,i.jsx)("div",{children:(0,i.jsxs)("div",{children:[(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u65b0\u7279\u6027"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u65b0\u589e"})," \u63a7\u5236\u53f0\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"AddConsoleFormatter"})," \u670d\u52a1\u652f\u6301 ",(0,i.jsx)(n.code,{children:"WriteFilter"})," \u5c5e\u6027\u8fc7\u6ee4 ",(0,i.jsx)("sup",{children:"4.8.8.52"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.11.07"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/516acb455e9eae477cfce1052442fc30c9c4dfb9",children:"516acb4"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u65b0\u589e"})," \u76d1\u542c\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u652f\u6301\u6253\u5370\u8f93\u51fa ",(0,i.jsx)(n.code,{children:"requestHeaders"})," \u8bf7\u6c42\u5934\u4fe1\u606f ",(0,i.jsx)("sup",{children:"4.8.8.50"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.10.27"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I8BHM3",children:"#I8BHM3"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u65b0\u589e"})," \u76d1\u542c\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u652f\u6301\u914d\u7f6e\u65e5\u5fd7\u8f93\u51fa\u7ea7\u522b ",(0,i.jsx)("sup",{children:"4.8.8.41"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.08.25"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I7SRTP",children:"#I7SRTP"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u65b0\u589e"})," ",(0,i.jsxs)(n.strong,{children:["\u76d1\u542c\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u652f\u6301 ",(0,i.jsx)(n.code,{children:"Razor Pages"})]})," ",(0,i.jsx)("sup",{children:"4.8.8.16"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.05.15"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I7332C",children:"#I7332C"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u65b0\u589e"})," ",(0,i.jsxs)(n.strong,{children:["\u65e5\u5fd7\u914d\u7f6e ",(0,i.jsx)(n.code,{children:"WithStackFrame"}),"\uff0c\u53ef\u63a7\u5236\u662f\u5426\u8f93\u51fa\u4ea7\u751f\u65e5\u5fd7\u7684\u7a0b\u5e8f\u96c6\uff0c\u7c7b\u578b\u548c\u5177\u4f53\u65b9\u6cd5"]})," ",(0,i.jsx)("sup",{children:"4.8.7.16"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.03.19"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/5ad6ae241d1798ad788e42569a15d68686db4fa1",children:"5ad6ae2"})]}),"\n"]}),"\n"]}),"\n"]}),(0,i.jsxs)(r,{style:{marginLeft:50},children:[(0,i.jsx)("summary",{children:"\u67e5\u770b\u53d8\u5316"}),(0,i.jsxs)("div",{children:[(0,i.jsxs)(n.p,{children:["\u542f\u7528 ",(0,i.jsx)(n.code,{children:"WithStackFrame"})," \u65e5\u5fd7\u914d\u7f6e\u540e\uff0c\u53ef\u8f93\u51fa\u7a0b\u5e8f\u96c6\uff0c\u7c7b\u578b\uff0c\u65b9\u6cd5\u7b7e\u540d\u4fe1\u606f\u3002"]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {4,10,16}",children:"// \u63a7\u5236\u53f0\u65e5\u5fd7\r\nservices.AddConsoleFormatter(options =>\r\n{\r\n options.WithStackFrame = true;\r\n});\r\n\r\n// \u6587\u4ef6\u65e5\u5fd7\r\nservices.AddFileLogging(options =>\r\n{\r\n options.WithStackFrame = true;\r\n});\r\n\r\n// \u6570\u636e\u5e93\u65e5\u5fd7\r\nservices.AddDatabaseLogging(options =>\r\n{\r\n options.WithStackFrame = true;\r\n});\n"})}),(0,i.jsx)(n.p,{children:"\u65e5\u5fd7\u8f93\u51fa\u5982\u4e0b\uff1a"}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers {2,5,8,11,14,17,20}",children:"info: 2023-03-17 18:25:06.7988349 +08:00 \u661f\u671f\u4e94 L System.Logging.EventBusService[0] #1\r\n [Furion.dll] async Task Furion.EventBus.EventBusHostedService.ExecuteAsync(CancellationToken stoppingToken)\r\n EventBus hosted service is running.\r\ninfo: 2023-03-17 18:25:08.1393952 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[14] #1\r\n [System.Private.CoreLib.dll] void System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start(ref TStateMachine stateMachine)\r\n Now listening on: https://localhost:5001\r\ninfo: 2023-03-17 18:25:08.1620391 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[14] #1\r\n [System.Private.CoreLib.dll] void System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start(ref TStateMachine stateMachine)\r\n Now listening on: http://localhost:5000\r\ninfo: 2023-03-17 18:25:08.1972456 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[0] #1\r\n [Microsoft.Extensions.Hosting.dll] void Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted()\r\n Application started. Press Ctrl+C to shut down.\r\ninfo: 2023-03-17 18:25:08.2456579 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[0] #1\r\n [Microsoft.Extensions.Hosting.dll] void Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted()\r\n Hosting environment: Development\r\ninfo: 2023-03-17 18:25:08.2746134 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[0] #1\r\n [System.Private.CoreLib.dll] void System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(bool throwOnFirstException)\r\n Content root path: D:\\Workplaces\\OpenSources\\Furion\\samples\\Furion.Web.Entry\r\ninfo: 2023-03-17 18:25:18.1917784 +08:00 \u661f\u671f\u4e94 L Furion.Application.TestLoggerServices[0] #16\r\n [Furion.Application.dll] void Furion.Application.TestLoggerServices.\u6d4b\u8bd5\u65e5\u5fd7()\r\n \u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 20\n"})}),(0,i.jsx)(n.p,{children:"\u8fd9\u6837\u5c31\u6e05\u695a\u5730\u77e5\u9053\u65e5\u5fd7\u662f\u54ea\u4e2a\u7a0b\u5e8f\u96c6\u3001\u54ea\u4e2a\u7c7b\u578b\u3001\u54ea\u4e2a\u65b9\u6cd5\u8f93\u51fa\u7684\u4e86\u3002"})]})]}),(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u65b0\u589e"})," \u5ba1\u8ba1\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u652f\u6301\u5bf9\u53c2\u6570\u8d34 ",(0,i.jsx)(n.code,{children:"[SuppressMonitor]"})," \u7279\u6027\u8df3\u8fc7\u8bb0\u5f55 ",(0,i.jsx)("sup",{children:"4.8.7.3"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.03.01"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I6IVGW",children:"#I6IVGW"})]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u65b0\u589e"})," \u5ba1\u8ba1\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u76d1\u542c ",(0,i.jsx)(n.code,{children:"TraceId"}),"\u3001",(0,i.jsx)(n.code,{children:"ThreadId"}),"\u3001",(0,i.jsx)(n.code,{children:"Accept-Language"})," ",(0,i.jsx)("sup",{children:"4.8.7.1"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.02.27"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/df35201622f4d908ab423baff27caef856a23527",children:"df35201"})]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u65b0\u589e"})," \u5ba1\u8ba1\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u652f\u6301\u914d\u7f6e\u5e8f\u5217\u5316\u5c5e\u6027\u547d\u540d\u89c4\u5219 ",(0,i.jsx)("sup",{children:"4.8.6.12"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.02.21"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I6GPUP",children:"#I6GPUP"})]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u65b0\u589e"})," \u5ba1\u8ba1\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u652f\u6301 ",(0,i.jsx)(n.code,{children:"[DisplayName]"})," \u7279\u6027\u89e3\u6790\u548c ",(0,i.jsx)(n.code,{children:"Title"})," \u5c5e\u6027\u8bb0\u5f55 ",(0,i.jsx)("sup",{children:"4.8.5.10"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.02.07"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I6DHMF",children:"#I6DHMF"})]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u65b0\u589e"})," \u5ba1\u8ba1\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u8bb0\u5f55 ",(0,i.jsx)(n.code,{children:"HTTP"})," \u54cd\u5e94\u72b6\u6001\u7801 ",(0,i.jsx)("sup",{children:"4.8.5.2"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.01.30"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/abb4cbdab9f45f53cad8468352d1c14ac8c54b42",children:"abb4cbd"})]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u7a81\u7834\u6027\u53d8\u5316"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u8c03\u6574"})," ",(0,i.jsxs)(n.strong,{children:["\u76d1\u542c\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"WriteFilter"})," \u548c ",(0,i.jsx)(n.code,{children:"ConfigureLogger"})," \u7684 ",(0,i.jsx)(n.code,{children:"ActionExecutingContext"})," \u548c ",(0,i.jsx)(n.code,{children:"ActionExecutedContext"})," \u7c7b\u578b\u4e3a ",(0,i.jsx)(n.code,{children:"FilterContext"})]})," ",(0,i.jsx)("sup",{children:"4.8.8.16"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.05.15"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I7332C",children:"#I7332C"})]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u95ee\u9898\u4fee\u590d"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u4fee\u590d"})," \u5ba1\u8ba1\u65e5\u5fd7\u4e0d\u652f\u6301 ",(0,i.jsx)(n.code,{children:"dynamic/JsonElement"})," \u5e8f\u5217\u5316\u95ee\u9898 ",(0,i.jsx)("sup",{children:"4.8.8.45"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.09.29"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I84SD5",children:"#I84SD5"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u4fee\u590d"})," \u5ba1\u8ba1\u65e5\u5fd7\u89e3\u6790 ",(0,i.jsx)(n.code,{children:"DateTime"})," \u7c7b\u578b\u53c2\u6570\u4e0d\u662f\u672c\u5730\u65f6\u95f4\u95ee\u9898 ",(0,i.jsx)("sup",{children:"4.8.8.33"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.06.29"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I7GW32",children:"#I7GW32"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u4fee\u590d"})," ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u6253\u5370\u6cdb\u578b\u7c7b\u578b\u5982\u679c\u5b58\u5728\u591a\u4e2a\u6cdb\u578b\u53c2\u6570\u95ee\u9898 ",(0,i.jsx)("sup",{children:"4.8.8.8"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.05.04"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/8d9cb7457c736a91bc428ce61da553df40107960",children:"8d9cb74"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u4fee\u590d"})," \u65e5\u5fd7\u8f93\u51fa ",(0,i.jsx)(n.code,{children:"JSON"})," \u683c\u5f0f\u6f0f\u6389\u4e86 ",(0,i.jsx)(n.code,{children:"UseUtcTimestamp"})," \u548c ",(0,i.jsx)(n.code,{children:"TraceId"})," \u952e\u503c ",(0,i.jsx)("sup",{children:"4.8.7.21"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.03.27"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/5c90e652b20dc36450ea0322fe6d22cd2a39d5e6",children:"5c90e65"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u4fee\u590d"})," \u65e5\u5fd7\u6d88\u606f\u6ca1\u6709\u5904\u7406 ",(0,i.jsx)(n.code,{children:"\\n"})," \u6362\u884c\u7b26\u5bf9\u9f50\u95ee\u9898 ",(0,i.jsx)("sup",{children:"4.8.7.6"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.03.10"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/759bcc5dca09017f37a5be6ad2beefad33214fae",children:"759bcc5"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u4fee\u590d"})," \u5ba1\u8ba1\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u5bf9\u7279\u5b9a\u53c2\u6570\u8d34\u6709 ",(0,i.jsx)(n.code,{children:"[FromServices]"})," \u7279\u6027\u4f9d\u65e7\u8bb0\u5f55\u95ee\u9898 ",(0,i.jsx)("sup",{children:"4.8.7.3"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.03.01"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/17b134efd82baa31bff6a0e763f93839c767c364",children:"17b134e"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u4fee\u590d"})," \u5728\u6570\u636e\u5e93\u65e5\u5fd7\u7684 ",(0,i.jsx)(n.code,{children:"IDatabaseLoggingWriter"})," \u5b9e\u73b0\u7c7b\u4e2d\u4f9d\u8d56\u6ce8\u5165 ",(0,i.jsx)(n.code,{children:"ILogger<>"})," \u5bfc\u81f4\u6b7b\u5faa\u73af ",(0,i.jsx)("sup",{children:"4.8.5.4"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.02.01"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I6C6QU",children:"#I6C6QU"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u4fee\u590d"})," \u6570\u636e\u5e93\u65e5\u5fd7\u63d0\u4f9b\u7a0b\u5e8f\u5728\u5e94\u7528\u7a0b\u5e8f\u7ec8\u6b62\u65f6\u51fa\u73b0\u7a7a\u5f02\u5e38\u95ee\u9898 ",(0,i.jsx)("sup",{children:"4.8.5"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.01.28"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I6AZ8Y",children:"#I6AZ8Y"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u4fee\u590d"})," \u6570\u636e\u5e93\u65e5\u5fd7\u6ce8\u518c\u5728\u4e00\u4e9b\u7279\u6b8a\u60c5\u51b5\u4e0b\u4e22\u5931\u65e5\u5fd7\u4e0a\u4e0b\u6587\u95ee\u9898 ",(0,i.jsx)("sup",{children:"4.8.4.6"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.01.04"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I68PDF",children:"#I68PDF"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u4fee\u590d"})," \u5728\u7c7b\u4e2d\u8d34 ",(0,i.jsx)(n.code,{children:"[SuppressMonitor]"})," \u7279\u6027\u4f46 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u4f9d\u7136\u8f93\u51fa\u95ee\u9898 ",(0,i.jsx)("sup",{children:"4.8.4"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2022.12.30"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I6882I",children:"#I6882I"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u4fee\u590d"})," ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u5e8f\u5217\u5316 ",(0,i.jsx)(n.code,{children:"IQueryable<>"})," \u6216 ",(0,i.jsx)(n.code,{children:"OData"})," \u8fd4\u56de\u503c\u7c7b\u578b\u51fa\u73b0\u6b7b\u5faa\u73af\u95ee\u9898 ",(0,i.jsx)("sup",{children:"4.8.3.4"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2022.12.10"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/7e8c9d0e3910c4d0cfa18a7a15cbe8415d34dd66",children:"7e8c9d0"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u4fee\u590d"})," ",(0,i.jsxs)(n.strong,{children:["\u901a\u8fc7 ",(0,i.jsx)(n.code,{children:"Ctrl + C"})," \u7ec8\u6b62\u5e94\u7528\u7a0b\u5e8f\u540e\u83b7\u53d6 ",(0,i.jsx)(n.code,{children:"TraceId"})," \u51fa\u73b0\u5bf9\u8c61\u5df2\u91ca\u653e\u5f02\u5e38"]})," ",(0,i.jsx)("sup",{children:"4.8.1.12"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2022.12.07"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/55c3e4942b1f89e0548d4cf90453937ba4ea512c",children:"55c3e49"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u4fee\u590d"})," \u65e5\u5fd7\u6a21\u5757\u56e0 ",(0,i.jsx)(n.code,{children:"v4.8.0+"})," \u7248\u672c\u5bfc\u81f4\u5199\u5165\u6570\u636e\u5e93\u65e5\u5fd7\u7a7a\u5f02\u5e38\u95ee\u9898 ",(0,i.jsx)("sup",{children:"4.8.2.1"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2022.11.28"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/8d9d72b5bfcb8dfc730462c9313266ec0661d561",children:"8d9d72b"})]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u5176\u4ed6\u66f4\u6539"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u8c03\u6574"})," \u5ba1\u8ba1\u65e5\u5fd7\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u8fd4\u56de\u503c\u6cdb\u578b\u5b57\u7b26\u4e32\u663e\u793a\u683c\u5f0f ",(0,i.jsx)("sup",{children:"4.8.7.1"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2023.02.27"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/df35201622f4d908ab423baff27caef856a23527",children:"df35201"})]}),"\n",(0,i.jsxs)(n.li,{children:["\xa0",(0,i.jsx)(o.Z,{children:"\u8c03\u6574"})," ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u89e3\u6790\u6388\u6743\u903b\u8f91\uff0c\u5982\u679c\u63a5\u53e3\u672a\u6388\u6743\u5219\u4e0d\u6253\u5370\u6388\u6743\u4fe1\u606f ",(0,i.jsx)("sup",{children:"4.8.2.1"})," ",(0,i.jsx)("sup",{children:"\u23f1\ufe0f2022.11.28"})," ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I63D2E",children:"#I63D2E"})]}),"\n"]}),"\n"]}),"\n"]})]})})]}),"\n","\n","\n",(0,i.jsx)(n.h2,{id:"181-\u5173\u4e8e\u65e5\u5fd7",children:"18.1 \u5173\u4e8e\u65e5\u5fd7"}),"\n",(0,i.jsxs)(n.p,{children:["\u901a\u5e38\u65e5\u5fd7\u6307\u7684\u662f",(0,i.jsx)(n.strong,{children:"\u7cfb\u7edf\u65e5\u5fd7"}),"\u548c",(0,i.jsx)(n.strong,{children:"\u7a0b\u5e8f\u65e5\u5fd7"}),"\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"\u7cfb\u7edf\u65e5\u5fd7"})," \u662f\u8bb0\u5f55\u7cfb\u7edf\u4e2d\u786c\u4ef6\u3001\u8f6f\u4ef6\u548c\u7cfb\u7edf\u95ee\u9898\u7684\u4fe1\u606f\uff0c\u540c\u65f6\u8fd8\u53ef\u4ee5\u76d1\u89c6\u7cfb\u7edf\u4e2d\u53d1\u751f\u7684\u4e8b\u4ef6\u3002\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u5b83\u6765\u68c0\u67e5\u9519\u8bef\u53d1\u751f\u7684\u539f\u56e0\uff0c\u6216\u8005\u5bfb\u627e\u53d7\u5230\u653b\u51fb\u65f6\u653b\u51fb\u8005\u7559\u4e0b\u7684\u75d5\u8ff9\u3002\u7cfb\u7edf\u65e5\u5fd7\u5305\u62ec\u7cfb\u7edf\u65e5\u5fd7\u3001\u5e94\u7528\u7a0b\u5e8f\u65e5\u5fd7\u548c\u5b89\u5168\u65e5\u5fd7\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"\u7a0b\u5e8f\u65e5\u5fd7"})," \u662f\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u4ea7\u751f\u7684\u65e5\u5fd7\uff0c\u901a\u5e38\u7531\u6846\u67b6\u8fd0\u884c\u65f6\u6216\u5f00\u53d1\u8005\u63d0\u4f9b\u7684\u65e5\u5fd7\u3002\u5305\u62ec\u8bf7\u6c42\u65e5\u5fd7\uff0c\u5f02\u5e38\u65e5\u5fd7\u3001\u5ba1\u8ba1\u65e5\u5fd7\u3001\u884c\u4e3a\u65e5\u5fd7\u7b49\u3002"]}),"\n",(0,i.jsx)(n.h2,{id:"182-\u65e5\u5fd7\u4f5c\u7528",children:"18.2 \u65e5\u5fd7\u4f5c\u7528"}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u9879\u76ee\u5f00\u53d1\u4e2d\uff0c\u90fd\u4e0d\u53ef\u907f\u514d\u7684\u4f7f\u7528\u5230\u65e5\u5fd7\u3002\u6ca1\u6709\u65e5\u5fd7\u867d\u7136\u4e0d\u4f1a\u5f71\u54cd\u9879\u76ee\u7684\u6b63\u786e\u8fd0\u884c\uff0c\u4f46\u662f\u6ca1\u6709\u65e5\u5fd7\u7684\u9879\u76ee\u53ef\u4ee5\u8bf4\u662f\u4e0d\u5b8c\u6574\u7684\u3002\u65e5\u5fd7\u5728\u8c03\u8bd5\uff0c\u9519\u8bef\u6216\u8005\u5f02\u5e38\u5b9a\u4f4d\uff0c\u6570\u636e\u5206\u6790\u4e2d\u7684\u4f5c\u7528\u662f\u4e0d\u8a00\u800c\u55bb\u7684\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u8c03\u8bd5"}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u9879\u76ee\u8c03\u8bd5\u65f6\uff0c\u67e5\u770b\u6808\u4fe1\u606f\u53ef\u4ee5\u65b9\u4fbf\u5730\u77e5\u9053\u5f53\u524d\u7a0b\u5e8f\u7684\u8fd0\u884c\u72b6\u6001\uff0c\u8f93\u51fa\u7684\u65e5\u5fd7\u4fbf\u4e8e\u8bb0\u5f55\u7a0b\u5e8f\u5728\u4e4b\u524d\u7684\u8fd0\u884c\u7ed3\u679c\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u9519\u8bef\u5b9a\u4f4d"}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u4e0d\u8981\u4ee5\u4e3a\u9879\u76ee\u80fd\u6b63\u786e\u8dd1\u8d77\u6765\u5c31\u53ef\u4ee5\u9ad8\u6795\u65e0\u5fe7\uff0c\u9879\u76ee\u5728\u8fd0\u884c\u4e00\u6bb5\u65f6\u5019\u540e\uff0c\u53ef\u80fd\u7531\u4e8e\u6570\u636e\u95ee\u9898\uff0c\u7f51\u7edc\u95ee\u9898\uff0c\u5185\u5b58\u95ee\u9898\u7b49\u51fa\u73b0\u5f02\u5e38\u3002\u8fd9\u65f6\u65e5\u5fd7\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u6216\u8005\u8fd0\u7ef4\u4eba\u5458\u5feb\u901f\u5b9a\u4f4d\u9519\u8bef\u4f4d\u7f6e\uff0c\u63d0\u51fa\u89e3\u51b3\u65b9\u6848\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u6570\u636e\u5206\u6790"}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5927\u6570\u636e\u7684\u5174\u8d77\uff0c\u4f7f\u5f97\u5927\u91cf\u7684\u65e5\u5fd7\u5206\u6790\u6210\u4e3a\u53ef\u80fd\uff0cELK \u4e5f\u8ba9\u65e5\u5fd7\u5206\u6790\u95e8\u69db\u964d\u4f4e\u4e86\u5f88\u591a\u3002\u65e5\u5fd7\u4e2d\u8574\u542b\u4e86\u5927\u91cf\u7684\u7528\u6237\u6570\u636e\uff0c\u5305\u62ec\u70b9\u51fb\u884c\u4e3a\uff0c\u5174\u8da3\u504f\u597d\u7b49\uff0c\u7528\u6237\u753b\u50cf\u5bf9\u4e8e\u516c\u53f8\u4e0b\u4e00\u6b65\u7684\u6218\u7565\u65b9\u5411\u6709\u4e00\u5b9a\u6307\u5f15\u4f5c\u7528\u3002"}),"\n",(0,i.jsx)(n.h2,{id:"183-\u65e5\u5fd7\u7ea7\u522b",children:"18.3 \u65e5\u5fd7\u7ea7\u522b"}),"\n",(0,i.jsx)(n.p,{children:"\u65e5\u5fd7\u7ea7\u522b\u53ef\u4ee5\u6709\u6548\u7684\u5bf9\u65e5\u5fd7\u4fe1\u606f\u8fdb\u884c\u5f52\u7c7b\uff0c\u65b9\u4fbf\u51c6\u786e\u7684\u67e5\u770b\u7279\u5b9a\u65e5\u5fd7\u5185\u5bb9\u3002\u901a\u5e38\u65e5\u5fd7\u7c7b\u522b\u6709\u4ee5\u4e0b\u7ea7\u522b\uff1a"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{style:{textAlign:"center"},children:"\u7ea7\u522b"}),(0,i.jsx)(n.th,{children:"\u503c"}),(0,i.jsx)(n.th,{style:{textAlign:"center"},children:"\u65b9\u6cd5"}),(0,i.jsx)(n.th,{children:"\u63cf\u8ff0"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"Trace\uff08\u8ddf\u8e2a\uff09"}),(0,i.jsx)(n.td,{children:"0"}),(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"LogTrace"}),(0,i.jsx)(n.td,{children:"\u5305\u542b\u6700\u8be6\u7ec6\u7684\u6d88\u606f\u3002 \u8fd9\u4e9b\u6d88\u606f\u53ef\u80fd\u5305\u542b\u654f\u611f\u7684\u5e94\u7528\u6570\u636e\u3002 \u8fd9\u4e9b\u6d88\u606f\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5904\u4e8e\u7981\u7528\u72b6\u6001\uff0c\u5e76\u4e14\u4e0d\u5e94\u5728\u751f\u4ea7\u4e2d\u542f\u7528\u3002"})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"Debug\uff08\u8c03\u8bd5\uff09"}),(0,i.jsx)(n.td,{children:"1"}),(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"LogDebug"}),(0,i.jsx)(n.td,{children:"\u7528\u4e8e\u8c03\u8bd5\u548c\u5f00\u53d1\u3002 \u7531\u4e8e\u91cf\u5927\uff0c\u8bf7\u5728\u751f\u4ea7\u4e2d\u5c0f\u5fc3\u4f7f\u7528\u3002"})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"Information\uff08\u4fe1\u606f\uff09"}),(0,i.jsx)(n.td,{children:"2"}),(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"LogInformation"}),(0,i.jsx)(n.td,{children:"\u8ddf\u8e2a\u5e94\u7528\u7684\u5e38\u89c4\u6d41\u3002 \u53ef\u80fd\u5177\u6709\u957f\u671f\u503c\u3002"})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"Warning\uff08\u8b66\u544a\uff09"}),(0,i.jsx)(n.td,{children:"3"}),(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"LogWarning"}),(0,i.jsx)(n.td,{children:"\u5bf9\u4e8e\u5f02\u5e38\u4e8b\u4ef6\u6216\u610f\u5916\u4e8b\u4ef6\u3002 \u901a\u5e38\u5305\u62ec\u4e0d\u4f1a\u5bfc\u81f4\u5e94\u7528\u5931\u8d25\u7684\u9519\u8bef\u6216\u60c5\u51b5\u3002"})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"Error\uff08\u9519\u8bef\uff09"}),(0,i.jsx)(n.td,{children:"4"}),(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"LogError"}),(0,i.jsx)(n.td,{children:"\u8868\u793a\u65e0\u6cd5\u5904\u7406\u7684\u9519\u8bef\u548c\u5f02\u5e38\u3002 \u8fd9\u4e9b\u6d88\u606f\u8868\u793a\u5f53\u524d\u64cd\u4f5c\u6216\u8bf7\u6c42\u5931\u8d25\uff0c\u800c\u4e0d\u662f\u6574\u4e2a\u5e94\u7528\u5931\u8d25\u3002"})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"Critical\uff08\u4e25\u91cd\uff09"}),(0,i.jsx)(n.td,{children:"5"}),(0,i.jsx)(n.td,{style:{textAlign:"center"},children:"LogCritical"}),(0,i.jsx)(n.td,{children:"\u9700\u8981\u7acb\u5373\u5173\u6ce8\u7684\u5931\u8d25\u3002 \u4f8b\u5982\u6570\u636e\u4e22\u5931\u3001\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3\u3002"})]})]})]}),"\n",(0,i.jsx)(n.h2,{id:"184-\u5982\u4f55\u4f7f\u7528",children:"18.4 \u5982\u4f55\u4f7f\u7528"}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:".NET 5"})," \u6846\u67b6\u4e2d\uff0c\u5fae\u8f6f\u5df2\u7ecf\u4e3a\u6211\u4eec\u5185\u7f6e\u4e86 ",(0,i.jsx)(n.code,{children:"\u65e5\u5fd7\u7ec4\u4ef6"}),"\uff0c\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u65e0\u9700\u6211\u4eec\u5f15\u7528\u7b2c\u4e09\u65b9\u5305\u8fdb\u884c\u65e5\u5fd7\u8bb0\u5f55\u3002",(0,i.jsx)(n.code,{children:".NET 5"})," \u6846\u67b6\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u4e24\u79cd\u65e5\u5fd7\u5bf9\u8c61\u521b\u5efa\u65b9\u5f0f\u3002"]}),"\n",(0,i.jsxs)(n.h3,{id:"1841-iloggert-\u6cdb\u578b\u65b9\u5f0f",children:["18.4.1 ",(0,i.jsx)(n.code,{children:"ILogger"})," \u6cdb\u578b\u65b9\u5f0f"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4f7f\u7528\u975e\u5e38\u7b80\u5355\uff0c\u53ef\u4ee5\u901a\u8fc7 ",(0,i.jsx)(n.code,{children:"ILogger"})," \u5bf9\u8c61\u8fdb\u884c\u6ce8\u5165\uff0c\u5982\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {5}",children:'public class PrivacyModel : PageModel\r\n{\r\n private readonly ILogger _logger;\r\n\r\n public PrivacyModel(ILogger logger)\r\n {\r\n _logger = logger;\r\n }\r\n\r\n public void OnGet()\r\n {\r\n _logger.LogInformation("GET Pages.PrivacyModel called.");\r\n }\r\n}\n'})}),"\n",(0,i.jsx)(n.admonition,{title:"\u5c0f\u77e5\u8bc6",type:"tip",children:(0,i.jsxs)(n.p,{children:["\u901a\u8fc7\u6cdb\u578b ",(0,i.jsx)(n.code,{children:"ILogger"})," \u65b9\u5f0f\u5199\u5165\u65e5\u5fd7\uff0c\u90a3\u4e48\u9ed8\u8ba4\u5c06 ",(0,i.jsx)(n.code,{children:"T"})," \u7c7b\u578b\u5b8c\u6574\u7c7b\u578b\u540d\u79f0\u4f5c\u4e3a ",(0,i.jsx)(n.code,{children:"\u65e5\u5fd7\u7c7b\u522b"}),"\u3002"]})}),"\n",(0,i.jsxs)(n.h3,{id:"1842-iloggerfactory-\u5de5\u5382\u65b9\u5f0f",children:["18.4.2 ",(0,i.jsx)(n.code,{children:"ILoggerFactory"})," \u5de5\u5382\u65b9\u5f0f"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4f7f\u7528\u5de5\u5382\u65b9\u5f0f\uff0c\u9700\u624b\u52a8\u4f20\u5165 ",(0,i.jsx)(n.code,{children:"\u65e5\u5fd7\u7c7b\u522b"}),"\uff0c\u5982\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {5,7}",children:'public class ContactModel : PageModel\r\n{\r\n private readonly ILogger _logger;\r\n\r\n public ContactModel(ILoggerFactory logger)\r\n {\r\n _logger = logger.CreateLogger("MyCategory");\r\n }\r\n\r\n public void OnGet()\r\n {\r\n _logger.LogInformation("GET Pages.ContactModel called.");\r\n }\r\n}\n'})}),"\n",(0,i.jsxs)(n.h3,{id:"1843-log-\u9759\u6001\u7c7b\u65b9\u5f0f",children:["18.4.3 ",(0,i.jsx)(n.code,{children:"Log"})," \u9759\u6001\u7c7b\u65b9\u5f0f"]}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.2.1 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,5,10-15}",children:'// \u521b\u5efa\u65e5\u5fd7\u5bf9\u8c61\r\nvar logger = Log.CreateLogger("\u65e5\u5fd7\u540d\u79f0");\r\n\r\n// \u521b\u5efa\u65e5\u5fd7\u5de5\u5382\r\nusing var loggerFactory = Log.CreateLoggerFactory(builder => {\r\n // ....\r\n});\r\n\r\n// \u65e5\u5fd7\u8bb0\u5f55\r\nLog.Information("Information");\r\nLog.Warning("Warning");\r\nLog.Error("Error");\r\nLog.Debug("Debug");\r\nLog.Trace("Trace");\r\nLog.Critical("Critical");\n'})}),"\n",(0,i.jsxs)(n.h3,{id:"1844-\u61d2\u4eba\u6a21\u5f0f-",children:["18.4.4 ",(0,i.jsx)(n.code,{children:"\u61d2\u4eba\u6a21\u5f0f"})," \ud83d\ude01"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u4e2d\uff0c\u63d0\u4f9b\u4e86\u66f4\u61d2\u7684\u65b9\u5f0f\u5199\u5165\u65e5\u5fd7\uff0c\u4e5f\u5c31\u662f\u901a\u8fc7\u5b57\u7b26\u4e32\u62d3\u5c55\u7684\u65b9\u5f0f\u5199\u5165\uff0c\u5982\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'"\u7b80\u5355\u65e5\u5fd7".LogInformation();\r\n\r\n"\u767e\u5c0f\u50e7 \u65b0\u589e\u4e86\u4e00\u6761\u8bb0\u5f55".LogInformation();\r\n\r\n"\u7a0b\u5e8f\u51fa\u73b0\u5f02\u5e38\u5566".LogError();\r\n\r\n"\u8fd9\u662f\u81ea\u5b9a\u4e49\u7c7b\u522b\u65e5\u5fd7".SetCategory().LogInformation();\n'})}),"\n",(0,i.jsx)(n.p,{children:"\u901a\u8fc7\u5b57\u7b26\u4e32\u62d3\u5c55\u65b9\u5f0f\u53ef\u4ee5\u5728\u4efb\u4f55\u65f6\u5019\u65b9\u4fbf\u8bb0\u5f55\u65e5\u5fd7\uff0c\u4e13\u95e8\u4e3a\u61d2\u4eba\u63d0\u4f9b\u7684\u3002"}),"\n",(0,i.jsx)(n.h2,{id:"185-\u8f93\u51fa\u5230\u63a7\u5236\u53f0",children:"18.5 \u8f93\u51fa\u5230\u63a7\u5236\u53f0"}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"ASP.NET Core"})," \u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u4e3b\u673a\u542f\u52a8\u65f6\u9ed8\u8ba4\u6ce8\u518c\u4e86 ",(0,i.jsx)(n.code,{children:"ConsoleLoggerProvider"})," \u63d0\u4f9b\u5668\uff0c\u4e5f\u5c31\u662f\u63a7\u5236\u53f0\u65e5\u5fd7\u8f93\u51fa\u63d0\u4f9b\u5668\uff0c\u6240\u4ee5\u65e0\u9700\u4efb\u4f55\u6ce8\u518c\u670d\u52a1\u5373\u53ef\u5728\u63a7\u5236\u53f0\u8f93\u51fa\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"info: Furion.EventBus.EventBusHostedService[0]\r\n EventBus Hosted Service is running.\r\ninfo: Microsoft.Hosting.Lifetime[14]\r\n Now listening on: https://localhost:5001\r\ninfo: Microsoft.Hosting.Lifetime[14]\r\n Now listening on: http://localhost:5000\r\ninfo: Microsoft.Hosting.Lifetime[0]\r\n Application started. Press Ctrl+C to shut down.\r\ninfo: Microsoft.Hosting.Lifetime[0]\r\n Hosting environment: Development\r\ninfo: Microsoft.Hosting.Lifetime[0]\r\n Content root path: C:\\Workplaces\\Furion\\samples\\Furion.Web.Entry\\\n"})}),"\n",(0,i.jsx)(n.h3,{id:"1851-\u65e5\u5fd7\u8fc7\u6ee4\u7b5b\u9009",children:"18.5.1 \u65e5\u5fd7\u8fc7\u6ee4/\u7b5b\u9009"}),"\n",(0,i.jsx)(n.p,{children:"\u901a\u8fc7\u65e5\u5fd7\u7b5b\u9009\u5668\u53ef\u4ee5\u5bf9\u65e5\u5fd7\u8fdb\u884c\u5f52\u7c7b\u5199\u5165\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,4,11,13}",children:'// \u4f8b\u5b50\u4e00\uff1a\u6839\u636e\u65e5\u5fd7\u7ea7\u522b\u8f93\u51fa\r\nservices.AddConsoleFormatter(options =>\r\n{\r\n options.WriteFilter = (logMsg) => // Furion 4.8.8.52+ \u7248\u672c\u652f\u6301\r\n {\r\n return logMsg.LogLevel == LogLevel.Information;\r\n };\r\n});\r\n\r\n// \u4f8b\u5b50\u4e8c\uff0c\u6839\u636e\u4efb\u4f55\u89c4\u5219\uff0c\u6bd4\u5982\u7279\u5b9a\u7684\u7c7b\u540d\r\nservices.AddConsoleFormatter(options => // Furion 4.8.8.52+ \u7248\u672c\u652f\u6301\r\n{\r\n options.WriteFilter = (logMsg) =>\r\n {\r\n return logMsg.LogName == "System.Logging.LoggingMonitor";\r\n };\r\n});\n'})}),"\n",(0,i.jsx)(n.h3,{id:"1852-\u65e5\u5fd7\u6807\u51c6\u5316\u7f8e\u5316\u6a21\u677f",children:"18.5.2 \u65e5\u5fd7\u6807\u51c6\u5316\uff08\u7f8e\u5316\uff09\u6a21\u677f"}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.5.0 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"ASP.NET Core"})," \u9ed8\u8ba4\u63a7\u5236\u53f0\u65e5\u5fd7\u76f8\u5bf9\u7b80\u6d01\uff0c\u5e76\u672a\u5305\u542b\u5e38\u89c1\u7684\u65e5\u5fd7\u65f6\u95f4\u3001\u7ebf\u7a0b ",(0,i.jsx)(n.code,{children:"Id"})," \u7b49\uff0c\u800c\u4e14\u81ea\u5b9a\u4e49\u6a21\u677f\u4e5f\u76f8\u5bf9\u590d\u6742\uff0c\u6240\u4ee5 ",(0,i.jsx)(n.code,{children:"Furion 4.5.0+"})," \u7248\u672c\u63d0\u4f9b\u4e86\u7b80\u5316\u914d\u7f6e\uff0c\u5982\uff1a"]}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Startup.cs"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddConsoleFormatter();\n"})}),"\n",(0,i.jsxs)(n.ol,{start:"2",children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:".NET5"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,4}",children:"Host.CreateDefaultBuilder(args)\r\n .ConfigureLogging(logging =>\r\n {\r\n logging.AddConsoleFormatter();\r\n });\n"})}),"\n",(0,i.jsxs)(n.ol,{start:"3",children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:".NET6"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:"var builder = WebApplication.CreateBuilder(args);\r\n\r\nbuilder.Logging.AddConsoleFormatter();\n"})}),"\n",(0,i.jsxs)(n.ol,{start:"4",children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Serve.Run()"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3,7}",children:"Serve.Run(RunOptions.Default.AddWebComponent());\r\n\r\npublic class WebComponent : IWebComponent\r\n{\r\n public void Load(WebApplicationBuilder builder, ComponentContext componentContext)\r\n {\r\n builder.Logging.AddConsoleFormatter();\r\n }\r\n}\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u8f93\u51fa\u7ed3\u679c\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"info: 2023-03-23 11:51:02.3757469 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[14] #1\r\n Now listening on: https://localhost:7025\r\ninfo: 2023-03-23 11:51:02.4993301 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[14] #1\r\n Now listening on: http://localhost:5217\r\ninfo: 2023-03-23 11:51:02.5058785 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[0] #1\r\n Application started. Press Ctrl+C to shut down.\r\ninfo: 2023-03-23 11:51:02.5100496 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[0] #1\r\n Hosting environment: Development\r\ninfo: 2023-03-23 11:51:02.5127095 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[0] #1\r\n Content root path: C:\\Users\\snrcsoft\\source\\repos\\WebApplication1\\WebApplication1\n"})}),"\n",(0,i.jsx)(n.h3,{id:"1853-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u6a21\u677f",children:"18.5.3 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u6a21\u677f"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3,13,15}",children:'services.AddConsoleFormatter(options =>\r\n{\r\n options.MessageFormat = (logMsg) =>\r\n {\r\n var stringBuilder = new StringBuilder();\r\n stringBuilder.Append(DateTime.Now.ToString("o"));\r\n // \u5176\u4ed6\u7684\u3002\u3002\u3002\u81ea\u5df1\u7ec4\u88c5\r\n return stringBuilder.ToString();\r\n };\r\n});\r\n\r\n// \u8f93\u51fa\u4e3a JSON \u683c\u5f0f\uff0cFurion 4.5.2+\r\nservices.AddConsoleFormatter(options =>\r\n{\r\n options.MessageFormat = LoggerFormatter.Json;\r\n // Furion 4.8.0+ \u65b0\u589e JSON \u7f8e\u5316\u8f93\u51fa\r\n options.MessageFormat = LoggerFormatter.JsonIndented;\r\n});\n'})}),"\n",(0,i.jsx)(n.h3,{id:"1854-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f93\u51fa\u65f6\u95f4\u683c\u5f0f",children:"18.5.4 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f93\u51fa\u65f6\u95f4\u683c\u5f0f"}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.5.1 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3}",children:'services.AddConsoleFormatter(options =>\r\n{\r\n options.DateFormat = "yyyy-MM-dd HH:mm:ss.fffffff zzz dddd";\r\n});\n'})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers {1}",children:"info: 2022-09-28 02:02:20(+08:00) \u661f\u671f\u4e09 System.Logging.EventBusService[0] #1\r\n EventBus Hosted Service is running.\r\ninfo: 2022-09-28 02:02:22(+08:00) \u661f\u671f\u4e09 Microsoft.Hosting.Lifetime[14] #1\r\n Now listening on: https://localhost:5001\r\ninfo: 2022-09-28 02:02:22(+08:00) \u661f\u671f\u4e09 Microsoft.Hosting.Lifetime[14] #1\r\n Now listening on: http://localhost:5000\r\ninfo: 2022-09-28 02:02:22(+08:00) \u661f\u671f\u4e09 Microsoft.Hosting.Lifetime[0] #1\r\n Application started. Press Ctrl+C to shut down.\r\ninfo: 2022-09-28 02:02:22(+08:00) \u661f\u671f\u4e09 Microsoft.Hosting.Lifetime[0] #1\r\n Hosting environment: Development\r\ninfo: 2022-09-28 02:02:22(+08:00) \u661f\u671f\u4e09 Microsoft.Hosting.Lifetime[0] #1\r\n Content root path: D:\\Workplaces\\OpenSources\\Furion\\samples\\Furion.Web.Entry\\\n"})}),"\n",(0,i.jsx)(n.h3,{id:"1855-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f93\u51fa\u7a0b\u5e8f",children:"18.5.5 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f93\u51fa\u7a0b\u5e8f"}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.5.2 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"ASP.NET Core"})," \u548c ",(0,i.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u90fd\u63d0\u4f9b\u4e86\u6807\u51c6\u5316\u65e5\u5fd7\u8f93\u51fa\uff0c\u5982\u679c\u5bf9\u989c\u8272\uff0c\u683c\u5f0f\u6709\u8981\u6c42\uff0c\u53ef\u4f7f\u7528\u4e0b\u5217\u4ee3\u7801\u8fdb\u884c\u81ea\u5b9a\u4e49\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3,5}",children:"services.AddConsoleFormatter(options =>\r\n{\r\n options.WriteHandler = (logMsg, scopeProvider, writer, fmtMsg, opt) =>\r\n {\r\n writer.WriteLine(fmtMsg);\r\n };\r\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"1856-\u8f93\u51fa\u65e5\u5fd7-traceidhttpcontextid",children:["18.5.6 \u8f93\u51fa\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"TraceId/HttpContextId"})]}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.8.1.3 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u65e5\u5fd7\u7684\u8f93\u51fa\u662f\u975e\u5e38\u9891\u7e41\u7684\uff0c\u4f46\u662f\u5f88\u96be\u4ece\u65e5\u5fd7\u6587\u4ef6\u4e2d\u5224\u65ad\u54ea\u4e9b\u65e5\u5fd7\u662f\u5c5e\u4e8e\u540c\u4e00\u4e2a\u8bf7\u6c42\u8f93\u51fa\u7684\uff0c\u8fd9\u65f6\u542f\u7528 ",(0,i.jsx)(n.code,{children:"WithTraceId"})," \u914d\u7f6e\u5373\u53ef\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:"services.AddConsoleFormatter(options =>\r\n{\r\n options.WithTraceId = true;\r\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u8f93\u51fa\u65e5\u5fd7\u5982\u4e0b\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers {15,17}",children:"info: 2022-11-24 14:34:55.1717549 +08:00 \u661f\u671f\u56db L System.Logging.EventBusService[0] #1\r\n EventBus Hosted Service is running.\r\ninfo: 2022-11-24 14:34:55.2504015 +08:00 \u661f\u671f\u56db L System.Logging.ScheduleService[0] #1\r\n Schedule Hosted Service is running.\r\ninfo: 2022-11-24 14:34:56.4280796 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[14] #1\r\n Now listening on: https://localhost:5001\r\ninfo: 2022-11-24 14:34:56.4331170 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[14] #1\r\n Now listening on: http://localhost:5000\r\ninfo: 2022-11-24 14:34:56.4384567 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[0] #1\r\n Application started. Press Ctrl+C to shut down.\r\ninfo: 2022-11-24 14:34:56.4408766 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[0] #1\r\n Hosting environment: Development\r\ninfo: 2022-11-24 14:34:56.4427659 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[0] #1\r\n Content root path: D:\\Workplaces\\OpenSources\\Furion\\samples\\Furion.Web.Entry\r\ninfo: 2022-11-24 14:35:06.8507338 +08:00 Thursday L Furion.Application.TestLoggerServices[0] #17 '00-48df9ac5c8280de2f301faa44a23a10c-b75678d9f3883b0b-00'\r\n \u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 20\r\ninfo: 2022-11-24 14:35:16.0373384 +08:00 \u661f\u671f\u56db L Furion.Application.TestLoggerServices[0] #17 '00-ff4fb15d6ff41a0411784e66400f0dfd-962bc25eff788b25-00'\r\n \u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 20\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"1857-\u8f93\u51fa\u65e5\u5fd7-\u7a0b\u5e8f\u96c6\u7c7b\u578b\u65b9\u6cd5",children:["18.5.7 \u8f93\u51fa\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"\u7a0b\u5e8f\u96c6/\u7c7b\u578b/\u65b9\u6cd5"})]}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.8.7.16 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u6709\u65f6\u5019\u6211\u4eec\u5e0c\u671b\u77e5\u9053\u8fd9\u4e2a\u65e5\u5fd7\u662f\u5728\u54ea\u4e2a\u7a0b\u5e8f\u96c6\uff0c\u54ea\u4e2a\u7c7b\u4e2d\u54ea\u4e2a\u65b9\u6cd5\u8f93\u51fa\uff0c\u8fd9\u65f6\u542f\u7528 ",(0,i.jsx)(n.code,{children:"WithStackFrame"})," \u914d\u7f6e\u5373\u53ef\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:"services.AddConsoleFormatter(options =>\r\n{\r\n options.WithStackFrame = true;\r\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u8f93\u51fa\u65e5\u5fd7\u5982\u4e0b\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers {2,5,8,11,14,17,20}",children:"info: 2023-03-17 18:25:06.7988349 +08:00 \u661f\u671f\u4e94 L System.Logging.EventBusService[0] #1\r\n [Furion.dll] async Task Furion.EventBus.EventBusHostedService.ExecuteAsync(CancellationToken stoppingToken)\r\n EventBus hosted service is running.\r\ninfo: 2023-03-17 18:25:08.1393952 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[14] #1\r\n [System.Private.CoreLib.dll] void System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start(ref TStateMachine stateMachine)\r\n Now listening on: https://localhost:5001\r\ninfo: 2023-03-17 18:25:08.1620391 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[14] #1\r\n [System.Private.CoreLib.dll] void System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start(ref TStateMachine stateMachine)\r\n Now listening on: http://localhost:5000\r\ninfo: 2023-03-17 18:25:08.1972456 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[0] #1\r\n [Microsoft.Extensions.Hosting.dll] void Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted()\r\n Application started. Press Ctrl+C to shut down.\r\ninfo: 2023-03-17 18:25:08.2456579 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[0] #1\r\n [Microsoft.Extensions.Hosting.dll] void Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted()\r\n Hosting environment: Development\r\ninfo: 2023-03-17 18:25:08.2746134 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[0] #1\r\n [System.Private.CoreLib.dll] void System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(bool throwOnFirstException)\r\n Content root path: D:\\Workplaces\\OpenSources\\Furion\\samples\\Furion.Web.Entry\r\ninfo: 2023-03-17 18:25:18.1917784 +08:00 \u661f\u671f\u4e94 L Furion.Application.TestLoggerServices[0] #16\r\n [Furion.Application.dll] void Furion.Application.TestLoggerServices.\u6d4b\u8bd5\u65e5\u5fd7()\r\n \u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 20\n"})}),"\n",(0,i.jsx)(n.h2,{id:"186-\u8f93\u51fa\u5230\u6587\u4ef6",children:"18.6 \u8f93\u51fa\u5230\u6587\u4ef6"}),"\n",(0,i.jsx)(n.h3,{id:"1861-\u57fa\u7840\u4f7f\u7528",children:"18.6.1 \u57fa\u7840\u4f7f\u7528"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,5,8}",children:'// \u4f8b\u5b50\u4e00\uff1a\u542f\u52a8\u5c42\u6839\u76ee\u5f55\u8f93\u51fa\r\nservices.AddFileLogging("application.log");\r\n\r\n// \u4f8b\u5b50\u4e8c\uff1a\u652f\u6301\u8def\u5f84\r\nservices.AddFileLogging("logs/application.log");\r\n\r\n// \u4f8b\u5b50\u4e09\uff1a\u652f\u6301\u65e5\u5fd7\u8ffd\u52a0\u8fd8\u662f\u8986\u76d6\uff0c\u8bbe\u7f6e true \u4e3a\u8ffd\u52a0\uff0cfalse \u4e3a\u8986\u76d6\r\nservices.AddFileLogging("application.log", true);\n'})}),"\n",(0,i.jsx)(n.h3,{id:"1862-\u4ece\u914d\u7f6e\u6587\u4ef6\u8bfb\u53d6\u914d\u7f6e",children:"18.6.2 \u4ece\u914d\u7f6e\u6587\u4ef6\u8bfb\u53d6\u914d\u7f6e"}),"\n",(0,i.jsx)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:(0,i.jsx)(n.p,{children:(0,i.jsxs)(n.strong,{children:["\u53ea\u6709\u4e0d\u5728 ",(0,i.jsx)(n.code,{children:".AddFile"})," \u7b2c\u4e00\u4e2a\u53c2\u6570\u914d\u7f6e\u6587\u4ef6\u540d\u624d\u4f1a\u81ea\u52a8\u52a0\u8f7d\u914d\u7f6e\uff0c\u4e5f\u5c31\u662f\u6587\u4ef6\u540d\u5e94\u8be5\u914d\u7f6e\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u3002"]})})}),"\n",(0,i.jsx)(n.p,{children:"\u6587\u4ef6\u65e5\u5fd7\u914d\u7f6e\u8bf4\u660e\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers {2,7-13,16-22}",children:'{\r\n "Logging": {\r\n "LogLevel": {\r\n "Default": "Information"\r\n // .... appsettings \u9ed8\u8ba4\u914d\u7f6e\r\n },\r\n "File": {\r\n "FileName": "application.log", // \u65e5\u5fd7\u6587\u4ef6\u5b8c\u6574\u8def\u5f84\u6216\u6587\u4ef6\u540d\uff0c\u63a8\u8350 .log \u4f5c\u4e3a\u62d3\u5c55\u540d\r\n "Append": true, // \u8ffd\u52a0\u5230\u5df2\u5b58\u5728\u65e5\u5fd7\u6587\u4ef6\u6216\u8986\u76d6\u5b83\u4eec\r\n "MinimumLevel": "Information", // \u6700\u4f4e\u65e5\u5fd7\u8bb0\u5f55\u7ea7\u522b\r\n "FileSizeLimitBytes": 0, // \u63a7\u5236\u6bcf\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u6700\u5927\u5b58\u50a8\u5927\u5c0f\uff0c\u5355\u4f4d\u662f B\uff0c\u4e5f\u5c31\u662f 1024 \u624d\u7b49\u4e8e 1KB\uff0c\u9ed8\u8ba4\u65e0\u9650\u5236\uff0c\u5982\u679c\u6307\u5b9a\u4e86\u8be5\u503c\uff0c\u90a3\u4e48\u65e5\u5fd7\u6587\u4ef6\u5927\u5c0f\u8d85\u51fa\u4e86\u8be5\u914d\u7f6e\u5c31\u4f1a\u521b\u5efa\u65b0\u7684\u65e5\u5fd7\u6587\u4ef6\uff0c\u65b0\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u547d\u540d\u89c4\u5219\uff1a\u6587\u4ef6\u540d+[\u9012\u589e\u5e8f\u53f7].log\r\n "MaxRollingFiles": 0 // \u63a7\u5236\u6700\u5927\u521b\u5efa\u7684\u65e5\u5fd7\u6587\u4ef6\u6570\u91cf\uff0c\u9ed8\u8ba4\u65e0\u9650\u5236\uff0c\u914d\u5408 FileSizeLimitBytes \u4f7f\u7528\uff0c\u5982\u679c\u6307\u5b9a\u4e86\u8be5\u503c\uff0c\u90a3\u4e48\u8d85\u51fa\u8be5\u503c\u5c06\u4ece\u6700\u521d\u65e5\u5fd7\u6587\u4ef6\u4e2d\u4ece\u5934\u5199\u5165\u8986\u76d6\r\n }\r\n },\r\n // \u81ea\u5b9a\u4e49\u914d\u7f6e\u8282\u70b9\r\n "MyLogger": {\r\n "FileName": "application.log",\r\n "Append": true,\r\n "MinimumLevel": "Information",\r\n "FileSizeLimitBytes": 0,\r\n "MaxRollingFiles": 0\r\n }\r\n}\n'})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,5,13,16}",children:'// \u4f8b\u5b50\u4e00\uff1a\u9ed8\u8ba4\u8bfb\u53d6 Logging:File \u8282\u70b9\r\nservices.AddFileLogging();\r\n\r\n// \u4f8b\u5b50\u4e8c\uff1a\u9ed8\u8ba4\u8bfb\u53d6 Logging:File \u8282\u70b9\uff0c\u652f\u6301\u66f4\u591a\u914d\u7f6e\r\nservices.AddFileLogging(options =>\r\n{\r\n options.MinimumLevel = LogLevel.Warning;\r\n\r\n // \u5176\u4ed6\u914d\u7f6e...\r\n});\r\n\r\n// \u4f8b\u5b50\u4e09\uff1a\u81ea\u5b9a\u4e49\u914d\u7f6e\u8282\u70b9\r\nservices.AddFileLogging(() => "MyLogger");\r\n\r\n// \u4f8b\u5b50\u56db\uff1a\u81ea\u5b9a\u4e49\u914d\u7f6e\u8282\u70b9\uff0c\u652f\u6301\u66f4\u591a\u914d\u7f6e\r\nservices.AddFileLogging(() => "MyLogger", options =>\r\n{\r\n options.MinimumLevel = LogLevel.Warning;\r\n\r\n // \u5176\u4ed6\u914d\u7f6e...\r\n});\n'})}),"\n",(0,i.jsx)(n.h3,{id:"1863-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u6587\u4ef6\u540d\u89c4\u5219",children:"18.6.3 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u6587\u4ef6\u540d\u89c4\u5219"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,5,14,23}",children:'// \u4f8b\u5b50\u4e00\uff1a\u652f\u6301\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\uff0c\u5982%SystemDrive%\uff0c%SystemRoot%\r\nservices.AddFileLogging("application%SystemDrive%-%SystemRoot%.log");\r\n\r\n// \u4f8b\u5b50\u4e8c\uff1a\u6bcf\u5929\u521b\u5efa\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\r\nservices.AddFileLogging("application-{0:yyyy}-{0:MM}-{0:dd}.log", options =>\r\n{\r\n options.FileNameRule = fileName =>\r\n {\r\n return string.Format(fileName, DateTime.UtcNow);\r\n };\r\n});\r\n\r\n// \u4f8b\u5b50\u4e09\uff0c\u4efb\u4f55\u81ea\u5df1\u559c\u6b22\u7684\u547d\u540d\u89c4\u5219\r\nservices.AddFileLogging("application-{0:yyyy}-{0:MM}-{0:dd}.log", options =>\r\n{\r\n options.FileNameRule = fileName =>\r\n {\r\n // your rule...\r\n };\r\n});\r\n\r\n// \u4f8b\u5b50\u56db\uff0c\u6279\u91cf\u8bbe\u7f6e\u591a\u4e2a\r\nArray.ForEach(new[] { LogLevel.Information, LogLevel.Warning, LogLevel.Error }, logLevel =>\r\n{\r\n services.AddFileLogging("application-{1}-{0:yyyy}-{0:MM}-{0:dd}.log", options =>\r\n {\r\n options.FileNameRule = fileName => string.Format(fileName, DateTime.UtcNow, logLevel.ToString());\r\n options.WriteFilter = logMsg => logMsg.LogLevel == logLevel;\r\n });\r\n});\n'})}),"\n",(0,i.jsx)(n.h3,{id:"1864-\u65e5\u5fd7\u8fc7\u6ee4\u5668\u7b5b\u9009\u5668",children:"18.6.4 \u65e5\u5fd7\u8fc7\u6ee4\u5668/\u7b5b\u9009\u5668"}),"\n",(0,i.jsx)(n.p,{children:"\u901a\u8fc7\u65e5\u5fd7\u7b5b\u9009\u5668\u53ef\u4ee5\u5bf9\u65e5\u5fd7\u8fdb\u884c\u5f52\u7c7b\u5199\u5165"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,10,19}",children:'// \u4f8b\u5b50\u4e00\uff1a\u6839\u636e\u65e5\u5fd7\u7ea7\u522b\u8f93\u51fa\r\nservices.AddFileLogging("infomation.log", options =>\r\n{\r\n options.WriteFilter = (logMsg) =>\r\n {\r\n return logMsg.LogLevel == LogLevel.Information;\r\n };\r\n});\r\n\r\nservices.AddFileLogging("error.log", options =>\r\n{\r\n options.WriteFilter = (logMsg) =>\r\n {\r\n return logMsg.LogLevel == LogLevel.Error;\r\n };\r\n});\r\n\r\n// \u4f8b\u5b50\u4e8c\uff0c\u6839\u636e\u4efb\u4f55\u89c4\u5219\uff0c\u6bd4\u5982\u7279\u5b9a\u7684\u7c7b\u540d\r\nservices.AddFileLogging("someclass.log", options =>\r\n{\r\n options.WriteFilter = (logMsg) =>\r\n {\r\n return logMsg.LogName.Contains("SomeClassName");\r\n };\r\n});\n'})}),"\n",(0,i.jsx)(n.h3,{id:"1865-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u6a21\u677f",children:"18.6.5 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u6a21\u677f"}),"\n",(0,i.jsxs)(n.p,{children:["\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",(0,i.jsx)(n.code,{children:"Furion"})," \u63d0\u4f9b\u4e86\u6807\u51c6\u7684\u65e5\u5fd7\u8f93\u51fa\u6a21\u677f\uff0c\u5982\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"2022-07-23T20:16:29.3459053+08:00\t[INF]\t[Furion.EventBus.EventBusHostedService]\t[0]\tEventBus Hosted Service is running.\r\n2022-07-23T20:16:29.5827366+08:00\t[INF]\t[Microsoft.Hosting.Lifetime]\t[0]\tApplication started. Press Ctrl+C to shut down.\r\n2022-07-23T20:16:29.5828798+08:00\t[INF]\t[Microsoft.Hosting.Lifetime]\t[0]\tHosting environment: Development\r\n2022-07-23T20:16:29.5829377+08:00\t[INF]\t[Microsoft.Hosting.Lifetime]\t[0]\tContent root path: C:\\Workplaces\\Furion\\samples\\Furion.Web.Entry\\\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5982\u9700\u81ea\u5b9a\u4e49\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,16,34,47,49}",children:'// \u4f8b\u5b50\u4e00\uff0c\u81ea\u5b9a\u4e49\u65e5\u5fd7\u6a21\u677f\uff08\u5e38\u7528\uff09\r\nservices.AddFileLogging("mytemplate.log", options =>\r\n{\r\n options.MessageFormat = (logMsg) =>\r\n {\r\n var stringBuilder = new StringBuilder();\r\n\r\n stringBuilder.Append(DateTime.Now.ToString("o"));\r\n // \u5176\u4ed6\u7684\u3002\u3002\u3002\u81ea\u5df1\u7ec4\u88c5\r\n\r\n return stringBuilder.ToString();\r\n };\r\n});\r\n\r\n// \u4f8b\u5b50\u4e8c\uff0c\u9700\u8981\u8f93\u51fa json \u683c\u5f0f\uff0c\u6bd4\u5982\u5bf9\u63a5\u963f\u91cc\u4e91\u65e5\u5fd7\uff0ckibana\u7b2c\u4e09\u65b9\u65e5\u5fd7\u4f7f\u7528\u8fd9\u4e2a\r\nservices.AddFileLogging("mytemplate.log", options =>\r\n{\r\n options.MessageFormat = (logMsg) =>\r\n {\r\n // \u9ad8\u6027\u80fd\u5199\u5165\r\n return logMsg.WriteArray(writer =>\r\n {\r\n writer.WriteStringValue(DateTime.Now.ToString("o"));\r\n writer.WriteStringValue(logMsg.LogLevel.ToString());\r\n writer.WriteStringValue(logMsg.LogName);\r\n writer.WriteNumberValue(logMsg.EventId.Id);\r\n writer.WriteStringValue(logMsg.Message);\r\n writer.WriteStringValue(logMsg.Exception?.ToString());\r\n });\r\n };\r\n});\r\n\r\n// \u4f8b\u5b50\u4e8c\uff0c\u9700\u8981\u8f93\u51fa json \uff08\u81ea\u5b9a\u4e49\uff09\u683c\u5f0f\uff0c\u6bd4\u5982\u5bf9\u63a5\u963f\u91cc\u4e91\u65e5\u5fd7\uff0ckibana\u7b2c\u4e09\u65b9\u65e5\u5fd7\u4f7f\u7528\u8fd9\u4e2a\r\nservices.AddFileLogging("mytemplate.log", options =>\r\n{\r\n options.MessageFormat = (logMsg) =>\r\n {\r\n // \u9ad8\u6027\u80fd\u5199\u5165\r\n return logMsg.Write(writer =>\r\n {\r\n // write \u5bf9\u8c61\u4e3a Utf8JsonWriter\uff0c\u53ef\u901a\u8fc7\u6d41\u5199\u5165\uff0c\u6027\u80fd\u6781\u9ad8\r\n });\r\n };\r\n});\r\n\r\n// \u8f93\u51fa\u4e3a JSON \u683c\u5f0f\uff0cFurion 4.5.2+\r\nservices.AddFileLogging("mytemplate.log", options =>\r\n{\r\n options.MessageFormat = LoggerFormatter.Json;\r\n // Furion 4.8.0+ \u65b0\u589e JSON \u7f8e\u5316\u8f93\u51fa\r\n options.MessageFormat = LoggerFormatter.JsonIndented;\r\n});\n'})}),"\n",(0,i.jsx)(n.h3,{id:"1866-\u65e5\u5fd7\u5199\u5165\u5931\u8d25\u5904\u7406",children:"18.6.6 \u65e5\u5fd7\u5199\u5165\u5931\u8d25\u5904\u7406"}),"\n",(0,i.jsx)(n.p,{children:"\u6709\u65f6\u5019\u53ef\u80fd\u56e0\u4e3a\u65e5\u5fd7\u6587\u4ef6\u88ab\u6253\u5f00\u6216\u8005\u5176\u4ed6\u5e94\u7528\u7a0b\u5e8f\u5360\u7528\u4e86\uff0c\u90a3\u4e48\u5c31\u4f1a\u5bfc\u81f4\u65e5\u5fd7\u5199\u5165\u5931\u8d25\uff0c\u8fd9\u65f6\u5019\u53ef\u4ee5\u8fdb\u884c\u5176\u4ed6\u76f8\u5173\u5904\u7406\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,11,15}",children:'// \u4f8b\u5b50\u4e00\uff1a\u5176\u4ed6\u5904\u7406\r\nservices.AddFileLogging("template-obj.log", options =>\r\n{\r\n options.HandleWriteError = (writeError) =>\r\n {\r\n // ~~\r\n };\r\n});\r\n\r\n// \u4f8b\u5b50\u4e8c\uff0c\u542f\u7528\u5907\u7528\u65e5\u5fd7\u6587\u4ef6\u529f\u80fd\uff0c\u4e5f\u5c31\u662f\u5982\u679c\u6587\u4ef6\u88ab\u5360\u7528\u4e86\uff0c\u53ef\u4ee5\u521b\u5efa\u65b0\u7684\u5907\u7528\u65e5\u5fd7\u7ee7\u7eed\u5199\u5165\uff0c\u63a8\u8350\uff01\uff01\uff01\r\nservices.AddFileLogging("template-obj.log", options =>\r\n{\r\n options.HandleWriteError = (writeError) =>\r\n {\r\n writeError.UseRollbackFileName(Path.GetFileNameWithoutExtension(writeError.CurrentFileName) + "-oops" + Path.GetExtension(writeError.CurrentFileName));\r\n };\r\n});\n'})}),"\n",(0,i.jsx)(n.h3,{id:"1867-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f93\u51fa\u65f6\u95f4\u683c\u5f0f",children:"18.6.7 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f93\u51fa\u65f6\u95f4\u683c\u5f0f"}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.5.1 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3}",children:'services.AddFileLogging("application.log", options =>\r\n{\r\n options.DateFormat = "yyyy-MM-dd HH:mm:ss.fffffff zzz dddd";\r\n});\n'})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers {1}",children:"info: 2022-09-28 02:02:20(+08:00) \u661f\u671f\u4e09 System.Logging.EventBusService[0] #1\r\n EventBus Hosted Service is running.\r\ninfo: 2022-09-28 02:02:22(+08:00) \u661f\u671f\u4e09 Microsoft.Hosting.Lifetime[14] #1\r\n Now listening on: https://localhost:5001\r\ninfo: 2022-09-28 02:02:22(+08:00) \u661f\u671f\u4e09 Microsoft.Hosting.Lifetime[14] #1\r\n Now listening on: http://localhost:5000\r\ninfo: 2022-09-28 02:02:22(+08:00) \u661f\u671f\u4e09 Microsoft.Hosting.Lifetime[0] #1\r\n Application started. Press Ctrl+C to shut down.\r\ninfo: 2022-09-28 02:02:22(+08:00) \u661f\u671f\u4e09 Microsoft.Hosting.Lifetime[0] #1\r\n Hosting environment: Development\r\ninfo: 2022-09-28 02:02:22(+08:00) \u661f\u671f\u4e09 Microsoft.Hosting.Lifetime[0] #1\r\n Content root path: D:\\Workplaces\\OpenSources\\Furion\\samples\\Furion.Web.Entry\\\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"1868-\u8f93\u51fa\u65e5\u5fd7-traceidhttpcontextid",children:["18.6.8 \u8f93\u51fa\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"TraceId/HttpContextId"})]}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.8.1.3 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u65e5\u5fd7\u7684\u8f93\u51fa\u662f\u975e\u5e38\u9891\u7e41\u7684\uff0c\u4f46\u662f\u5f88\u96be\u4ece\u65e5\u5fd7\u6587\u4ef6\u4e2d\u5224\u65ad\u54ea\u4e9b\u65e5\u5fd7\u662f\u5c5e\u4e8e\u540c\u4e00\u4e2a\u8bf7\u6c42\u8f93\u51fa\u7684\uff0c\u8fd9\u65f6\u542f\u7528 ",(0,i.jsx)(n.code,{children:"WithTraceId"})," \u914d\u7f6e\u5373\u53ef\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:"services.AddFileLogging(options =>\r\n{\r\n options.WithTraceId = true;\r\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u8f93\u51fa\u65e5\u5fd7\u5982\u4e0b\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers {15,17}",children:"info: 2022-11-24 14:34:55.1717549 +08:00 \u661f\u671f\u56db L System.Logging.EventBusService[0] #1\r\n EventBus Hosted Service is running.\r\ninfo: 2022-11-24 14:34:55.2504015 +08:00 \u661f\u671f\u56db L System.Logging.ScheduleService[0] #1\r\n Schedule Hosted Service is running.\r\ninfo: 2022-11-24 14:34:56.4280796 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[14] #1\r\n Now listening on: https://localhost:5001\r\ninfo: 2022-11-24 14:34:56.4331170 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[14] #1\r\n Now listening on: http://localhost:5000\r\ninfo: 2022-11-24 14:34:56.4384567 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[0] #1\r\n Application started. Press Ctrl+C to shut down.\r\ninfo: 2022-11-24 14:34:56.4408766 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[0] #1\r\n Hosting environment: Development\r\ninfo: 2022-11-24 14:34:56.4427659 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[0] #1\r\n Content root path: D:\\Workplaces\\OpenSources\\Furion\\samples\\Furion.Web.Entry\r\ninfo: 2022-11-24 14:35:06.8507338 +08:00 Thursday L Furion.Application.TestLoggerServices[0] #17 '00-48df9ac5c8280de2f301faa44a23a10c-b75678d9f3883b0b-00'\r\n \u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 20\r\ninfo: 2022-11-24 14:35:16.0373384 +08:00 \u661f\u671f\u56db L Furion.Application.TestLoggerServices[0] #17 '00-ff4fb15d6ff41a0411784e66400f0dfd-962bc25eff788b25-00'\r\n \u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 20\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"1869-\u8f93\u51fa\u65e5\u5fd7-\u7a0b\u5e8f\u96c6\u7c7b\u578b\u65b9\u6cd5",children:["18.6.9 \u8f93\u51fa\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"\u7a0b\u5e8f\u96c6/\u7c7b\u578b/\u65b9\u6cd5"})]}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.8.7.16 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u6709\u65f6\u5019\u6211\u4eec\u5e0c\u671b\u77e5\u9053\u8fd9\u4e2a\u65e5\u5fd7\u662f\u5728\u54ea\u4e2a\u7a0b\u5e8f\u96c6\uff0c\u54ea\u4e2a\u7c7b\u4e2d\u54ea\u4e2a\u65b9\u6cd5\u8f93\u51fa\uff0c\u8fd9\u65f6\u542f\u7528 ",(0,i.jsx)(n.code,{children:"WithStackFrame"})," \u914d\u7f6e\u5373\u53ef\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:"services.AddFileLogging(options =>\r\n{\r\n options.WithStackFrame = true;\r\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u8f93\u51fa\u65e5\u5fd7\u5982\u4e0b\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers {2,5,8,11,14,17,20}",children:"info: 2023-03-17 18:25:06.7988349 +08:00 \u661f\u671f\u4e94 L System.Logging.EventBusService[0] #1\r\n [Furion.dll] async Task Furion.EventBus.EventBusHostedService.ExecuteAsync(CancellationToken stoppingToken)\r\n EventBus hosted service is running.\r\ninfo: 2023-03-17 18:25:08.1393952 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[14] #1\r\n [System.Private.CoreLib.dll] void System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start(ref TStateMachine stateMachine)\r\n Now listening on: https://localhost:5001\r\ninfo: 2023-03-17 18:25:08.1620391 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[14] #1\r\n [System.Private.CoreLib.dll] void System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start(ref TStateMachine stateMachine)\r\n Now listening on: http://localhost:5000\r\ninfo: 2023-03-17 18:25:08.1972456 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[0] #1\r\n [Microsoft.Extensions.Hosting.dll] void Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted()\r\n Application started. Press Ctrl+C to shut down.\r\ninfo: 2023-03-17 18:25:08.2456579 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[0] #1\r\n [Microsoft.Extensions.Hosting.dll] void Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted()\r\n Hosting environment: Development\r\ninfo: 2023-03-17 18:25:08.2746134 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[0] #1\r\n [System.Private.CoreLib.dll] void System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(bool throwOnFirstException)\r\n Content root path: D:\\Workplaces\\OpenSources\\Furion\\samples\\Furion.Web.Entry\r\ninfo: 2023-03-17 18:25:18.1917784 +08:00 \u661f\u671f\u4e94 L Furion.Application.TestLoggerServices[0] #16\r\n [Furion.Application.dll] void Furion.Application.TestLoggerServices.\u6d4b\u8bd5\u65e5\u5fd7()\r\n \u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 20\n"})}),"\n",(0,i.jsx)(n.h2,{id:"187-\u8f93\u51fa\u5230\u6570\u636e\u5e93\u5176\u4ed6\u5b58\u50a8\u4ecb\u8d28",children:"18.7 \u8f93\u51fa\u5230\u6570\u636e\u5e93/\u5176\u4ed6\u5b58\u50a8\u4ecb\u8d28"}),"\n",(0,i.jsxs)(n.p,{children:["\u5c06\u65e5\u5fd7\u8f93\u51fa\u5230\u6570\u636e\u5e93\u4e2d\u4e5f\u662f\u975e\u5e38\u5e38\u89c1\u7684\u9700\u6c42\uff0c",(0,i.jsx)(n.code,{children:"Furion"})," \u628a\u8be5\u529f\u80fd\u505a\u5230\u4e86\u975e\u5e38\u7b80\u5355\uff0c\u652f\u6301\u4efb\u4f55\u5b58\u50a8\u4ecb\u8d28\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u5199\u5165\u6570\u636e\u5e93/\u5176\u4ed6\u5b58\u50a8\u4ecb\u8d28\u4e4b\u524d\u9700\u521b\u5efa\u6570\u636e\u5e93\u65e5\u5fd7\u5199\u5165\u5668\u5e76\u5b9e\u73b0 ",(0,i.jsx)(n.code,{children:"IDatabaseLoggingWriter"})," \u63a5\u53e3\uff0c",(0,i.jsx)(n.strong,{children:"\u652f\u6301\u591a\u4e2a"}),"\uff0c\u5982\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,5,8,12}",children:"using Furion.Logging;\r\n\r\nnamespace YourProject.Core;\r\n\r\npublic class DatabaseLoggingWriter : IDatabaseLoggingWriter\r\n{\r\n // \u652f\u6301\u6784\u9020\u51fd\u6570\u6ce8\u5165\u4efb\u4f55\u5b9e\u4f8b\uff0c\u4f1a\u81ea\u52a8\u91ca\u653e\u4efb\u4f55\u670d\u52a1\uff0c\u6bd4\u5982\u6ce8\u5165 IRepository\uff0c\u6216\u8005 SqlSugarClient\r\n public DatabaseLoggingWriter()\r\n {\r\n }\r\n\r\n public void Write(LogMessage logMsg, bool flush)\r\n {\r\n // \u8fd9\u91cc\u5199\u4f60\u4efb\u4f55\u63d2\u5165\u6570\u636e\u5e93\u7684\u64cd\u4f5c\uff0c\u65e0\u9700 try catch\r\n }\r\n}\n"})}),"\n",(0,i.jsxs)(n.admonition,{title:"\u6ce8\u610f\u4e8b\u9879",type:"caution",children:[(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"Furion 4.8.5.4"})," \u7248\u672c\u4e4b\u524d\uff0c\u5982\u679c\u5728 ",(0,i.jsx)(n.code,{children:"DatabaseLoggingWriter"})," \u4e2d\u6ce8\u5165 ",(0,i.jsx)(n.code,{children:"ILogger<>"})," \u5bf9\u8c61\u5c06\u4f1a\u5bfc\u81f4\u6b7b\u5faa\u73af\uff0c\u539f\u56e0\u662f ",(0,i.jsx)(n.code,{children:"IDatabaseLoggingWriter"})," \u672c\u8eab\u5c31\u662f\u65e5\u5fd7\u8f93\u51fa\u7684\u6700\u7ec8\u4ecb\u8d28\uff0c\u5982\u679c\u8fd9\u91cc\u8fd8\u8f93\u51fa\u65e5\u5fd7\uff0c\u5c06\u5bfc\u81f4\u9012\u5f52\u521d\u59cb\u5316\u65e5\u5fd7\u5b9e\u4f8b\u3002"]}),(0,i.jsxs)(n.p,{children:["\u4f46\u5728 ",(0,i.jsx)(n.code,{children:"Furion 4.8.5.4+"})," \u7248\u672c\u4e4b\u540e\uff0c\u5982\u679c\u6ce8\u5165\u4e86 ",(0,i.jsx)(n.code,{children:"ILogger<>"})," \u5b9e\u4f8b\uff0c\u90a3\u4e48\u5c06\u5f3a\u5236\u6027\u5c06\u5b9e\u4f8b\u5316\u5bf9\u8c61\u4e3a ",(0,i.jsx)(n.code,{children:"EmptyLogger"})," \u5bf9\u8c61\uff0c\u4f46\u8c03\u7528\u5176\u8f93\u51fa\u65e5\u5fd7\u65b9\u6cd5\u5c06\u4e0d\u4f1a\u6709\u4efb\u4f55\u6548\u679c\uff0c\u5982\uff1a",(0,i.jsx)(n.code,{children:'logger.LogInformation("...")'}),";"]})]}),"\n",(0,i.jsx)(n.p,{children:"\u4f60\u6ca1\u770b\u9519\uff0c\u5c31\u8fd9\u4e48\u7b80\u5355\uff01\uff01"}),"\n",(0,i.jsx)(n.h3,{id:"1871-\u57fa\u7840\u4f7f\u7528",children:"18.7.1 \u57fa\u7840\u4f7f\u7528"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,5}",children:"// \u4f8b\u5b50\u4e00\uff0c\u9ed8\u8ba4\u914d\u7f6e\r\nservices.AddDatabaseLogging(options => {});\r\n\r\n// \u4f8b\u5b50\u4e8c\uff1a\u81ea\u5b9a\u4e49\u914d\u7f6e\r\nservices.AddDatabaseLogging(options =>\r\n{\r\n options.MinimumLevel = LogLevel.Warning;\r\n\r\n // \u5176\u4ed6\u914d\u7f6e...\r\n});\n"})}),"\n",(0,i.jsx)(n.h3,{id:"1872-\u4ece\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bfb\u53d6",children:"18.7.2 \u4ece\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bfb\u53d6"}),"\n",(0,i.jsx)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:(0,i.jsx)(n.p,{children:(0,i.jsxs)(n.strong,{children:["\u53ea\u6709 ",(0,i.jsx)(n.code,{children:".AddDatabase"})," \u7b2c\u4e00\u4e2a\u53c2\u6570\u4e3a\u7a7a\u624d\u4f1a\u81ea\u52a8\u52a0\u8f7d\u914d\u7f6e\u3002"]})})}),"\n",(0,i.jsx)(n.p,{children:"\u6570\u636e\u5e93\u65e5\u5fd7\u914d\u7f6e\u8bf4\u660e\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers {2,7-9,12-14}",children:'{\r\n "Logging": {\r\n "LogLevel": {\r\n "Default": "Information"\r\n // .... appsettings \u9ed8\u8ba4\u914d\u7f6e\r\n },\r\n "Database": {\r\n "MinimumLevel": "Information" // \u6700\u4f4e\u65e5\u5fd7\u8bb0\u5f55\u7ea7\u522b\r\n }\r\n },\r\n // \u81ea\u5b9a\u4e49\u914d\u7f6e\u8282\u70b9\r\n "MyLogger": {\r\n "MinimumLevel": "Information"\r\n }\r\n}\n'})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,5,5,18,25}",children:'// \u4f8b\u5b50\u4e00\uff1a\u9ed8\u8ba4\u8bfb\u53d6 Logging:Database \u8282\u70b9\r\nservices.AddDatabaseLogging();\r\n\r\n// \u4f8b\u5b50\u4e8c\uff1a\u9ed8\u8ba4\u8bfb\u53d6 Logging:Database \u8282\u70b9\uff0c\u652f\u6301\u66f4\u591a\u914d\u7f6e\r\nservices.AddDatabaseLogging(default(string), options =>\r\n{\r\n options.MinimumLevel = LogLevel.Warning;\r\n\r\n // \u5176\u4ed6\u914d\u7f6e...\r\n});\r\n\r\n// \u4f8b\u5b50\u4e09\uff1a\u81ea\u5b9a\u4e49\u914d\u7f6e\u8282\u70b9\r\nservices.AddDatabaseLogging("MyLogger");\r\n// \u6216\r\nservices.AddDatabaseLogging(() => "MyLogger");\r\n\r\n// \u4f8b\u5b50\u56db\uff1a\u81ea\u5b9a\u4e49\u914d\u7f6e\u8282\u70b9\uff0c\u652f\u6301\u66f4\u591a\u914d\u7f6e\r\nservices.AddDatabaseLogging("MyLogger", options =>\r\n{\r\n options.MinimumLevel = LogLevel.Warning;\r\n\r\n // \u5176\u4ed6\u914d\u7f6e...\r\n});\r\n// \u6216\r\nservices.AddDatabaseLogging(() => "MyLogger", options =>\r\n{\r\n options.MinimumLevel = LogLevel.Warning;\r\n\r\n // \u5176\u4ed6\u914d\u7f6e...\r\n});\n'})}),"\n",(0,i.jsx)(n.h3,{id:"1873-\u65e5\u5fd7\u8fc7\u6ee4\u5668\u7b5b\u9009\u5668",children:"18.7.3 \u65e5\u5fd7\u8fc7\u6ee4\u5668/\u7b5b\u9009\u5668"}),"\n",(0,i.jsx)(n.p,{children:"\u901a\u8fc7\u65e5\u5fd7\u7b5b\u9009\u5668\u53ef\u4ee5\u5bf9\u65e5\u5fd7\u8fdb\u884c\u5f52\u7c7b\u5199\u5165"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,10,19}",children:'// \u4f8b\u5b50\u4e00\uff1a\u6839\u636e\u65e5\u5fd7\u7ea7\u522b\u8f93\u51fa\uff0c\u53ef\u4ee5\u5206\u522b\u5b9a\u4e49 IDatabaseLoggingWriter\uff0c\u4e5f\u53ef\u4ee5\u7528\u540c\u4e00\u4e2a\u5e95\u5c42\u8fdb\u884c\u5224\u65ad\r\nservices.AddDatabaseLogging(options =>\r\n{\r\n options.WriteFilter = (logMsg) =>\r\n {\r\n return logMsg.LogLevel == LogLevel.Information;\r\n };\r\n});\r\n// \u53ef\u4ee5\u5206\u522b\u5b9a\u4e49 IDatabaseLoggingWriter\uff0c\u4e5f\u53ef\u4ee5\u7528\u540c\u4e00\u4e2a\u5e95\u5c42\u8fdb\u884c\u5224\u65ad\r\nservices.AddDatabaseLogging(options =>\r\n{\r\n options.WriteFilter = (logMsg) =>\r\n {\r\n return logMsg.LogLevel == LogLevel.Error;\r\n };\r\n});\r\n\r\n// \u4f8b\u5b50\u4e8c\uff0c\u6839\u636e\u4efb\u4f55\u89c4\u5219\uff0c\u6bd4\u5982\u7279\u5b9a\u7684\u7c7b\u540d\r\nservices.AddDatabaseLogging(options =>\r\n{\r\n options.WriteFilter = (logMsg) =>\r\n {\r\n return logMsg.LogName.Contains("SomeClassName");\r\n };\r\n});\n'})}),"\n",(0,i.jsx)(n.h3,{id:"1874-\u81ea\u5b9a\u4e49\u65e5\u5fd7\u6a21\u677f",children:"18.7.4 \u81ea\u5b9a\u4e49\u65e5\u5fd7\u6a21\u677f"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3,15,17}",children:'services.AddDatabaseLogging(options =>\r\n{\r\n options.MessageFormat = (logMsg) =>\r\n {\r\n var stringBuilder = new StringBuilder();\r\n\r\n stringBuilder.Append(DateTime.Now.ToString("o"));\r\n // \u5176\u4ed6\u7684\u3002\u3002\u3002\u81ea\u5df1\u7ec4\u88c5\r\n\r\n return stringBuilder.ToString();\r\n };\r\n});\r\n\r\n// \u8f93\u51fa\u4e3a JSON \u683c\u5f0f\uff0cFurion 4.5.2+\r\nservices.AddDatabaseLogging(options =>\r\n{\r\n options.MessageFormat = LoggerFormatter.Json;\r\n // Furion 4.8.0+ \u65b0\u589e JSON \u7f8e\u5316\u8f93\u51fa\r\n options.MessageFormat = LoggerFormatter.JsonIndented;\r\n});\n'})}),"\n",(0,i.jsx)(n.h3,{id:"1875-\u65e5\u5fd7\u5199\u5165\u5931\u8d25\u5904\u7406",children:"18.7.5 \u65e5\u5fd7\u5199\u5165\u5931\u8d25\u5904\u7406"}),"\n",(0,i.jsx)(n.p,{children:"\u6709\u65f6\u5019\u53ef\u80fd\u56e0\u4e3a\u6570\u636e\u5e93\u8fde\u63a5\u5f02\u5e38\u6216\u5176\u4ed6\u539f\u56e0\u8fde\u63a5\u6c60\u6ee1\uff0c\u90a3\u4e48\u5c31\u4f1a\u5bfc\u81f4\u65e5\u5fd7\u5199\u5165\u5931\u8d25\uff0c\u8fd9\u65f6\u5019\u53ef\u4ee5\u8fdb\u884c\u5176\u4ed6\u76f8\u5173\u5904\u7406\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2}",children:"// \u4f8b\u5b50\u4e00\uff1a\u5176\u4ed6\u5904\u7406\r\nservices.AddDatabaseLogging(options =>\r\n{\r\n options.HandleWriteError = (writeError) =>\r\n {\r\n // ~~\r\n };\r\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"1876-\u8f93\u51fa\u65e5\u5fd7-traceidhttpcontextid",children:["18.7.6 \u8f93\u51fa\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"TraceId/HttpContextId"})]}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.8.1.3 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u65e5\u5fd7\u7684\u8f93\u51fa\u662f\u975e\u5e38\u9891\u7e41\u7684\uff0c\u4f46\u662f\u5f88\u96be\u4ece\u65e5\u5fd7\u6587\u4ef6\u4e2d\u5224\u65ad\u54ea\u4e9b\u65e5\u5fd7\u662f\u5c5e\u4e8e\u540c\u4e00\u4e2a\u8bf7\u6c42\u8f93\u51fa\u7684\uff0c\u8fd9\u65f6\u542f\u7528 ",(0,i.jsx)(n.code,{children:"WithTraceId"})," \u914d\u7f6e\u5373\u53ef\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:"services.AddDatabaseLogging(options =>\r\n{\r\n options.WithTraceId = true;\r\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u8f93\u51fa\u65e5\u5fd7\u5982\u4e0b\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers {15,17}",children:"info: 2022-11-24 14:34:55.1717549 +08:00 \u661f\u671f\u56db L System.Logging.EventBusService[0] #1\r\n EventBus Hosted Service is running.\r\ninfo: 2022-11-24 14:34:55.2504015 +08:00 \u661f\u671f\u56db L System.Logging.ScheduleService[0] #1\r\n Schedule Hosted Service is running.\r\ninfo: 2022-11-24 14:34:56.4280796 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[14] #1\r\n Now listening on: https://localhost:5001\r\ninfo: 2022-11-24 14:34:56.4331170 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[14] #1\r\n Now listening on: http://localhost:5000\r\ninfo: 2022-11-24 14:34:56.4384567 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[0] #1\r\n Application started. Press Ctrl+C to shut down.\r\ninfo: 2022-11-24 14:34:56.4408766 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[0] #1\r\n Hosting environment: Development\r\ninfo: 2022-11-24 14:34:56.4427659 +08:00 \u661f\u671f\u56db L Microsoft.Hosting.Lifetime[0] #1\r\n Content root path: D:\\Workplaces\\OpenSources\\Furion\\samples\\Furion.Web.Entry\r\ninfo: 2022-11-24 14:35:06.8507338 +08:00 Thursday L Furion.Application.TestLoggerServices[0] #17 '00-48df9ac5c8280de2f301faa44a23a10c-b75678d9f3883b0b-00'\r\n \u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 20\r\ninfo: 2022-11-24 14:35:16.0373384 +08:00 \u661f\u671f\u56db L Furion.Application.TestLoggerServices[0] #17 '00-ff4fb15d6ff41a0411784e66400f0dfd-962bc25eff788b25-00'\r\n \u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 20\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"1877-\u8f93\u51fa\u65e5\u5fd7-\u7a0b\u5e8f\u96c6\u7c7b\u578b\u65b9\u6cd5",children:["18.7.7 \u8f93\u51fa\u65e5\u5fd7 ",(0,i.jsx)(n.code,{children:"\u7a0b\u5e8f\u96c6/\u7c7b\u578b/\u65b9\u6cd5"})]}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.8.7.16 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u6709\u65f6\u5019\u6211\u4eec\u5e0c\u671b\u77e5\u9053\u8fd9\u4e2a\u65e5\u5fd7\u662f\u5728\u54ea\u4e2a\u7a0b\u5e8f\u96c6\uff0c\u54ea\u4e2a\u7c7b\u4e2d\u54ea\u4e2a\u65b9\u6cd5\u8f93\u51fa\uff0c\u8fd9\u65f6\u542f\u7528 ",(0,i.jsx)(n.code,{children:"WithStackFrame"})," \u914d\u7f6e\u5373\u53ef\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:"services.AddDatabaseLogging(options =>\r\n{\r\n options.WithStackFrame = true;\r\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u8f93\u51fa\u65e5\u5fd7\u5982\u4e0b\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers {2,5,8,11,14,17,20}",children:"info: 2023-03-17 18:25:06.7988349 +08:00 \u661f\u671f\u4e94 L System.Logging.EventBusService[0] #1\r\n [Furion.dll] async Task Furion.EventBus.EventBusHostedService.ExecuteAsync(CancellationToken stoppingToken)\r\n EventBus hosted service is running.\r\ninfo: 2023-03-17 18:25:08.1393952 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[14] #1\r\n [System.Private.CoreLib.dll] void System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start(ref TStateMachine stateMachine)\r\n Now listening on: https://localhost:5001\r\ninfo: 2023-03-17 18:25:08.1620391 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[14] #1\r\n [System.Private.CoreLib.dll] void System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start(ref TStateMachine stateMachine)\r\n Now listening on: http://localhost:5000\r\ninfo: 2023-03-17 18:25:08.1972456 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[0] #1\r\n [Microsoft.Extensions.Hosting.dll] void Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted()\r\n Application started. Press Ctrl+C to shut down.\r\ninfo: 2023-03-17 18:25:08.2456579 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[0] #1\r\n [Microsoft.Extensions.Hosting.dll] void Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted()\r\n Hosting environment: Development\r\ninfo: 2023-03-17 18:25:08.2746134 +08:00 \u661f\u671f\u4e94 L Microsoft.Hosting.Lifetime[0] #1\r\n [System.Private.CoreLib.dll] void System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(bool throwOnFirstException)\r\n Content root path: D:\\Workplaces\\OpenSources\\Furion\\samples\\Furion.Web.Entry\r\ninfo: 2023-03-17 18:25:18.1917784 +08:00 \u661f\u671f\u4e94 L Furion.Application.TestLoggerServices[0] #16\r\n [Furion.Application.dll] void Furion.Application.TestLoggerServices.\u6d4b\u8bd5\u65e5\u5fd7()\r\n \u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 20\n"})}),"\n",(0,i.jsx)(n.h3,{id:"1878-\u5173\u4e8e\u9ad8\u9891\u5199\u5165\u5b58\u50a8\u4ecb\u8d28",children:"18.7.8 \u5173\u4e8e\u9ad8\u9891\u5199\u5165\u5b58\u50a8\u4ecb\u8d28"}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u4e00\u4e9b\u9ad8\u9891\u5199\u5165\u5b58\u50a8\u4ecb\u8d28\uff08\u5982\u6570\u636e\u5e93\uff09\u65e5\u5fd7\u7684\u573a\u666f\uff0c\u4e3a\u907f\u514d\u9891\u7e41\u89e3\u6790\u670d\u52a1\uff08\u521b\u5efa\u548c\u9500\u6bc1\u94fe\u63a5\uff09\u548c\u521b\u5efa\u4f5c\u7528\u57df\u5bfc\u81f4\u5185\u5b58\u53ca ",(0,i.jsx)(n.code,{children:"CPU"})," \u98d9\u9ad8\uff0c\u53ef\u4f7f\u7528 ",(0,i.jsx)(n.strong,{children:"\u7c7b\u5168\u5c40\u4f5c\u7528\u57df"})," \u548c\u6240\u6709\u670d\u52a1\u90fd\u91c7\u53d6\u5355\u4f8b\u7684\u65b9\u5f0f\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3,8-9,14,20-23}",children:"public class DatabaseLoggingWriter : IDatabaseLoggingWriter, IDisposable\r\n{\r\n private readonly IServiceScope _serviceScope;\r\n private readonly IRepository _logRepository; // \u53ef\u66ff\u6362\u6210\u4efb\u4f55\u6570\u636e\u5e93\u64cd\u4f5c\u5e93\r\n\r\n public DatabaseLoggingWriter(IServiceScopeFactory scopeFactory)\r\n {\r\n _serviceScope = scopeFactory.CreateScope();\r\n _logRepository = _serviceScope.ServiceProvider.GetRequiredService>();\r\n }\r\n\r\n public void Write(LogMessage logMsg, bool flush)\r\n {\r\n _logRepository.Insert(.....);\r\n }\r\n\r\n /// \r\n /// \u91ca\u653e\u670d\u52a1\u4f5c\u7528\u57df\r\n /// \r\n public void Dispose()\r\n {\r\n _serviceScope.Dispose();\r\n }\r\n}\n"})}),"\n",(0,i.jsx)(n.h3,{id:"1879-\u5173\u4e8e\u6570\u636e\u5e93\u65e5\u5fd7\u5faa\u73af\u8f93\u51fa\u65e5\u5fd7",children:"18.7.9 \u5173\u4e8e\u6570\u636e\u5e93\u65e5\u5fd7\u5faa\u73af\u8f93\u51fa\u65e5\u5fd7"}),"\n",(0,i.jsxs)(n.p,{children:["\u5fae\u8f6f\u63d0\u4f9b\u7684 ",(0,i.jsx)(n.code,{children:"EFCore"})," \u6216\u8005\u7b2c\u4e09\u65b9 ",(0,i.jsx)(n.code,{children:"ORM"})," \u672c\u8eab\u64cd\u4f5c\u6570\u636e\u5e93\u65f6\u81ea\u5e26\u65e5\u5fd7\u8f93\u51fa\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4 ",(0,i.jsx)(n.code,{children:"IDatabaseLoggingWriter"})," \u7684 ",(0,i.jsx)(n.code,{children:"Write"})," \u6b7b\u5faa\u73af\uff0c\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u6709\u4ee5\u4e0b\u65b9\u6cd5\uff1a"]}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsx)(n.li,{children:"\u521b\u5efa\u65b0\u7684\u6570\u636e\u5e93\u64cd\u4f5c\u5b9e\u4f8b\u5e76\u5173\u95ed\u65e5\u5fd7"}),"\n",(0,i.jsxs)(n.li,{children:["\u66f4\u65b0\u5230 ",(0,i.jsx)(n.code,{children:"Furion 4.7.0+"})," \u7248\u672c ",(0,i.jsx)(n.strong,{children:"\uff08\u63a8\u8350\uff09"})]}),"\n",(0,i.jsx)(n.li,{children:"\u81ea\u884c\u6839\u636e\u4e1a\u52a1\u903b\u8f91\u8fc7\u6ee4"}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"\u5982\u4e0d\u5b58\u5728\u8be5\u95ee\u9898\u53ef\u5173\u95ed\u6846\u67b6\u81ea\u5e26\u6b7b\u5faa\u73af\u68c0\u6d4b\u529f\u80fd\uff08\u5bf9\u6027\u80fd\u6709\u63d0\u5347\u4f5c\u7528\uff09"}),"\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:"services.AddDatabaseLogging(options =>\r\n{\r\n options.IgnoreReferenceLoop = false;\r\n});\n"})}),"\n",(0,i.jsx)(n.h2,{id:"188-\u6dfb\u52a0\u65e5\u5fd7\u63d0\u4f9b\u5668\u65b9\u5f0f",children:"18.8 \u6dfb\u52a0\u65e5\u5fd7\u63d0\u4f9b\u5668\u65b9\u5f0f"}),"\n",(0,i.jsx)(n.p,{children:"\u6846\u67b6\u63d0\u4f9b\u4e86\u591a\u79cd\u6dfb\u52a0\u65e5\u5fd7\u63d0\u4f9b\u5668\u65b9\u5f0f\uff0c\u53ef\u5728\u5e94\u7528\u542f\u52a8\u6216\u8fd0\u884c\u65f6\u3002"}),"\n",(0,i.jsxs)(n.h3,{id:"1881-loggerfactory-\u65b9\u5f0f",children:["18.8.1 ",(0,i.jsx)(n.code,{children:"LoggerFactory"})," \u65b9\u5f0f"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"Furion"})," \u4e5f\u63d0\u4f9b\u4e86\u8fd0\u884c\u65f6\u52a8\u6001\u6dfb\u52a0\u65e5\u5fd7\u63d0\u4f9b\u5668\u5e76\u5199\u5165\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3-4,8-12,23-26}",children:'public class SomeController : IDynamicApiController, IDisposable\r\n{\r\n private readonly ILoggerFactory _loggerFactory;\r\n private readonly ILogger _logger;\r\n\r\n public SomeController()\r\n {\r\n _loggerFactory = LoggerFactory.Create(builder =>\r\n {\r\n builder.AddFile("application.log");\r\n });\r\n _logger = _loggerFactory.CreateLogger("MyCategory");\r\n\r\n // \u53ef\u4ee5\u591a\u4e2a\u91cd\u590d\u4e0a\u9762\u4ee3\u7801\r\n }\r\n\r\n [HttpGet]\r\n public void SomeAction()\r\n {\r\n _logger.LogInformation("some log...");\r\n }\r\n\r\n public void Dispose()\r\n {\r\n _loggerFactory.Dispose();\r\n }\r\n}\n'})}),"\n",(0,i.jsxs)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"warning",children:[(0,i.jsxs)(n.p,{children:["\u901a\u8fc7\u8fd0\u884c\u65f6\u7684\u65b9\u5f0f\u9700\u8981\u81ea\u884c\u91ca\u653e ",(0,i.jsx)(n.code,{children:"ILoggerFactory"})," \u5bf9\u8c61\uff0c\u4e5f\u5c31\u662f\u9700\u8981\u5b9e\u73b0 ",(0,i.jsx)(n.code,{children:"IDisposable"})," \u63a5\u53e3\uff0c\u7136\u540e\u8fdb\u884c ",(0,i.jsx)(n.code,{children:"_loggerFactory"})," \u91ca\u653e\u3002"]}),(0,i.jsxs)(n.p,{children:["\u53ef\u67e5\u770b\u76f8\u5173 ",(0,i.jsx)(n.code,{children:"Issue"}),"\uff1a",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I7KJ5H",children:"https://gitee.com/dotnetchina/Furion/issues/I7KJ5H"})]})]}),"\n",(0,i.jsxs)(n.h3,{id:"1882-iloggingbuilder-\u65b9\u5f0f",children:["18.8.2 ",(0,i.jsx)(n.code,{children:"ILoggingBuilder"})," \u65b9\u5f0f"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"Furion"})," \u4e5f\u63d0\u4f9b\u4e86\u539f\u751f ",(0,i.jsx)(n.code,{children:"services.AddLogging(builder => {})"})," \u65b9\u5f0f\u914d\u7f6e\uff0c\u5982"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3,5}",children:'services.AddLogging(builder =>\r\n{\r\n\tbuilder.AddFile("applicaion.log");\r\n\r\n builder.AddDatabase();\r\n\r\n //....\r\n});\n'})}),"\n",(0,i.jsx)(n.h2,{id:"189-\u8bb0\u5f55\u8bf7\u6c42\u65e5\u5fd7",children:"18.9 \u8bb0\u5f55\u8bf7\u6c42\u65e5\u5fd7"}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"ASP.NET 6"})," \u4e2d\uff0c\u6846\u67b6\u9ed8\u8ba4\u63d0\u4f9b\u4e86 ",(0,i.jsx)(n.code,{children:"app.UseHttpLogging()"})," \u8bb0\u5f55 ",(0,i.jsx)(n.code,{children:"HTTP"})," \u8bf7\u6c42\u65e5\u5fd7\u529f\u80fd\uff0c\u8be6\u7ec6\u4e86\u89e3\u53ef\u67e5\u770b\u5b98\u65b9\u6587\u6863 ",(0,i.jsx)(n.a,{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/http-logging/?view=aspnetcore-6.0",children:"ASP.NET Core - HTTP \u65e5\u5fd7\u8bb0\u5f55"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5f53\u7136\u4e5f\u53ef\u4ee5\u81ea\u5b9a\u4e49\u4e2d\u95f4\u4ef6\u7684\u65b9\u5f0f\u5199\uff0c\u53ea\u9700\u8981\u6ce8\u5165 ",(0,i.jsx)(n.code,{children:"ILogger<>"})," \u63a5\u53e3\u5373\u53ef\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"1810-debug-\u548c-trace-\u9ed8\u8ba4\u4e0d\u8f93\u51fa\u95ee\u9898",children:["18.10 ",(0,i.jsx)(n.code,{children:"Debug"})," \u548c ",(0,i.jsx)(n.code,{children:"Trace"})," \u9ed8\u8ba4\u4e0d\u8f93\u51fa\u95ee\u9898"]}),"\n",(0,i.jsxs)(n.p,{children:["\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5fae\u8f6f\u5728 ",(0,i.jsx)(n.code,{children:"appsettings.json"})," \u548c ",(0,i.jsx)(n.code,{children:"appsettings.Development.json"})," \u4e2d\u914d\u7f6e\u4e86 ",(0,i.jsx)(n.code,{children:"Default"})," \u65e5\u5fd7\u7ea7\u522b\uff0c\u5982\u9700\u81ea\u5b9a\u4e49\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers {4}",children:'{\r\n "Logging": {\r\n "LogLevel": {\r\n "Default": "Information"\r\n }\r\n }\r\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u8fd9\u65f6\u5019\u53ea\u9700\u8981\u4fee\u6539 ",(0,i.jsx)(n.code,{children:"Default"})," \u4e3a ",(0,i.jsx)(n.code,{children:"Debug"})," \u6216 ",(0,i.jsx)(n.code,{children:"Trace"})," \u5373\u53ef\uff0c",(0,i.jsxs)(n.strong,{children:["\u6ce8\u610f\u4e0d\u540c\u73af\u5883\u52a0\u8f7d\u4e0d\u540c\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u5f00\u53d1\u73af\u5883\u5e94\u4fee\u6539 ",(0,i.jsx)(n.code,{children:"appsettings.Development.json"})," \u4e0b\u7684\u914d\u7f6e\u3002"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"1811-loggingmonitor-\u76d1\u542c\u65e5\u5fd7",children:["18.11 ",(0,i.jsx)(n.code,{children:"[LoggingMonitor]"})," \u76d1\u542c\u65e5\u5fd7"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"Furion 3.9.1"})," \u7248\u672c\u65b0\u589e\u4e86 ",(0,i.jsx)(n.code,{children:"[LoggingMonitor]"})," \u7279\u6027\uff0c\u652f\u6301\u5728\u63a7\u5236\u5668\u6216\u64cd\u4f5c\u4e2d\u8d34\u8be5\u7279\u6027\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5f3a\u5927\u7684\u8bf7\u6c42\u65e5\u5fd7\u76d1\u542c\uff0c\u65b9\u4fbf\u6d4b\u8bd5\uff0c\u5982\uff1a"]}),"\n",(0,i.jsx)(n.h3,{id:"18111-\u7279\u6027\u914d\u7f6e",children:"18.11.1 \u7279\u6027\u914d\u7f6e"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,7}",children:"using Furion.Logging;\r\n\r\nnamespace Furion.Application;\r\n\r\npublic class TestLoggerServices : IDynamicApiController\r\n{\r\n [LoggingMonitor]\r\n public PersonDto GetPerson(int id)\r\n {\r\n return new PersonDto\r\n {\r\n Id = id\r\n };\r\n }\r\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"[LoggingMonitor]"})," \u652f\u6301\u4ee5\u4e0b\u914d\u7f6e\uff1a","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"Title"}),"\uff1a\u914d\u7f6e\u6807\u9898\uff0c",(0,i.jsx)(n.code,{children:"string"})," \u7c7b\u578b\uff0c\u9ed8\u8ba4 ",(0,i.jsx)(n.code,{children:"Logging Monitor"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"WithReturnValue"}),"\uff1a\u662f\u5426\u5305\u542b\u8fd4\u56de\u503c\u6253\u5370\uff0c",(0,i.jsx)(n.code,{children:"bool"})," \u7c7b\u578b\uff0c\u9ed8\u8ba4 ",(0,i.jsx)(n.code,{children:"true"}),"\uff0c",(0,i.jsx)(n.code,{children:"Furion 4.3.9+ \u6709\u6548"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"ReturnValueThreshold"}),"\uff1a\u914d\u7f6e\u8fd4\u56de\u503c\u5b57\u7b26\u4e32\u9608\u503c\uff0c",(0,i.jsx)(n.code,{children:"int"})," \u7c7b\u578b\uff0c\u9ed8\u8ba4 ",(0,i.jsx)(n.code,{children:"0"})," \u5168\u91cf\u8f93\u51fa\uff0c",(0,i.jsx)(n.code,{children:"Furion 4.3.9+ \u6709\u6548"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"JsonBehavior"}),"\uff1a\u914d\u7f6e ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," ",(0,i.jsx)(n.code,{children:"Json"})," \u8f93\u51fa\u884c\u4e3a\uff0c\u9ed8\u8ba4 ",(0,i.jsx)(n.code,{children:"None"}),"\uff0c",(0,i.jsx)(n.code,{children:"Furion 4.5.2+"})," \u6709\u6548"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"JsonIndented"}),"\uff1a\u914d\u7f6e ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," ",(0,i.jsx)(n.code,{children:"Json"})," \u683c\u5f0f\u5316\u884c\u4e3a\uff0c",(0,i.jsx)(n.code,{children:"bool"})," \u7c7b\u578b\uff0c\u9ed8\u8ba4 ",(0,i.jsx)(n.code,{children:"false"}),"\uff0c",(0,i.jsx)(n.code,{children:"Furion 4.8.0+"})," \u6709\u6548"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u8f93\u51fa\u65e5\u5fd7\u4e3a\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:'\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 Logging Monitor \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\r\n\u2523 Furion.Application.TestLoggerServices.GetPerson (Furion.Application)\r\n\u2523\r\n\u2523 \u63a7\u5236\u5668\u540d\u79f0\uff1a TestLoggerServices\r\n\u2523 \u64cd\u4f5c\u540d\u79f0\uff1a GetPerson\r\n\u2523 \u8def\u7531\u4fe1\u606f\uff1a [area]: ; [controller]: test-logger; [action]: person\r\n\u2523 \u8bf7\u6c42\u65b9\u5f0f\uff1a POST\r\n\u2523 \u8bf7\u6c42\u5730\u5740\uff1a https://localhost:44316/api/test-logger/person/11\r\n\u2523 \u6765\u6e90\u5730\u5740\uff1a https://localhost:44316/api/index.html\r\n\u2523 \u6d4f\u89c8\u5668\u6807\u8bc6\uff1a Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 Edg/103.0.1264.62\r\n\u2523 \u5ba2\u6237\u7aef IP \u5730\u5740\uff1a 0.0.0.1\r\n\u2523 \u670d\u52a1\u7aef IP \u5730\u5740\uff1a 0.0.0.1\r\n\u2523 \u670d\u52a1\u7aef\u8fd0\u884c\u73af\u5883\uff1a Development\r\n\u2523 \u6267\u884c\u8017\u65f6\uff1a 31ms\r\n\u2523 \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 \u6388\u6743\u4fe1\u606f \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\r\n\u2523 JWT Token\uff1a Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjEsIkFjY291bnQiOiJhZG1pbiIsImlhdCI6MTY1ODcxNjc5NywibmJmIjoxNjU4NzE2Nzk3LCJleHAiOjE2NTg3MTc5OTcsImlzcyI6ImRvdG5ldGNoaW5hIiwiYXVkIjoicG93ZXJieSBGdXJpb24ifQ.VYZkwwqCwlUy3aJjuL-og62I0rkxNQ96kSjEm3VgXtg\r\n\u2523\r\n\u2523 UserId (integer)\uff1a 1\r\n\u2523 Account (string)\uff1a admin\r\n\u2523 iat (integer)\uff1a 1658716797\r\n\u2523 nbf (integer)\uff1a 1658716797\r\n\u2523 exp (integer)\uff1a 1658717997\r\n\u2523 iss (string)\uff1a dotnetchina\r\n\u2523 aud (string)\uff1a powerby Furion\r\n\u2523 \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 \u53c2\u6570\u5217\u8868 \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\r\n\u2523 Content-Type\uff1a\r\n\u2523\r\n\u2523 id (Int32)\uff1a 11\r\n\u2523 \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 \u8fd4\u56de\u4fe1\u606f \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\r\n\u2523 \u7c7b\u578b\uff1a Furion.Application.Persons.PersonDto\r\n\u2523 \u8fd4\u56de\u503c\uff1a {"Id":11,"Name":null,"Age":0,"Address":null,"PhoneNumber":null,"QQ":null,"CreatedTime":"0001-01-01T00:00:00+00:00","Childrens":null,"Posts":null}\r\n\u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 Logging Monitor \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n'})}),"\n",(0,i.jsx)(n.h3,{id:"18112-\u5168\u5c40\u914d\u7f6e",children:"18.11.2 \u5168\u5c40\u914d\u7f6e"}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u9700\u5168\u5c40\u542f\u7528 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u529f\u80fd\uff0c\u65e0\u9700\u5728\u6bcf\u4e2a\u63a7\u5236\u5668\u6216\u8005\u65b9\u6cd5\u4e2d\u8d34\uff0c\u5168\u5c40\u6ce8\u518c\u5982\u4e0b\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"// \u8bf7\u4f7f\u7528 services.AddMonitorLogging(); \u66ff\u4ee3\uff0c\u5e76\u542f\u7528 GlobalEnabled: true\r\nservices.AddMvcFilter();\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"tip",children:[(0,i.jsxs)(n.mdxAdmonitionTitle,{children:[(0,i.jsx)(n.code,{children:"Furion 4.0.2"})," \u65b0\u63a8\u8350\u914d\u7f6e"]}),(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"Furion 4.0.2"})," \u7248\u672c\u4e2d\u65b0\u589e\u4e86\u975e\u5e38\u7075\u6d3b\u65b9\u4fbf\u7684 ",(0,i.jsx)(n.code,{children:"services.AddMonitorLogging()"})," \u670d\u52a1\u914d\u7f6e\uff0c\u53ef\u5728\u914d\u7f6e\u4e2d\u968f\u610f\u63a7\u5236\u54ea\u4e2a\u7c7b\u54ea\u4e2a\u65b9\u6cd5\u542f\u7528\u6216\u4e0d\u542f\u7528\u3002"]}),(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u6ce8\u518c\u670d\u52a1"}),"\n"]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddMonitorLogging(); // \u9ed8\u8ba4\u8bfb\u53d6 Logging:Monitor \u4e0b\u914d\u7f6e\uff0c\u652f\u6301\u4f20\u5165\u53c2\u6570\u81ea\u5b9a\u4e49\n"})}),(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u6dfb\u52a0\u914d\u7f6e"}),"\n"]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers {2,3,4-6}",children:'{\r\n "Logging": {\r\n "Monitor": {\r\n "GlobalEnabled": false, // \u662f\u5426\u542f\u7528\u5168\u5c40\u62e6\u622a\uff0c\u9ed8\u8ba4 `false`\r\n "IncludeOfMethods": [], // \u662f\u5426\u6307\u5b9a\u62e6\u622a\u7279\u5b9a\u65b9\u6cd5\uff0c\u5f53 GlobalEnabled: false \u6709\u6548\r\n "ExcludeOfMethods": [], // \u662f\u5426\u6307\u5b9a\u6392\u9664\u7279\u5b9a\u65b9\u6cd5\uff0c\u5f53 GlobalEnabled: true \u6709\u6548\r\n "LogLevel": "Information", // \u914d\u7f6e\u76d1\u542c\u65e5\u5fd7\u8f93\u51fa\u7ea7\u522b\uff0c\u9ed8\u8ba4 Information\r\n "BahLogLevel": "Information", // \u914d\u7f6e Oops.Oh \u548c Oops.Bah \u4e1a\u52a1\u65e5\u5fd7\u8f93\u51fa\u7ea7\u522b\uff0c\u9ed8\u8ba4 Information\r\n "WithReturnValue": true, // \u914d\u7f6e\u662f\u5426\u5305\u542b\u8fd4\u56de\u503c\uff0c\u9ed8\u8ba4 `true`\uff0cFurion 4.3.9+ \u6709\u6548\r\n "ReturnValueThreshold": 0, // \u914d\u7f6e\u8fd4\u56de\u503c\u5b57\u7b26\u4e32\u9608\u503c\uff0c\u9ed8\u8ba4 0\uff0c\u5168\u91cf\u8f93\u51fa\uff0cFurion 4.3.9+ \u6709\u6548\r\n "JsonBehavior": "None", // \u914d\u7f6e LoggingMonitor Json \u8f93\u51fa\u884c\u4e3a\uff0c\u9ed8\u8ba4 None\uff0cFurion 4.5.2+ \u6709\u6548\r\n "JsonIndented": false, // \u914d\u7f6e LoggingMonitor Json \u683c\u5f0f\u5316\u884c\u4e3a\uff0c\u9ed8\u8ba4 false\uff0cFurion 4.8.2+ \u6709\u6548\r\n "ContractResolver": "CamelCase", // \u914d\u7f6e LoggingMonitor \u5e8f\u5217\u5316\u5c5e\u6027\u547d\u540d\u89c4\u5219\uff0c\u9ed8\u8ba4 CamelCase\uff0cFurion 4.8.6.12+ \u6709\u6548\r\n "MethodsSettings": [\r\n // \u914d\u7f6e\u88ab\u76d1\u89c6\u65b9\u6cd5\u66f4\u591a\u4fe1\u606f\uff0cFurion 4.3.9+ \u6709\u6548\r\n {\r\n "FullName": "Furion.Application.TestLoggerServices.MethodName", // \u65b9\u6cd5\u5b8c\u5168\u9650\u5b9a\u540d\r\n "WithReturnValue": true, // \u914d\u7f6e\u662f\u5426\u5305\u542b\u8fd4\u56de\u503c\uff0c\u9ed8\u8ba4 `true`\uff0cFurion 4.3.9+ \u6709\u6548\r\n "ReturnValueThreshold": 0, // \u914d\u7f6e\u8fd4\u56de\u503c\u5b57\u7b26\u4e32\u9608\u503c\uff0c\u9ed8\u8ba4 0\uff0c\u5168\u91cf\u8f93\u51fa\uff0cFurion 4.3.9+ \u6709\u6548\r\n "JsonIndented": false, // \u914d\u7f6e LoggingMonitor Json \u683c\u5f0f\u5316\u884c\u4e3a\uff0c\u9ed8\u8ba4 false\uff0cFurion 4.8.2+ \u6709\u6548\r\n "JsonBehavior": "None", // \u914d\u7f6e LoggingMonitor Json \u8f93\u51fa\u884c\u4e3a\uff0c\u9ed8\u8ba4 None\uff0cFurion 4.5.2+ \u6709\u6548\r\n "ContractResolver": "CamelCase" // \u914d\u7f6e LoggingMonitor \u5e8f\u5217\u5316\u5c5e\u6027\u547d\u540d\u89c4\u5219\uff0c\u9ed8\u8ba4 CamelCase\uff0cFurion 4.8.6.12+ \u6709\u6548\r\n }\r\n ]\r\n }\r\n }\r\n}\n'})}),(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"IncludeOfMethods"})," \u548c ",(0,i.jsx)(n.code,{children:"ExcludeOfMethods"})," \u65b9\u6cd5\u7b7e\u540d\u683c\u5f0f\u4e3a\uff1a",(0,i.jsx)(n.code,{children:"\u7c7b\u5b8c\u5168\u9650\u5b9a\u540d.\u65b9\u6cd5\u540d"}),"\uff0c\u5982\uff1a",(0,i.jsx)(n.code,{children:"Furion.Application.TestNamedServices.GetName"}),"\uff0c",(0,i.jsx)(n.code,{children:"Furion.Application.TestNamedServices"})," \u662f\u7c7b\u540d\uff0c",(0,i.jsx)(n.code,{children:"GetName"})," \u662f\u65b9\u6cd5\u540d\u3002"]})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679c\u914d\u7f6e\u4e86\u5168\u5c40\u8bf7\u6c42\u76d1\u89c6\u65e5\u5fd7\uff0c\u5bf9\u4e2a\u522b\u4e0d\u9700\u8981\u76d1\u89c6\u7684\u63a5\u53e3\u65b9\u6cd5\u53ea\u9700\u8981\u8d34 ",(0,i.jsx)(n.code,{children:"[SuppressMonitor]"})," \u7279\u6027\u5373\u53ef\u3002"]}),"\n",(0,i.jsx)(n.h3,{id:"18113-\u66f4\u591a\u914d\u7f6e",children:"18.11.3 \u66f4\u591a\u914d\u7f6e"}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.3.9 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:["\u652f\u6301 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u5199\u5165\u65e5\u5fd7\u62e6\u622a\uff0c\u5982\u6dfb\u52a0\u989d\u5916\u6570\u636e\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3,6}",children:'services.AddMonitorLogging(options =>\r\n{\r\n options.ConfigureLogger((logger, logContext, context) =>\r\n {\r\n var httpContext = context.HttpContext;\r\n logContext.Set("extra", "\u5176\u4ed6\u6570\u636e");\r\n });\r\n});\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u9664\u6b64\u4e4b\u5916\uff0c\u8fd8\u652f\u6301\u914d\u7f6e ",(0,i.jsx)(n.code,{children:"json"})," \u8def\u5f84\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'services.AddMonitorLogging(jsonKey: "YourKey:Monitor");\n'})}),"\n",(0,i.jsxs)(n.h3,{id:"18114-json-\u683c\u5f0f",children:["18.11.4 ",(0,i.jsx)(n.code,{children:"JSON"})," \u683c\u5f0f"]}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.5.2 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5168\u5c40/\u5c40\u90e8\u542f\u7528 ",(0,i.jsx)(n.code,{children:"Json"})," \u8f93\u51fa\u914d\u7f6e"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {4,9}",children:"// \u5168\u5c40\r\nservices.AddMonitorLogging(options =>\r\n{\r\n options.JsonBehavior = Furion.Logging.JsonBehavior.OnlyJson;\r\n options.JsonIndented = true; // \u662f\u5426\u7f8e\u5316 JSON\uff0cFurion 4.8.0+ \u7248\u672c\u6709\u6548\r\n});\r\n\r\n// \u5c40\u90e8\r\n[LoggingMonitor(JsonBehavior = Furion.Logging.JsonBehavior.OnlyJson)]\r\n// \u662f\u5426\u7f8e\u5316 JSON\uff0cFurion 4.8.0+ \u7248\u672c\u6709\u6548\r\n[LoggingMonitor(JsonBehavior = Furion.Logging.JsonBehavior.OnlyJson, JsonIndented = true)]\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"note",children:[(0,i.jsxs)(n.mdxAdmonitionTitle,{children:["\u5173\u4e8e ",(0,i.jsx)(n.code,{children:"JsonBehavior"})]}),(0,i.jsxs)(n.p,{children:["\u53ea\u6709\u8bbe\u7f6e\u4e3a ",(0,i.jsx)(n.code,{children:"JsonBehavior.OnlyJson"})," \u65f6\u624d\u4e0d\u4f1a\u8f93\u51fa",(0,i.jsx)(n.strong,{children:"\u7f8e\u89c2\u7684"}),"\u65e5\u5fd7\u3002"]})]}),"\n",(0,i.jsxs)(n.ol,{start:"2",children:["\n",(0,i.jsx)(n.li,{children:"\u5199\u5165\u5b58\u50a8\u4ecb\u8d28"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {14-18}",children:'using Furion.Logging;\r\n\r\nnamespace YourProject.Core;\r\n\r\npublic class DatabaseLoggingWriter : IDatabaseLoggingWriter\r\n{\r\n // \u652f\u6301\u6784\u9020\u51fd\u6570\u6ce8\u5165\u4efb\u4f55\u5b9e\u4f8b\uff0c\u4f1a\u81ea\u52a8\u91ca\u653e\u4efb\u4f55\u670d\u52a1\uff0c\u6bd4\u5982\u6ce8\u5165 IRepository\uff0c\u6216\u8005 SqlSugarClient\r\n public DatabaseLoggingWriter()\r\n {\r\n }\r\n\r\n public void Write(LogMessage logMsg, bool flush)\r\n {\r\n // \u5982\u679c JsonBehavior \u914d\u7f6e\u4e3a OnlyJson \u6216\u8005 All\uff0c\u90a3\u4e48 Context \u5c31\u5305\u542b loggingMonitor \u7684\u503c\r\n // \u5982\u679c JsonBehavior \u914d\u7f6e\u4e3a OnlyJson\uff0c\u90a3\u4e48\u53ef\u76f4\u63a5\u901a\u8fc7 logMsg.Message \u83b7\u53d6\u7ed3\u679c\u5c31\u662f json \u683c\u5f0f\r\n if (logMsg.LogName == "System.Logging.LoggingMonitor")\r\n {\r\n var jsonString = logMsg.Context.Get("loggingMonitor");\r\n }\r\n\r\n // \u8fd9\u91cc\u5199\u4f60\u4efb\u4f55\u63d2\u5165\u6570\u636e\u5e93\u7684\u64cd\u4f5c\uff0c\u65e0\u9700 try catch\r\n }\r\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"Json"})," \u8f93\u51fa\u683c\u5f0f\u5982\u4e0b\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers",children:'{\r\n "controllerName": "test-logger",\r\n "controllerTypeName": "TestLoggerServices",\r\n "actionName": "person",\r\n "actionTypeName": "GetPerson",\r\n "areaName": null,\r\n "displayName": "Furion.Application.TestLoggerServices.GetPerson (Furion.Application)",\r\n "localIPv4": "0.0.0.1",\r\n "remoteIPv4": "0.0.0.1",\r\n "httpMethod": "GET",\r\n "requestUrl": "https://localhost:5001/api/test-logger/person/2",\r\n "refererUrl": "https://localhost:5001/api/index.html?urls.primaryName=\u6570\u636e\u5e93\u64cd\u4f5c\u6f14\u793a",\r\n "environment": "Development",\r\n "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53",\r\n "requestHeaderAuthorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjEsIkFjY291bnQiOiJhZG1pbiIsImlhdCI6MTY2NDQ1MDUwNSwibmJmIjoxNjY0NDUwNTA1LCJleHAiOjE2NjQ0NTE3MDUsImlzcyI6ImRvdG5ldGNoaW5hIiwiYXVkIjoicG93ZXJieSBGdXJpb24ifQ.-xocNcDQGoXClceoVU5QAHIkTcOZ7ZXo0hEbzghDfFI",\r\n "timeOperationElapsedMilliseconds": 55,\r\n "authorizationClaims": [\r\n {\r\n "type": "UserId",\r\n "valueType": "integer",\r\n "value": "1"\r\n },\r\n {\r\n "type": "Account",\r\n "valueType": "string",\r\n "value": "admin"\r\n },\r\n {\r\n "type": "iat",\r\n "valueType": "integer",\r\n "value": "1664450505"\r\n },\r\n {\r\n "type": "nbf",\r\n "valueType": "integer",\r\n "value": "1664450505"\r\n },\r\n {\r\n "type": "exp",\r\n "valueType": "integer",\r\n "value": "1664451705"\r\n },\r\n {\r\n "type": "iss",\r\n "valueType": "string",\r\n "value": "dotnetchina"\r\n },\r\n {\r\n "type": "aud",\r\n "valueType": "string",\r\n "value": "powerby Furion"\r\n }\r\n ],\r\n "parameters": [\r\n {\r\n "name": "id",\r\n "type": "System.Int32",\r\n "value": 2\r\n }\r\n ],\r\n "returnInformation": {\r\n "type": "Furion.UnifyResult.RESTfulResult`1[[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]",\r\n "actType": "Furion.Application.Persons.PersonDto",\r\n "value": {\r\n "StatusCode": 200,\r\n "Data": {\r\n "Id": 2,\r\n "Name": null,\r\n "Age": 0,\r\n "Address": null,\r\n "PhoneNumber": null,\r\n "QQ": null,\r\n "CreatedTime": "0001-01-01T00:00:00+00:00",\r\n "Childrens": null,\r\n "Posts": null\r\n },\r\n "Succeeded": true,\r\n "Errors": null,\r\n "Extras": null,\r\n "Timestamp": 1664450517341\r\n }\r\n },\r\n "exception": {\r\n "type": "System.DivideByZeroException",\r\n "message": "Attempted to divide by zero.",\r\n "stackTrace": " at Furion.Application.TestLoggerServices.\u6d4b\u8bd5\u65e5\u5fd7\u76d1\u542c8(Int32 id) in D:\\\\Workplaces\\\\OpenSources\\\\Furion\\\\samples\\\\Furion.Application\\\\TestLoggerServices.cs:line 78\\r\\n at lambda_method103(Closure , Object , Object[] )\\r\\n at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\\r\\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Logged|12_1(ControllerActionInvoker invoker)\\r\\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)"\r\n },\r\n "validation": {\r\n "errorCode": null,\r\n "originErrorCode": null,\r\n "message": "\u51fa\u9519\u4e86\u554a\u3002\u3002\u3002\u3002"\r\n }\r\n}\n'})}),"\n",(0,i.jsxs)(n.h3,{id:"18115-\u5168\u5c40\u8fc7\u6ee4-writefilter",children:["18.11.5 \u5168\u5c40\u8fc7\u6ee4 ",(0,i.jsx)(n.code,{children:"WriteFilter"})]}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.5.9 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"Furion 4.5.9+"})," \u7248\u672c\u65b0\u589e\u4e86 ",(0,i.jsx)(n.code,{children:"WriteFilter"})," \u8fc7\u6ee4\u529f\u80fd\uff0c\u53ef\u6839\u636e\u81ea\u5b9a\u4e49\u903b\u8f91\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u62e6\u622a\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers showLineNumbers {1,3,10}",children:"services.AddMonitorLogging(options =>\r\n{\r\n options.WriteFilter = (context) =>\r\n {\r\n // \u83b7\u53d6\u63a7\u5236\u5668/\u64cd\u4f5c\u63cf\u8ff0\u5668\r\n var controllerActionDescriptor = context.ActionDescriptor as ControllerActionDescriptor;\r\n\r\n // \u4f60\u7684\u903b\u8f91....\uff0c\u9700\u8981\u62e6\u622a\u8fd4\u56de false\uff0c\u5426\u5219 true\r\n\r\n return true;\r\n };\r\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"18116-\u8f93\u51fa-json-\u652f\u6301\u5ffd\u7565\u5c5e\u6027\u540d\u6216\u5c5e\u6027\u7c7b\u578b",children:["18.11.6 \u8f93\u51fa ",(0,i.jsx)(n.code,{children:"JSON"})," \u652f\u6301\u5ffd\u7565\u5c5e\u6027\u540d\u6216\u5c5e\u6027\u7c7b\u578b"]}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.6.1 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsx)(n.p,{children:"\u6709\u65f6\u63a5\u53e3\u7684\u8fd4\u56de\u503c\u5305\u542b\u4e0d\u80fd\u88ab\u5e8f\u5217\u5316\u7684\u7c7b\u578b\u6216\u8005\u60f3\u5ffd\u7565\u67d0\u4e9b\u5c5e\u6027\u540d\u4e0d\u88ab\u5e8f\u5217\u5316\uff0c\u8fd9\u65f6\u5019\u5c31\u9700\u8981\u7528\u5230\u8fd9\u4e2a\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.strong,{children:"\u5c40\u90e8\u914d\u7f6e"})}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3,4,10}",children:'// \u5ffd\u7565\u540d\u79f0\u548c\u5c5e\u6027\uff0c\u652f\u6301\u5355\u4e00\u914d\u7f6e\u6216\u5c40\u90e8\u914d\u7f6e\r\n[LoggingMonitor(JsonBehavior = JsonBehavior.OnlyJson\r\n , IgnorePropertyNames = new[] { "Bytes" }\r\n , IgnorePropertyTypes = new[] { typeof(byte[]) })]\r\npublic object MethodName(int id)\r\n{\r\n return new\r\n {\r\n Id = 10,\r\n Bytes = File.ReadAllBytes("image.png")\r\n };\r\n}\n'})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.strong,{children:"\u5168\u5c40\u914d\u7f6e"})}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {4-5}",children:'// \u5ffd\u7565\u540d\u79f0\u548c\u5c5e\u6027\uff0c\u652f\u6301\u5355\u4e00\u914d\u7f6e\u6216\u5c40\u90e8\u914d\u7f6e\r\nservices.AddMonitorLogging(options =>\r\n{\r\n options.IgnorePropertyNames = new[] { "Byte" };\r\n options.IgnorePropertyTypes = new[] { typeof(byte[]) };\r\n});\n'})}),"\n",(0,i.jsx)("img",{src:(0,t.Z)("img/hl1.png")}),"\n",(0,i.jsxs)(n.h3,{id:"18117-\u5c06-loggingmonitor-\u5199\u5165\u6570\u636e\u5e93",children:["18.11.7 \u5c06 ",(0,i.jsx)(n.code,{children:"LoggingMonitor"})," \u5199\u5165\u6570\u636e\u5e93"]}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\u6ce8\u518c ",(0,i.jsx)(n.code,{children:".AddDatabaseLogging<>"})," \u670d\u52a1\uff1a"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3,5}",children:'services.AddDatabaseLogging(options =>\r\n{\r\n options.WriteFilter = (logMsg) =>\r\n {\r\n return logMsg.LogName == "System.Logging.LoggingMonitor";\r\n };\r\n});\n'})}),"\n",(0,i.jsxs)(n.ol,{start:"2",children:["\n",(0,i.jsx)(n.li,{children:"\u5199\u5165\u6570\u636e\u5e93"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,5,8,12}",children:"using Furion.Logging;\r\n\r\nnamespace YourProject.Core;\r\n\r\npublic class DatabaseLoggingWriter : IDatabaseLoggingWriter\r\n{\r\n // \u4efb\u4f55\u6570\u636e\u5e93 ORM \u6ce8\u5165\u3002\u3002\u3002\r\n public DatabaseLoggingWriter()\r\n {\r\n }\r\n\r\n public void Write(LogMessage logMsg, bool flush)\r\n {\r\n // \u5c06 logMsg \u7684\u5c5e\u6027\u4e00\u4e00\u63d2\u5165\u5230\u6570\u636e\u5e93\u4e2d~\r\n }\r\n}\n"})}),"\n",(0,i.jsxs)(n.admonition,{type:"tip",children:[(0,i.jsxs)(n.mdxAdmonitionTitle,{children:["\u5355\u4e2a ",(0,i.jsx)(n.code,{children:"DatabaseLoggingWriter"})," \u60c5\u51b5"]}),(0,i.jsx)(n.p,{children:"\u5982\u679c\u5df2\u7ecf\u5168\u5c40\u6ce8\u518c\u4e86\uff1a"}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddDatabaseLogging(); // \u6ce8\u610f\u8fd9\u91cc\u6ca1\u6709\u8fc7\u6ee4 logName\n"})}),(0,i.jsx)(n.p,{children:"\u4e14\u4e0d\u60f3\u591a\u6ce8\u518c\u4e00\u4e2a\u6570\u636e\u5e93\u65e5\u5fd7\u670d\u52a1\uff0c\u90a3\u4e48\u53ea\u9700\u8981\u5728\u4ee3\u7801\u4e2d\u8fc7\u6ee4\u5373\u53ef\uff1a"}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,5,8,12,15}",children:'using Furion.Logging;\r\n\r\nnamespace YourProject.Core;\r\n\r\npublic class DatabaseLoggingWriter : IDatabaseLoggingWriter\r\n{\r\n // \u4efb\u4f55\u6570\u636e\u5e93 ORM \u6ce8\u5165\u3002\u3002\u3002\r\n public DatabaseLoggingWriter()\r\n {\r\n }\r\n\r\n public void Write(LogMessage logMsg, bool flush)\r\n {\r\n // \u5c06 logMsg \u7684\u5c5e\u6027\u4e00\u4e00\u63d2\u5165\u5230\u6570\u636e\u5e93\u4e2d~\r\n if(logMsg.LogName == "System.Logging.LoggingMonitor")\r\n {\r\n // \u5199\u5165\u5ba1\u8ba1\u8868\u6570\u636e\u5e93\r\n }\r\n else\r\n {\r\n // \u5199\u5165\u5176\u4ed6\u8868\u6570\u636e\u5e93\r\n }\r\n }\r\n}\n'})})]}),"\n",(0,i.jsxs)(n.h3,{id:"18118-\u652f\u6301-displayname-\u7279\u6027",children:["18.11.8 \u652f\u6301 ",(0,i.jsx)(n.code,{children:"[DisplayName]"})," \u7279\u6027"]}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.8.5.10 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:["\u901a\u5e38\u6211\u4eec\u4f1a\u4e3a\u6bcf\u4e00\u4e2a\u63a5\u53e3\u6dfb\u52a0\u4e00\u4e2a\u552f\u4e00\u540d\u79f0\uff0c\u6bd4\u5982\u4f7f\u7528 ",(0,i.jsx)(n.code,{children:"[DisplayName]"})," \u7279\u6027\uff0c\u65b9\u4fbf\u540e\u7eed\u5199\u5165\u65e5\u5fd7\u8fdb\u884c\u5f52\u7c7b\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {4}",children:'public class TestService: IDynamicApiController\r\n{\r\n [LoggingMonitor]\r\n [DisplayName("\u6d4b\u8bd5\u65b9\u6cd5")]\r\n public void TestMethod()\r\n {\r\n }\r\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u90a3\u4e48\u5982\u679c\u8f93\u51fa\u4e3a ",(0,i.jsx)(n.code,{children:"JSON"})," \u683c\u5f0f\u65e5\u5fd7\u5c06\u4f1a\u81ea\u52a8\u6dfb\u52a0 ",(0,i.jsx)(n.code,{children:"displayTitle"})," \u952e\uff0c\u503c\u4e3a ",(0,i.jsx)(n.code,{children:"\u6d4b\u8bd5\u65b9\u6cd5"}),"\u3002"]}),"\n",(0,i.jsx)(n.h3,{id:"18119-\u8f93\u51fa\u5e8f\u5217\u5316\u952e\u683c\u5f0f\u914d\u7f6e\u5c5e\u6027\u5927\u5c0f\u5199",children:"18.11.9 \u8f93\u51fa\u5e8f\u5217\u5316\u952e\u683c\u5f0f\u914d\u7f6e\uff08\u5c5e\u6027\u5927\u5c0f\u5199\uff09"}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.8.6.12 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:["\u8be5\u529f\u80fd\u4e3b\u8981\u914d\u7f6e\u5e8f\u5217\u5316\u65f6\u5c5e\u6027\u540d\u8f93\u51fa\u89c4\u5219\uff0c",(0,i.jsxs)(n.strong,{children:["\u6ce8\u610f\u6b64\u9879\u5e76\u4e0d\u914d\u7f6e ",(0,i.jsx)(n.code,{children:"JSON"})," \u8f93\u51fa\u89c4\u5219\u3002"]})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.strong,{children:"\u5c40\u90e8\u914d\u7f6e"})}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1}",children:'[LoggingMonitor(ContractResolver = ContractResolverTypes.Default)] // CamelCase \u6216\u8005 Default\uff0c\u9ed8\u8ba4\u662f CamelCase\r\npublic DataTable MethodName()\r\n{\r\n var d = "select * from person".SqlQuery();\r\n return d;\r\n}\n'})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.strong,{children:"\u5168\u5c40\u914d\u7f6e"})}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3}",children:"services.AddMonitorLogging(options =>\r\n{\r\n options.ContractResolver = ContractResolverTypes.Default; // CamelCase \u6216\u8005 Default\uff0c\u9ed8\u8ba4\u662f CamelCase\r\n});\n"})}),"\n",(0,i.jsx)(n.h3,{id:"181110-\u8df3\u8fc7\u7279\u5b9a\u53c2\u6570\u8bb0\u5f55",children:"18.11.10 \u8df3\u8fc7\u7279\u5b9a\u53c2\u6570\u8bb0\u5f55"}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.8.7.3 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"Furion 4.8.7.3+"})," \u7248\u672c\u65b0\u589e ",(0,i.jsx)(n.code,{children:"[SuppressMonitor]"})," \u7279\u6027\u652f\u6301\u6807\u8bb0\u53c2\u6570\uff08\u652f\u6301\u7c7b\u578b\uff0c\u65b9\u6cd5\uff09\u4e0d\u88ab\u8bb0\u5f55\uff0c\u5982\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2}",children:"[LoggingMonitor]\r\npublic string GetName([SuppressMonitor]SomeType type, int id) // type \u53c2\u6570\u5c06\u8df3\u8fc7\u8bb0\u5f55\r\n{\r\n return nameof(Furion);\r\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"1812-\u6253\u5370\u65e5\u5fd7\u5230-swagger-\u4e2d",children:["18.12 \u6253\u5370\u65e5\u5fd7\u5230 ",(0,i.jsx)(n.code,{children:"Swagger"})," \u4e2d"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u4e2d\u9ed8\u8ba4\u96c6\u6210\u4e86 ",(0,i.jsx)(n.code,{children:"MiniProfiler"})," \u7ec4\u4ef6\u5e76\u4e0e ",(0,i.jsx)(n.code,{children:"Swagger"})," \u8fdb\u884c\u4e86\u7ed3\u5408\uff0c\u5982\u9700\u6253\u5370\u65e5\u5fd7\u6216\u8c03\u8bd5\u4ee3\u7801\uff0c\u53ea\u9700\u8c03\u7528\u4ee5\u4e0b\u65b9\u6cd5\u5373\u53ef\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'App.PrintToMiniProfiler("\u5206\u7c7b", "\u72b6\u6001", "\u8981\u6253\u5370\u7684\u6d88\u606f");\n'})}),"\n",(0,i.jsxs)(n.h2,{id:"1813-\u9759\u6001-default-\u65b9\u5f0f\u6784\u5efa",children:["18.13 \u9759\u6001 ",(0,i.jsx)(n.code,{children:"Default()"})," \u65b9\u5f0f\u6784\u5efa"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'StringLoggingPart.Default().SetMessage("\u8fd9\u662f\u4e00\u4e2a\u65e5\u5fd7").LogInformation();\n'})}),"\n",(0,i.jsx)(n.h2,{id:"1814-\u89c4\u8303\u65e5\u5fd7\u6a21\u677f",children:"18.14 \u89c4\u8303\u65e5\u5fd7\u6a21\u677f"}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"Furion v3.5.3+"})," \u65b0\u589e\u4e86 ",(0,i.jsx)(n.code,{children:"TP.Wrapper(...)"})," \u89c4\u8303\u6a21\u677f\uff0c\u4f7f\u7528\u5982\u4e0b\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2}",children:'// \u751f\u6210\u6a21\u677f\u5b57\u7b26\u4e32\r\nvar template = TP.Wrapper("Furion \u6846\u67b6", "\u8ba9 .NET \u5f00\u53d1\u66f4\u7b80\u5355\uff0c\u66f4\u901a\u7528\uff0c\u66f4\u6d41\u884c\u3002",\r\n "##\u4f5c\u8005## \u767e\u5c0f\u50e7",\r\n "##\u5f53\u524d\u7248\u672c## v3.5.3",\r\n "##\u6587\u6863\u5730\u5740## http://furion.baiqian.ltd",\r\n "##Copyright## \u767e\u5c0f\u50e7, \u767e\u7b7e\u79d1\u6280\uff08\u5e7f\u4e1c\uff09\u6709\u9650\u516c\u53f8");\r\n\r\nConsole.WriteLine(template);\n'})}),"\n",(0,i.jsx)(n.p,{children:"\u65e5\u5fd7\u6253\u5370\u6a21\u677f\u5982\u4e0b\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 Furion \u6846\u67b6 \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\r\n\u2523 \u8ba9 .NET \u5f00\u53d1\u66f4\u7b80\u5355\uff0c\u66f4\u901a\u7528\uff0c\u66f4\u6d41\u884c\u3002\r\n\u2523\r\n\u2523 \u4f5c\u8005\uff1a \u767e\u5c0f\u50e7\r\n\u2523 \u5f53\u524d\u7248\u672c\uff1a v3.5.3\r\n\u2523 \u6587\u6863\u5730\u5740\uff1a http://furion.baiqian.ltd\r\n\u2523 Copyright\uff1a \u767e\u5c0f\u50e7, \u767e\u7b7e\u79d1\u6280\uff08\u5e7f\u4e1c\uff09\u6709\u9650\u516c\u53f8\r\n\u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 Furion \u6846\u67b6 \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n"})}),"\n",(0,i.jsxs)(n.admonition,{title:"\u5173\u4e8e\u5c5e\u6027\u751f\u6210",type:"tip",children:[(0,i.jsxs)(n.p,{children:["\u5982\u679c\u5217\u8868\u9879\u4ee5 ",(0,i.jsx)(n.code,{children:"##\u5c5e\u6027\u540d##"})," \u5f00\u5934\uff0c\u81ea\u52a8\u751f\u6210 ",(0,i.jsx)(n.code,{children:"\u5c5e\u6027\u540d\uff1a"})," \u4f5c\u4e3a\u884c\u9996\u4e14\u81ea\u52a8\u7b49\u5bbd\u5bf9\u9f50\u3002"]}),(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"Furion 3.9.1"})," \u4e4b\u524d\u7248\u672c\u4f7f\u7528 ",(0,i.jsx)(n.code,{children:"[\u5c5e\u6027\u540d]"})," \u5f00\u5934\u3002"]})]}),"\n",(0,i.jsx)(n.h2,{id:"1815-\u65e5\u5fd7\u4e0a\u4e0b\u6587",children:"18.15 \u65e5\u5fd7\u4e0a\u4e0b\u6587"}),"\n",(0,i.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,i.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,i.jsx)(n.code,{children:"Furion 4.6.0 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,i.jsx)(n.h3,{id:"18151-\u6dfb\u52a0\u4e0a\u4e0b\u6587\u6570\u636e",children:"18.15.1 \u6dfb\u52a0\u4e0a\u4e0b\u6587\u6570\u636e"}),"\n",(0,i.jsxs)(n.p,{children:["\u6709\u65f6\u5019\u6211\u4eec\u5e0c\u671b\u4e3a\u65e5\u5fd7\u63d0\u4f9b\u989d\u5916\u6570\u636e\uff0c\u8fd9\u65f6\u5019\u53ef\u901a\u8fc7 ",(0,i.jsx)(n.code,{children:".ScopeContext()"})," \u914d\u7f6e\uff0c\u5982\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,8,15,21,25,28}",children:'// \u5199\u6cd5\u4e00\r\nusing (var scope = _logger.ScopeContext(ctx => ctx.Set("Name", "Furion").Set("UserId", 10)))\r\n{\r\n _logger.LogInformation("\u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 {id}", 20);\r\n}\r\n\r\n// \u5199\u6cd5\u4e8c\r\nusing var scope = _logger.ScopeContext(new Dictionary