{"id":8168,"date":"2023-11-28T20:17:07","date_gmt":"2023-11-28T12:17:07","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=8168"},"modified":"2023-12-06T10:05:24","modified_gmt":"2023-12-06T02:05:24","slug":"springboot-zhi-chi-na-xie-ri-zhi-kuang-jia-tui-jia","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/11\/28\/springboot-zhi-chi-na-xie-ri-zhi-kuang-jia-tui-jia\/","title":{"rendered":"SpringBoot\u652f\u6301\u54ea\u4e9b\u65e5\u5fd7\u6846\u67b6\uff1f\u63a8\u8350\u548c\u9ed8\u8ba4\u7684\u65e5\u5fd7\u6846\u67b6\u662f\u54ea\u4e2a\uff1f"},"content":{"rendered":"<p>Spring Boot\u652f\u6301\u591a\u79cd\u65e5\u5fd7\u6846\u67b6\uff0c\u5e76\u4e14\u5728\u4e0d\u540c\u573a\u666f\u4e0b\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684\u65e5\u5fd7\u5b9e\u73b0\u3002\u4e3b\u8981\u652f\u6301\u7684\u65e5\u5fd7\u6846\u67b6\u5305\u62ec\uff1a<\/p>\n<ol>\n<li>\n<strong>Logback:<\/strong> Logback\u662fSpring Boot\u7684\u9ed8\u8ba4\u65e5\u5fd7\u6846\u67b6\u3002\u5b83\u662flog4j\u6846\u67b6\u7684\u7ee7\u627f\u8005\uff0c\u63d0\u4f9b\u4e86\u66f4\u597d\u7684\u6027\u80fd\u548c\u4e00\u4e9b\u65b0\u7684\u529f\u80fd\u3002\u5728\u6ca1\u6709\u663e\u5f0f\u914d\u7f6e\u5176\u4ed6\u65e5\u5fd7\u6846\u67b6\u7684\u60c5\u51b5\u4e0b\uff0cSpring Boot\u4f1a\u81ea\u52a8\u4f7f\u7528Logback\u3002\n<\/li>\n<li>\n<strong>Log4j 2:<\/strong> Spring Boot\u4e5f\u652f\u6301Log4j 2\uff0c\u8fd9\u662flog4j\u6846\u67b6\u7684\u4e0b\u4e00\u4ee3\u7248\u672c\u3002\u4f60\u53ef\u4ee5\u9009\u62e9\u5c06Log4j 2\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\uff0c\u7136\u540e\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\u914d\u7f6e\u5b83\u3002\n<\/li>\n<li>\n<strong>Java Util Logging (JUL):<\/strong> Spring Boot\u540c\u6837\u652f\u6301Java Util Logging\uff0c\u8fd9\u662fJava\u5e73\u53f0\u7684\u9ed8\u8ba4\u65e5\u5fd7\u6846\u67b6\u3002\u867d\u7136\u5728Java EE\u73af\u5883\u4e2d\u8f83\u4e3a\u5e38\u89c1\uff0c\u4f46\u5728Spring Boot\u4e2d\u4e5f\u53ef\u4ee5\u4f7f\u7528\u3002\n<\/li>\n<li>\n<strong>Slf4j (Simple Logging Facade for Java):<\/strong> Slf4j\u5e76\u4e0d\u662f\u4e00\u4e2a\u5177\u4f53\u7684\u65e5\u5fd7\u5b9e\u73b0\uff0c\u800c\u662f\u4e00\u4e2a\u4e3aJava\u63d0\u4f9b\u7b80\u5355\u65e5\u5fd7\u95e8\u9762\u7684\u5e93\u3002\u5b83\u53ef\u4ee5\u548c\u5176\u4ed6\u5177\u4f53\u7684\u65e5\u5fd7\u6846\u67b6\u642d\u914d\u4f7f\u7528\uff0c\u5982Logback\u3001Log4j\u7b49\u3002Spring Boot\u5185\u90e8\u4f7f\u7528Slf4j\u8fdb\u884c\u65e5\u5fd7\u62bd\u8c61\u3002\n<\/li>\n<\/ol>\n<p><strong>\u63a8\u8350\u7684\u65e5\u5fd7\u6846\u67b6\uff1a<\/strong><\/p>\n<ul>\n<li>\n<strong>\u9ed8\u8ba4\u63a8\u8350\uff1a<\/strong> Spring Boot\u9ed8\u8ba4\u63a8\u8350\u4f7f\u7528Logback\uff0c\u56e0\u4e3a\u5b83\u662f\u9ed8\u8ba4\u914d\u7f6e\uff0c\u6027\u80fd\u826f\u597d\uff0c\u914d\u7f6e\u7b80\u5355\uff0c\u652f\u6301Groovy\u914d\u7f6e\u6587\u4ef6\u7b49\u7279\u6027\u3002\n<\/li>\n<li>\n<strong>Slf4j + Logback\uff1a<\/strong> Spring Boot\u63a8\u8350\u4f7f\u7528Slf4j\u4f5c\u4e3a\u65e5\u5fd7\u95e8\u9762\uff0c\u800cLogback\u4f5c\u4e3a\u5b9e\u9645\u7684\u65e5\u5fd7\u5b9e\u73b0\u3002\u8fd9\u79cd\u7ec4\u5408\u662f\u63a8\u8350\u7684\u4e3b\u8981\u539f\u56e0\u4e4b\u4e00\u662fSlf4j\u63d0\u4f9b\u4e86\u4e00\u79cd\u62bd\u8c61\u7684\u65b9\u5f0f\uff0c\u4f7f\u4f60\u53ef\u4ee5\u5728\u4e0d\u6539\u53d8\u5e94\u7528\u4ee3\u7801\u7684\u60c5\u51b5\u4e0b\u5207\u6362\u4e0d\u540c\u7684\u65e5\u5fd7\u5b9e\u73b0\u3002\n<\/li>\n<\/ul>\n<p><strong>\u9ed8\u8ba4\u65e5\u5fd7\u914d\u7f6e\uff1a<\/strong><\/p>\n<p>Spring Boot\u7684\u9ed8\u8ba4\u65e5\u5fd7\u914d\u7f6e\u6587\u4ef6\u662f<code>logback-spring.xml<\/code>\u6216\u8005<code>logback.xml<\/code>\u3002\u4f60\u53ef\u4ee5\u5728<code>src\/main\/resources<\/code>\u76ee\u5f55\u4e0b\u521b\u5efa\u8fd9\u6837\u7684\u6587\u4ef6\uff0c\u901a\u8fc7\u914d\u7f6e\u6765\u4fee\u6539\u65e5\u5fd7\u7684\u8f93\u51fa\u65b9\u5f0f\u3001\u7ea7\u522b\u7b49\u8bbe\u7f6e\u3002<\/p>\n<p>\u5728\u4f7f\u7528Spring Boot\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f60\u901a\u5e38\u65e0\u9700\u5173\u5fc3\u592a\u591a\u5173\u4e8e\u65e5\u5fd7\u6846\u67b6\u7684\u7ec6\u8282\uff0c\u56e0\u4e3aSpring Boot\u5df2\u7ecf\u4e3a\u4f60\u8fdb\u884c\u4e86\u9ed8\u8ba4\u914d\u7f6e\u3002\u5982\u679c\u9700\u8981\u8fdb\u4e00\u6b65\u5b9a\u5236\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u9879\u76ee\u9700\u6c42\u81ea\u884c\u914d\u7f6e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring Boot\u652f\u6301\u591a\u79cd\u65e5\u5fd7\u6846\u67b6\uff0c\u5e76\u4e14\u5728\u4e0d\u540c\u573a\u666f\u4e0b\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684\u65e5\u5fd7\u5b9e\u73b0\u3002\u4e3b\u8981\u652f\u6301\u7684\u65e5\u5fd7\u6846\u67b6\u5305\u62ec\uff1a Lo [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[100],"tags":[],"class_list":["post-8168","post","type-post","status-publish","format-standard","hentry","category-springboot"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=8168"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8168\/revisions"}],"predecessor-version":[{"id":16581,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8168\/revisions\/16581"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=8168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=8168"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=8168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}