{"id":2838,"date":"2018-06-03T18:26:27","date_gmt":"2018-06-03T10:26:27","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2838"},"modified":"2018-06-03T18:26:27","modified_gmt":"2018-06-03T10:26:27","slug":"springboot-%e5%85%bc%e5%ae%b9%e5%90%84%e6%97%a5%e5%bf%97%e6%a1%86%e6%9e%b6%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2838","title":{"rendered":"SpringBoot \u517c\u5bb9\u5404\u65e5\u5fd7\u6846\u67b6\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>\n\t\u4e0a\u7bc7\u6211\u8ba4\u4e3a\u6211\u5df2\u7ecf\u8bb2\u7684\u5f88\u660e\u767d\u4e86 Springboot \u517c\u5bb9\u5404\u65e5\u5fd7\u6846\u67b6\u7684\u505a\u6cd5\uff0c\u4f46\u662f\u8fd8\u6709\u7f51\u53cb\u5728\u7fa4\u91cc\u95ee\u6211\uff0c\u5fae\u4fe1\u516c\u4f17\u53f7\u7559\u8a00\uff0c\u56e0\u6b64\u6211\u8fd9\u91cc\u518d\u82b1\u4e00\u7bc7\u65f6\u95f4\u6765\u8bf4\u660e SpringBoot \u6574\u5408\u65e5\u5fd7\u6846\u67b6\u7684\u65b9\u6cd5\u3002\n<\/p>\n<h2>\n\t\u5404\u79cd\u6846\u67b6\u9057\u7559\u95ee\u9898<br \/>\n<\/h2>\n<p>\n\tSpringboot \u4f7f\u7528\uff08slf4j+logback\uff09: Spring \u4f7f\u7528\uff08commons-logging\uff09\u3001Hibernate \u4f7f\u7528\uff08jboss-logging\uff09\u3001MyBatis \u4f7f\u7528 (Apache Commons Logging)\u7b49\u3002\n<\/p>\n<p>\n\t\u7edf\u4e00\u65e5\u5fd7\u8bb0\u5f55\uff0c\u5c31\u662f\u8ba9\u522b\u7684\u6846\u67b6\u548c\u6211\u4e00\u8d77\u7edf\u4e00\u4f7f\u7528slf4j\u8fdb\u884c\u8f93\u51fa\uff1f\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\u5404\u79cd\u6846\u67b6\u65e5\u5fd7\u9002\u914d\" src=\"http:\/\/ocuzluml6.bkt.clouddn.com\/legacy.png\" style=\"width: 1587px;height: 1123px\" \/>\n<\/p>\n<p>\n\t\u5982\u4f55\u8ba9\u7cfb\u7edf\u4e2d\u6240\u6709\u7684\u65e5\u5fd7\u90fd\u7edf\u4e00\u5230slf4j\uff1a\n<\/p>\n<ul>\n<li>\n\t\t\u5c06\u7cfb\u7edf\u4e2d\u5176\u4ed6\u65e5\u5fd7\u6846\u67b6\u5148\u6392\u9664\u51fa\u53bb\uff1b\n\t<\/li>\n<li>\n\t\t\u7528\u4e2d\u95f4\u5305\u6765\u66ff\u6362\u539f\u6709\u7684\u65e5\u5fd7\u6846\u67b6\uff1b\n\t<\/li>\n<li>\n\t\t\u6211\u4eec\u5bfc\u5165slf4j\u5176\u4ed6\u7684\u5b9e\u73b0\n\t<\/li>\n<\/ul>\n<h2>\n\tSpringBoot\u65e5\u5fd7\u5173\u7cfb<br \/>\n<\/h2>\n<pre class=\"brush:xml;\">\r\n&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;spring-boot-starter&lt;\/artifactId&gt;\r\n\t\t&lt;\/dependency&gt;<\/pre>\n<p>\n\t\u4e0a\u9762\u7684 starter \u9ed8\u8ba4\u4f1a\u5f15\u5165\u4e0b\u9762\u7684\u65e5\u5fd7 jar \u5305\u3002SpringBoot\u4f7f\u7528\u5b83\u6765\u505a\u65e5\u5fd7\u529f\u80fd\uff1a\n<\/p>\n<pre class=\"brush:xml;\">\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;spring-boot-starter-logging&lt;\/artifactId&gt;\r\n&lt;\/dependency&gt;<\/pre>\n<p>\n\t\u5e95\u5c42\u4f9d\u8d56\u5173\u7cfb\uff1a\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"SpringBoot \u5e95\u5c42\u65e5\u5fd7\u6846\u67b6\u4f9d\u8d56\u5173\u7cfb\" src=\"http:\/\/ocuzluml6.bkt.clouddn.com\/20180131220946.png\" style=\"width: 871px;height: 339px\" \/>\n<\/p>\n<p>\n\t\u603b\u7ed3\uff1a\n<\/p>\n<ol>\n<li>\n\t\tSpringBoot\u5e95\u5c42\u4e5f\u662f\u4f7f\u7528slf4j+logback\u7684\u65b9\u5f0f\u8fdb\u884c\u65e5\u5fd7\u8bb0\u5f55\n\t<\/li>\n<li>\n\t\tSpringBoot\u4e5f\u628a\u5176\u4ed6\u7684\u65e5\u5fd7\u90fd\u66ff\u6362\u6210\u4e86slf4j\uff1b\n\t<\/li>\n<li>\n\t\t\u4e2d\u95f4\u66ff\u6362\u5305\uff1f\n\t<\/li>\n<\/ol>\n<pre class=\"brush:java;\">\r\n@SuppressWarnings(&quot;rawtypes&quot;)\r\npublic abstract class LogFactory {\r\n\r\n    static String UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J = &quot;http:\/\/www.slf4j.org\/codes.html#unsupported_operation_in_jcl_over_slf4j&quot;;\r\n\r\n    static LogFactory logFactory = new SLF4JLogFactory();<\/pre>\n<p>\n\t<img decoding=\"async\" alt=\"\u65e5\u5fd7\u6846\u67b6\u66ff\u6362\" src=\"http:\/\/ocuzluml6.bkt.clouddn.com\/20180131221411.png\" style=\"width: 409px;height: 210px\" \/>\n<\/p>\n<p>\n\t\u5982\u679c\u6211\u4eec\u8981\u5f15\u5165\u5176\u4ed6\u6846\u67b6\uff1f\u4e00\u5b9a\u8981\u628a\u8fd9\u4e2a\u6846\u67b6\u7684\u9ed8\u8ba4\u65e5\u5fd7\u4f9d\u8d56\u79fb\u9664\u6389\uff01Spring\u6846\u67b6\u7528\u7684\u662fcommons-logging\uff1a\n<\/p>\n<pre class=\"brush:xml;\">\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;spring-core&lt;\/artifactId&gt;\r\n\t&lt;exclusions&gt;\r\n\t\t&lt;exclusion&gt;\r\n\t\t\t&lt;groupId&gt;commons-logging&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;commons-logging&lt;\/artifactId&gt;\r\n\t\t&lt;\/exclusion&gt;\r\n\t&lt;\/exclusions&gt;\r\n&lt;\/dependency&gt;<\/pre>\n<p>\n\tSpringBoot\u80fd\u81ea\u52a8\u9002\u914d\u6240\u6709\u7684\u65e5\u5fd7\uff0c\u800c\u4e14\u5e95\u5c42\u4f7f\u7528slf4j+logback\u7684\u65b9\u5f0f\u8bb0\u5f55\u65e5\u5fd7\uff0c\u5f15\u5165\u5176\u4ed6\u6846\u67b6\u7684\u65f6\u5019\uff0c\u53ea\u9700\u8981\u628a\u8fd9\u4e2a\u6846\u67b6\u4f9d\u8d56\u7684\u65e5\u5fd7\u6846\u67b6\u6392\u9664\u6389\u5373\u53ef\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2838\">SpringBoot \u517c\u5bb9\u5404\u65e5\u5fd7\u6846\u67b6\u7684\u65b9\u6cd5<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u4e0a\u7bc7\u6211\u8ba4\u4e3a\u6211\u5df2\u7ecf\u8bb2\u7684\u5f88\u660e\u767d\u4e86 Springboot \u517c\u5bb9\u5404\u65e5\u5fd7\u6846\u67b6\u7684\u505a\u6cd5\uff0c\u4f46\u662f\u8fd8\u6709\u7f51\u53cb\u5728\u7fa4\u91cc\u95ee\u6211\uff0c\u5fae\u4fe1\u516c\u4f17\u53f7\u7559 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[240,587,588,239,783],"class_list":["post-2838","post","type-post","status-publish","format-standard","hentry","category-java","tag-log4jtomcat","tag-spring-boot","tag-spring-cloud","tag-tomcat","tag-783"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2838","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2838"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2838\/revisions"}],"predecessor-version":[{"id":2839,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2838\/revisions\/2839"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2838"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2838"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}