"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 {\r\n { "Name", "Furion" },\r\n { "UserId", 10 }\r\n});\r\n_logger.LogInformation("\u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 {id}", 20);\r\n\r\n// \u5199\u6cd5\u4e09\r\nusing var scope = _logger.ScopeContext(new LogContext {\r\n // ....\r\n});\r\n_logger.LogInformation("\u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 {id}", 20);\r\n\r\n// \u5199\u6cd5\u56db\r\nvar (logger, scoped) = Log.ScopeContext(new LogContext {\r\n // ...\r\n});\r\nlogger.LogInformation("\u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 {id}", 20);\r\nscoped?.Dispose();\r\n\r\n// \u5199\u6cd5\u4e94\r\n"\u6211\u662f\u4e00\u4e2a\u65e5\u5fd7 {id}".ScopeContext(new LogContext {\r\n // ...\r\n}).LogInformation();\n'})}),"\n",(0,i.jsx)(n.h3,{id:"18152-\u8bfb\u53d6\u4e0a\u4e0b\u6587\u6570\u636e",children:"18.15.2 \u8bfb\u53d6\u4e0a\u4e0b\u6587\u6570\u636e"}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"LogMessage"})," \u5bf9\u8c61\u4e2d\u4f7f\u7528\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,9,14,16}",children:'var value = logMsg.Context.Get("Key");\r\n\r\n// \u6bd4\u5982\u5728\u8fc7\u6ee4\u4e2d\u4f7f\u7528\r\nservices.AddFileLogging("infomation.log", options =>\r\n{\r\n options.WriteFilter = (logMsg) =>\r\n {\r\n // \u8fd8\u53ef\u4ee5\u8bbe\u7f6e\u7ed9\u8fd0\u884c\u65f6\u4f7f\u7528\uff1alogMsg.Context.Set(...);\r\n return logMsg.Context.Get("Name") == "Furion";\r\n };\r\n});\r\n\r\n// \u5728 IDatabaseLoggingWriter \u4e2d\u4f7f\u7528\r\npublic void Write(LogMessage logMsg, bool flush)\r\n{\r\n var name = logMsg.Context.Get("Name");\r\n}\n'})}),"\n",(0,i.jsx)(n.h3,{id:"18153-\u65e5\u5fd7\u4e0a\u4e0b\u6587\u6570\u636e\u5171\u4eab",children:"18.15.3 \u65e5\u5fd7\u4e0a\u4e0b\u6587\u6570\u636e\u5171\u4eab"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers{1,4,11,25,33}",children:'public TestAppService: ITestAppService, IDisposable\r\n{\r\n private readonly ILogger _logger;\r\n private IDisposable _scopeProvider;\r\n\r\n public TestAppService(ILogger logger)\r\n {\r\n _logger = logger;\r\n\r\n // \u6dfb\u52a0\u5168\u5c40\u7528\u6237\u4fe1\u606f\u4e0a\u4e0b\u6587\u6570\u636e\r\n _scopeProvider = _logger.ScopeContext(ctx => ctx.Set("uid", "100").Set("uname", "\u767e\u5c0f\u50e7"));\r\n }\r\n\r\n public string GetName(int id)\r\n {\r\n // \u5171\u4eab\u5168\u5c40\u4e0a\u4e0b\u6587\u6570\u636e\r\n _logger.LogInformation("\u5199\u5165\u65b0\u7684\u65e5\u5fd7");\r\n\r\n return "Furion";\r\n }\r\n\r\n public string GetTags(int id)\r\n {\r\n // \u989d\u5916\u65b0\u589e\u4e0a\u4e0b\u6587\u6570\u636e\r\n using var scope = _logger.ScopeContext(ctx => ctx.Set("key", "value"));\r\n _logger.LogInformation("\u8bbe\u7f6e\u989d\u5916\u7684\u4e0a\u4e0a\u4e0b\u6587\u65e5\u5fd7");\r\n\r\n return "\u767e\u5c0f\u50e7";\r\n }\r\n\r\n public void Dispose()\r\n {\r\n _scopeProvider.Dispose();\r\n }\r\n}\n'})}),"\n",(0,i.jsxs)(n.h2,{id:"1816-\u5173\u95ed-net-core-\u5e95\u5c42\u65e5\u5fd7",children:["18.16 \u5173\u95ed ",(0,i.jsx)(n.code,{children:".NET Core"})," \u5e95\u5c42\u65e5\u5fd7"]}),"\n",(0,i.jsxs)(n.p,{children:["\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",(0,i.jsx)(n.code,{children:".NET Core"})," \u5e95\u5c42\u9ed8\u8ba4\u8f93\u51fa\u4e86\u5f88\u591a\u65e5\u5fd7\uff0c\u5982\u9700\u5173\u95ed\u53ea\u9700\u5728 ",(0,i.jsx)(n.code,{children:"appsettings.json"})," \u548c ",(0,i.jsx)(n.code,{children:"appsettings.Development.json"})," \u4e2d\u6dfb\u52a0 ",(0,i.jsx)(n.code,{children:'"\u547d\u540d\u7a7a\u95f4/\u65e5\u5fd7\u7c7b\u522b":"\u6700\u4f4e\u65e5\u5fd7\u7ea7\u522b"'})," \u65e5\u5fd7\u7c7b\u522b\u8fc7\u6ee4\u5373\u53ef\uff0c\u5982\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers {2,7-8}",children:'{\r\n "Logging": {\r\n "LogLevel": {\r\n "Default": "Information",\r\n "Microsoft.AspNetCore": "Warning",\r\n "Microsoft.EntityFrameworkCore": "Information",\r\n "System.Net.Http.HttpClient": "Warning",\r\n "\u547d\u540d\u7a7a\u95f4/\u65e5\u5fd7\u7c7b\u522b": "Warning"\r\n }\r\n }\r\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u5c0f\u63d0\u9192\uff1a\u8fc7\u6ee4 ",(0,i.jsx)(n.code,{children:".NET Core"})," \u5e95\u5c42\u65e5\u5fd7\u6700\u4f4e\u65e5\u5fd7\u7ea7\u522b\u901a\u5e38\u8bbe\u7f6e\u4e3a ",(0,i.jsx)(n.code,{children:"Warning"}),"\u3002"]}),"\n",(0,i.jsx)(n.h2,{id:"1817-\u5168\u5c40\u65e5\u5fd7\u8fc7\u6ee4\u7b5b\u9009",children:"18.17 \u5168\u5c40\u65e5\u5fd7\u8fc7\u6ee4/\u7b5b\u9009"}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u4e00\u4e9b\u7279\u5b9a\u7684\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5e0c\u671b\u80fd\u591f\u5bf9\u6240\u6709\u65e5\u5fd7\u8f93\u51fa\u4ecb\u8d28\u4e2d\u7684\u65e5\u5fd7\u8fdb\u884c\u8fc7\u6ee4\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u884c\u5168\u5c40\u914d\u7f6e\u3002"}),"\n",(0,i.jsx)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"caution",children:(0,i.jsx)(n.p,{children:"\u6b64\u65b9\u5f0f\u4f1a\u5f71\u54cd\u6240\u6709\u7684\u65e5\u5fd7\u4ecb\u8d28\u8f93\u51fa\uff0c\u5982\u63a7\u5236\u53f0\u3001\u6587\u4ef6\u3001\u6570\u636e\u5e93\u7b49\u5176\u4ed6\u8f93\u51fa\u4ecb\u8d28\u3002"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:".NET5"})," \u7248\u672c\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,2,4}",children:'Host.CreateDefaultBuilder(args)\r\n .ConfigureLogging(logging =>\r\n {\r\n logging.AddFilter((provider, category, logLevel) =>\r\n {\r\n return !new[] { "Microsoft.Hosting", "Microsoft.AspNetCore" }.Any(u => category.StartsWith(u))\r\n && logLevel >= LogLevel.Information;\r\n });\r\n })\n'})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:".NET6+"})," \u7248\u672c\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3}",children:'var builder = WebApplication.CreateBuilder(args);\r\n\r\nbuilder.Logging.AddFilter((provider, category, logLevel) =>\r\n{\r\n return !new[] { "Microsoft.Hosting", "Microsoft.AspNetCore" }.Any(u => category.StartsWith(u))\r\n && logLevel >= LogLevel.Information;\r\n});\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u6216\u8005 ",(0,i.jsx)(n.code,{children:"Serve.Run"})," \u65b9\u5f0f"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3,7-10}",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.AddFilter((provider, category, logLevel) =>\r\n {\r\n return !new[] { "Microsoft.Hosting", "Microsoft.AspNetCore" }.Any(u => category.StartsWith(u))\r\n && logLevel >= LogLevel.Information;\r\n });\r\n }\r\n}\n'})}),"\n",(0,i.jsxs)(n.admonition,{title:"\u65e5\u5fd7\u8fc7\u6ee4\u65e0\u6548\u60c5\u51b5",type:"warning",children:[(0,i.jsxs)(n.p,{children:["\u5047\u5982\u4f7f\u7528\u4e0a\u8ff0\u4ee3\u7801\u8fc7\u6ee4\u65e0\u6548\uff08\u4e0d\u80fd\u8fc7\u6ee4\u9ed8\u8ba4\u7684\u4e3b\u673a\u65e5\u5fd7\uff09\uff0c\u90a3\u4e48\u8bf7\u786e\u8ba4 ",(0,i.jsx)(n.code,{children:"appsettings.json"})," \u548c ",(0,i.jsx)(n.code,{children:"appsettings.Development.json"})," \u7684 ",(0,i.jsx)(n.code,{children:"Logging:Level"})," \u662f\u5426\u5982\u4e0b\uff1a"]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers {4-5}",children:'{\r\n "Logging": {\r\n "LogLevel": {\r\n "Default": "Information",\r\n "Microsoft.AspNetCore": "Warning",\r\n "Microsoft.EntityFrameworkCore": "Information"\r\n }\r\n }\r\n}\n'})}),(0,i.jsxs)(n.p,{children:["\u5982\u679c\u914d\u7f6e\u4e86\u4ee5\u4e0b\u914d\u7f6e\uff0c",(0,i.jsx)(n.strong,{children:"\u8bf7\u5220\u9664"}),"\uff1a"]}),(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",children:'"Microsoft": "Warning",\r\n"Microsoft.Hosting.Lifetime": "Information",\n'})})]}),"\n",(0,i.jsx)(n.h2,{id:"1818-\u53cd\u9988\u4e0e\u5efa\u8bae",children:"18.18 \u53cd\u9988\u4e0e\u5efa\u8bae"}),"\n",(0,i.jsx)(n.admonition,{title:"\u4e0e\u6211\u4eec\u4ea4\u6d41",type:"note",children:(0,i.jsxs)(n.p,{children:["\u7ed9 Furion \u63d0 ",(0,i.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/new?issue",children:"Issue"}),"\u3002"]})}),"\n",(0,i.jsx)(n.hr,{}),"\n",(0,i.jsx)(n.admonition,{title:"\u4e86\u89e3\u66f4\u591a",type:"note",children:(0,i.jsxs)(n.p,{children:["\u60f3\u4e86\u89e3\u66f4\u591a ",(0,i.jsx)(n.code,{children:"\u65e5\u5fd7"})," \u77e5\u8bc6\u53ef\u67e5\u9605 ",(0,i.jsx)(n.a,{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/logging/?view=aspnetcore-5.0",children:"ASP.NET Core - \u65e5\u5fd7"})," \u7ae0\u8282\u3002"]})})]})}function p(e={}){const{wrapper:n}={...(0,s.a)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(h,{...e})}):h(e)}},510:(e,n,r)=>{r.d(n,{Z:()=>G});r(7294);const i=(e,n,r)=>e?"string"==typeof e?e:e[n]||r:r;var s=r(5893);const o={display:"block"},t=e=>{let{size:n,color:r,style:t,...l}=e;const c=t?{...o,...t}:o;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...l,children:(0,s.jsx)("path",{d:"M856.4 292.8c-63.3-63.6-126.6-127.1-190.2-190.3-15.3-15.2-32.7-16.1-48.1-0.8-64.3 63.6-128.1 127.6-191.8 191.9-14 14.2-16.3 31.6-1.7 46 14.8 14.7 31.5 10.6 46.1-2.7 5.1-4.6 9.8-9.7 14.7-14.7 39.2-39.7 78.5-79.5 122.8-124.4 0 170 3 332.2-1.1 494-2.4 96.4-91.2 174.6-187.4 176.6-110.6 2.3-198.6-84.4-199-197.4-0.6-136.3-0.2-272.6-0.1-408.9 0-21.8-7.9-37.4-31.2-39.9-18.9-2-33.2 13.2-33.1 37.5 0 145.8-3.4 291.7 2.4 437.2 6 152.1 160.4 263.5 309.5 230.5C591.8 900 672.8 797.2 673.6 664.6c0.8-144 0.2-288.1 0.2-432.1v-33.3c11.2 10.2 17.6 15.4 23.3 21.3 38.5 38.4 76.7 77 115.3 115.2 14.8 14.6 32.2 19.2 47.8 2.9 13.8-14.8 10.3-31.7-3.8-45.8z",fill:i(r,0,"#333333")})})};t.defaultProps={size:18};const l=t,c={display:"block"},d=e=>{let{size:n,color:r,style:o,...t}=e;const l=o?{...c,...o}:c;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...t,children:[(0,s.jsx)("path",{d:"M143.872 768a51.2 51.2 0 0 1-15.36-2.56 51.2 51.2 0 0 1-35.328-51.2V283.136a148.992 148.992 0 0 1 141.824-153.6h450.56a148.992 148.992 0 0 1 141.824 153.6V512a148.992 148.992 0 0 1-141.824 153.6H244.224l-60.928 80.896a51.2 51.2 0 0 1-39.424 21.504zM235.008 180.224a97.792 97.792 0 0 0-90.624 102.4v430.592L218.624 614.4h466.944a97.792 97.792 0 0 0 90.624-102.4V283.136a97.792 97.792 0 0 0-90.624-102.4z",fill:i(r,0,"#333333")}),(0,s.jsx)("path",{d:"M880.128 875.52a51.2 51.2 0 0 1-39.424-20.48l-60.928-80.896h-243.2a25.6 25.6 0 0 1 0-51.2h268.8l76.288 102.4v-295.936a25.6 25.6 0 0 1 25.6-25.6 25.6 25.6 0 0 1 25.6 25.6v293.888a51.2 51.2 0 0 1-51.2 51.2z",fill:i(r,1,"#333333")})]})};d.defaultProps={size:18};const a=d,g={display:"block"},h=e=>{let{size:n,color:r,style:o,...t}=e;const l=o?{...g,...o}:g;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...t,children:[(0,s.jsx)("path",{d:"M223.425605 449.2744l161.632237 0 0 253.65714c0 16.954137 13.745049 30.699186 30.699186 30.699186 16.95516 0 30.699186-13.745049 30.699186-30.699186l0-284.356326c0-16.95516-13.744026-30.699186-30.699186-30.699186L291.035446 387.876028l217.23665-248.51605L733.039255 387.580293 607.104031 387.580293c-16.954137 0-30.699186 13.745049-30.699186 30.699186l0 284.652062c0 16.954137 13.745049 30.699186 30.699186 30.699186s30.699186-13.745049 30.699186-30.699186L637.803217 448.978664l164.448376 0c12.140505 0 23.140023-7.154957 28.063149-18.251689 4.922103-11.097756 2.841721-24.053835-5.307889-33.05279L530.62315 72.570829c-5.881964-6.495948-14.273075-10.134825-23.024389-10.091846-8.763594 0.076748-17.076934 3.895727-22.844288 10.494005L200.312188 398.371056c-7.92653 9.067516-9.818623 21.931498-4.839215 32.896224S211.383338 449.2744 223.425605 449.2744z",fill:i(r,0,"#333333")}),(0,s.jsx)("path",{d:"M222.354204 829.113381l581.732178 0c16.954137 0 30.699186-13.745049 30.699186-30.699186s-13.745049-30.699186-30.699186-30.699186L222.354204 767.715009c-16.954137 0-30.699186 13.745049-30.699186 30.699186S205.400067 829.113381 222.354204 829.113381z",fill:i(r,1,"#333333")}),(0,s.jsx)("path",{d:"M804.086381 896.729361 222.354204 896.729361c-16.954137 0-30.699186 13.745049-30.699186 30.699186s13.745049 30.699186 30.699186 30.699186l581.732178 0c16.954137 0 30.699186-13.745049 30.699186-30.699186S821.041542 896.729361 804.086381 896.729361z",fill:i(r,2,"#333333")})]})};h.defaultProps={size:18};const p=h,x={display:"block"},u=e=>{let{size:n,color:r,style:o,...t}=e;const l=o?{...x,...o}:x;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...t,children:(0,s.jsx)("path",{d:"M380.15463648 874.54223633c0 18.12744166-14.83154297 32.95898463-32.95898463 32.95898463s-32.95898463-14.83154297-32.95898462-32.95898463V228.9152832L172.71078883 370.86962865a33.04467773 33.04467773 0 0 1-46.60400416 0 33.04467773 33.04467773 0 0 1 0-46.6040034l197.55615234-198.14941406A32.76782227 32.76782227 0 0 1 347.0967749 116.52514674c0.03295924 0 0.06591772-0.03295924 0.09887695-0.03295924 1.54907201 0 2.90039088 0.69213867 4.41650366 0.88989258 2.66967773 0.39550781 5.40527318 0.59326172 7.94311548 1.61499049 12.03002904 4.94384766 20.59936549 16.71020508 20.59936549 30.45410156v725.0910642z m320.15698192 23.34155248a32.85351537 32.85351537 0 0 1-23.43383789 9.59106445c-0.03295924 0-0.06591772 0.03295924-0.09887696 0.03295924-1.54907201 0-2.90039088-0.69213867-4.41650365-0.92285182-2.70263697-0.36254857-5.40527318-0.56030248-7.94311549-1.61498972-12.03002904-4.91088842-20.59936549-16.67724584-20.59936473-30.42114309V149.45776367c0-18.12744166 14.83154297-32.95898463 32.95898387-32.95898463s32.95898463 14.83154297 32.95898463 32.95898463v645.60058619l141.52587916-141.92138697c12.81445313-12.82104467 33.81591797-12.82104467 46.63037109 0 12.78808619 12.81445313 12.78808619 33.77636719 0 46.60400416L700.3116184 897.88378881z",fill:i(r,0,"#333333")})})};u.defaultProps={size:18};const j=u,m={display:"block"},L=e=>{let{size:n,color:r,style:o,...t}=e;const l=o?{...m,...o}:m;return(0,s.jsx)("svg",{viewBox:"0 0 1172 1024",width:n+"px",height:n+"px",style:l,...t,children:(0,s.jsx)("path",{d:"M870.0416 250.4704a38.4 38.4 0 0 0-8.96 53.5552c13.056 18.2784 24.4224 37.8368 33.7408 58.112a38.4512 38.4512 0 0 0 50.944 18.8928 38.4512 38.4512 0 0 0 18.8416-50.944 436.0192 436.0192 0 0 0-40.96-70.6048 38.3488 38.3488 0 0 0-53.6064-9.0112zM181.4528 566.016a35.9936 35.9936 0 0 0 25.5488-10.5984L351.7952 410.624a36.096 36.096 0 1 0-51.0976-51.0976L217.6 442.5728C250.0096 278.1184 395.264 153.6 569.1392 153.6c50.7904 0 99.8912 10.3936 145.92 30.9248a38.4 38.4 0 1 0 31.232-70.0928 431.36 431.36 0 0 0-177.152-37.632c-214.6816 0-393.1136 156.416-428.4416 361.216L62.1568 359.4752a36.1984 36.1984 0 0 0-51.0976 51.0976l144.8448 144.7936a36.0448 36.0448 0 0 0 25.5488 10.6496zM978.5344 463.104a36.1984 36.1984 0 0 0-51.0976 0l-144.8448 144.7936a36.096 36.096 0 1 0 51.0976 51.0976l88.6272-88.576C894.3104 740.2496 746.8032 870.4 569.1392 870.4a357.7856 357.7856 0 0 1-325.2736-207.7184 38.4 38.4 0 1 0-69.7344 32.3072 434.3808 434.3808 0 0 0 394.9568 252.2112c215.1936 0 393.984-157.184 428.6464-362.7008l74.496 74.496a35.9936 35.9936 0 0 0 51.0976 0 36.096 36.096 0 0 0 0-51.0976l-144.7936-144.7936z",fill:i(r,0,"#333333")})})};L.defaultProps={size:18};const v=L,f={display:"block"},b=e=>{let{size:n,color:r,style:o,...t}=e;const l=o?{...f,...o}:f;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...t,children:[(0,s.jsx)("path",{d:"M302 332a30 30 0 1 1 0-60h420a30 30 0 0 1 0 60H302zM302 542a30 30 0 0 1 0-60h420a30 30 0 0 1 0 60H302zM302 752a30 30 0 0 1 0-60h120a30 30 0 0 1 0 60H302z",fill:i(r,0,"#333333")}),(0,s.jsx)("path",{d:"M789.47 784.1a30 30 0 0 1 39.36 45.3l-144.24 125.25a30 30 0 0 1-19.68 7.35H214.85C163.4 962 122 919.46 122 867.38V156.62C122 104.54 163.4 62 214.85 62h594.3C860.6 62 902 104.54 902 156.62v529.05a30 30 0 1 1-60 0V156.62C842 137.3 827.09 122 809.15 122H214.85C196.91 122 182 137.3 182 156.62v710.76C182 886.7 196.91 902 214.85 902h438.84l135.78-117.9z",fill:i(r,1,"#333333")}),(0,s.jsx)("path",{d:"M692 931.19a30 30 0 1 1-60 0v-174.6C632 704.57 673.4 662 724.85 662h147.78a30 30 0 0 1 0 60h-147.78c-17.94 0-32.85 15.3-32.85 34.62v174.6z",fill:i(r,2,"#333333")})]})};b.defaultProps={size:18};const M=b,y={display:"block"},N=e=>{let{size:n,color:r,style:o,...t}=e;const l=o?{...y,...o}:y;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...t,children:[(0,s.jsx)("path",{d:"M512 883.2A371.2 371.2 0 1 0 140.8 512 371.2 371.2 0 0 0 512 883.2z m0 64a435.2 435.2 0 1 1 435.2-435.2 435.2 435.2 0 0 1-435.2 435.2z",fill:i(r,0,"#333333")}),(0,s.jsx)("path",{d:"M557.056 512l122.368 122.368a31.744 31.744 0 1 1-45.056 45.056L512 557.056l-122.368 122.368a31.744 31.744 0 1 1-45.056-45.056L466.944 512 344.576 389.632a31.744 31.744 0 1 1 45.056-45.056L512 466.944l122.368-122.368a31.744 31.744 0 1 1 45.056 45.056z",fill:i(r,1,"#333333")})]})};N.defaultProps={size:18};const F=N,C={display:"block"},S=e=>{let{size:n,color:r,style:o,...t}=e;const l=o?{...C,...o}:C;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...t,children:[(0,s.jsx)("path",{d:"M940 512H792V412c76.8 0 139-62.2 139-139 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 34.8-28.2 63-63 63H232c-34.8 0-63-28.2-63-63 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 76.8 62.2 139 139 139v100H84c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h148v96c0 6.5 0.2 13 0.7 19.3C164.1 728.6 116 796.7 116 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-44.2 23.9-82.9 59.6-103.7 6 17.2 13.6 33.6 22.7 49 24.3 41.5 59 76.2 100.5 100.5S460.5 960 512 960s99.8-13.9 141.3-38.2c41.5-24.3 76.2-59 100.5-100.5 9.1-15.5 16.7-31.9 22.7-49C812.1 793.1 836 831.8 836 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-79.3-48.1-147.4-116.7-176.7 0.4-6.4 0.7-12.8 0.7-19.3v-96h148c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM716 680c0 36.8-9.7 72-27.8 102.9-17.7 30.3-43 55.6-73.3 73.3-20.1 11.8-42 20-64.9 24.3V484c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v396.5c-22.9-4.3-44.8-12.5-64.9-24.3-30.3-17.7-55.6-43-73.3-73.3C317.7 752 308 716.8 308 680V412h408v268z",fill:i(r,0,"#333333")}),(0,s.jsx)("path",{d:"M304 280h56c4.4 0 8-3.6 8-8 0-28.3 5.9-53.2 17.1-73.5 10.6-19.4 26-34.8 45.4-45.4C450.9 142 475.7 136 504 136h16c28.3 0 53.2 5.9 73.5 17.1 19.4 10.6 34.8 26 45.4 45.4C650 218.9 656 243.7 656 272c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-40-8.8-76.7-25.9-108.1-17.2-31.5-42.5-56.8-74-74C596.7 72.8 560 64 520 64h-16c-40 0-76.7 8.8-108.1 25.9-31.5 17.2-56.8 42.5-74 74C304.8 195.3 296 232 296 272c0 4.4 3.6 8 8 8z",fill:i(r,1,"#333333")})]})};S.defaultProps={size:18};const A=S,I={display:"block"},w=e=>{let{size:n,color:r,style:o,...t}=e;const l=o?{...I,...o}:I;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...t,children:[(0,s.jsx)("path",{d:"M512 71.68c-242.688 0-440.32 197.632-440.32 440.32s197.632 440.32 440.32 440.32 440.32-197.632 440.32-440.32-197.632-440.32-440.32-440.32z m0 819.2c-208.896 0-378.88-169.984-378.88-378.88s169.984-378.88 378.88-378.88 378.88 169.984 378.88 378.88-169.984 378.88-378.88 378.88z",fill:i(r,0,"#333333")}),(0,s.jsx)("path",{d:"M542.72 261.12H481.28v220.16H261.12v61.44h220.16v220.16h61.44v-220.16h220.16V481.28h-220.16z",fill:i(r,1,"#333333")})]})};w.defaultProps={size:18};const T=w,D={display:"block"},W=e=>{let{size:n,color:r,style:o,...t}=e;const l=o?{...D,...o}:D;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...t,children:(0,s.jsx)("path",{d:"M384 896h-64v-70.4c0-15.2-10.4-28-24.8-31.2C159.2 768 64 644.8 64 496v-32h64v32c0 118.4 73.6 215.2 179.2 236 44.8 8.8 76.8 48 76.8 94.4v69.6zM704 896h-64v-70.4c0-45.6 32-85.6 76.8-94.4C822.4 711.2 896 614.4 896 496v-32h64v32c0 148.8-95.2 272-231.2 298.4-14.4 3.2-24.8 16-24.8 31.2v70.4zM512.8 640l-41.6-37.6c-147.2-133.6-244-208-244-316.8 0-88 68.8-156.8 156.8-156.8 49.6 0 97.6 23.2 128.8 60C544 152 592 128.8 641.6 128.8c88 0 156.8 68.8 156.8 156.8 0 108-96.8 183.2-244 316.8L512.8 640z",fill:i(r,0,"#333333")})})};W.defaultProps={size:18};const H=W,E={display:"block"},P=e=>{let{size:n,color:r,style:o,...t}=e;const l=o?{...E,...o}:E;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...t,children:(0,s.jsx)("path",{d:"M942.4615936 284.62787926c-14.30911886-14.12709945-37.31996786-14.05468217-51.48229632 0.21920654L517.97142983 661.27810333 139.75544149 286.45003606c-14.30911886-14.16232846-37.31996786-14.05468217-51.51948344 0.21920654-14.16232846 14.30911886-14.05468217 37.35519687 0.21920654 51.51948345l401.99014627 398.34974663c0.61847666 0.61847666 1.41897273 0.76526706 2.03940637 1.34655658 0.14483342 0.14483342 0.18201941 0.32685283 0.32685283 0.47364324 7.09877874 7.02636259 16.38375538 10.55911595 25.63154489 10.55911595 9.35739278 0 18.75001458-3.60516949 25.85075143-10.77636551l398.34974663-401.99014628C956.84312974 321.8382427 956.73548345 298.7921647 942.4615936 284.62787926z",fill:i(r,0,"#333333")})})};P.defaultProps={size:18};const B=P,k={display:"block"},z=e=>{let{size:n,color:r,style:o,...t}=e;const l=o?{...k,...o}:k;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:l,...t,children:(0,s.jsx)("path",{d:"M81.5384064 739.37212074c14.30911886 14.12709945 37.31996786 14.05468217 51.48229632-0.21920654L506.02857017 362.72189667 884.24455851 737.54996394c14.30911886 14.16232846 37.31996786 14.05468217 51.51948344-0.21920654 14.16232846-14.30911886 14.05468217-37.35519687-0.21920654-51.51948345l-401.99014627-398.34974663c-0.61847666-0.61847666-1.41897273-0.76526706-2.03940637-1.34655658-0.14483342-0.14483342-0.18201941-0.32685283-0.32685282-0.47364324-7.09877874-7.02636259-16.38375538-10.55911595-25.6315449-10.55911595-9.35739278 0-18.75001458 3.60516949-25.85075143 10.77636551l-398.34974663 401.99014628C67.15687026 702.1617573 67.26451655 725.2078353 81.5384064 739.37212074z",fill:i(r,0,"#333333")})})};z.defaultProps={size:18};const J=z,O=e=>{let{name:n,...r}=e;switch(n){case"youhua":return(0,s.jsx)(l,{...r});case"dayi":return(0,s.jsx)(a,{...r});case"shengji":return(0,s.jsx)(p,{...r});case"tiaozheng":return(0,s.jsx)(j,{...r});case"gengxin":return(0,s.jsx)(v,{...r});case"wendang":return(0,s.jsx)(M,{...r});case"shanchu":return(0,s.jsx)(F,{...r});case"bug":return(0,s.jsx)(A,{...r});case"xinzeng":return(0,s.jsx)(T,{...r});case"fuwu":return(0,s.jsx)(H,{...r});case"down":return(0,s.jsx)(B,{...r});case"up":return(0,s.jsx)(J,{...r})}return null},R={label:"label_p8vM",icon:"icon_knQK"};function G(e){const{children:n}=e,r={"\u65b0\u589e":{icon:"xinzeng",bgColor:"#39b54a"},"\u4fee\u590d":{icon:"bug",bgColor:"#9c26b0"},"\u6587\u6863":{icon:"wendang",bgColor:"rgb(79, 147, 255)"},"\u66f4\u65b0":{icon:"gengxin",bgColor:"#0081ff"},"\u8c03\u6574":{icon:"tiaozheng",bgColor:"#333"},"\u5347\u7ea7":{icon:"shengji",bgColor:"#e03997"},"\u79fb\u9664":{icon:"shanchu",bgColor:"#666"},"\u7b54\u7591":{icon:"dayi",bgColor:"#bbb"},"\u4f18\u5316":{icon:"youhua",bgColor:"#38e550"}};return(0,s.jsxs)("label",{className:R.label,title:n,style:{backgroundColor:r[n].bgColor},children:[(0,s.jsx)(O,{name:r[n].icon,color:"white",size:14,className:R.icon})," ",n]})}},1151:(e,n,r)=>{r.d(n,{Z:()=>l,a:()=>t});var i=r(7294);const s={},o=i.createContext(s);function t(e){const n=i.useContext(o);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:t(e.components),i.createElement(o.Provider,{value:n},e.children)}}}]);