{"id":225594,"date":"2020-12-07T18:01:24","date_gmt":"2020-12-07T10:01:24","guid":{"rendered":"http:\/\/4563.org\/?p=225594"},"modified":"2020-12-07T18:01:24","modified_gmt":"2020-12-07T10:01:24","slug":"%e5%9c%a8-springmvc-%e5%bc%80%e5%8f%91%e4%b8%ad-slf4j-api-1-8-%e5%92%8c-log4j2-2-14-%e7%89%88%e6%9c%ac%e5%a6%82%e4%bd%95%e7%bb%91%e5%ae%9a","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=225594","title":{"rendered":"\u5728 Springmvc \u5f00\u53d1\u4e2d slf4j-api 1.8+ \u548c log4j2 2.14 \u7248\u672c\u5982\u4f55\u7ed1\u5b9a"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5728 Springmvc \u5f00\u53d1\u4e2d slf4j-api 1.8+ \u548c log4j2 2.14 \u7248\u672c\u5982\u4f55\u7ed1\u5b9a               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : NoKey <\/span>  <span><i><\/i> 11<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4eca\u5929\u642d\u5efa\u4e86\u4e00\u4e2a spring mvc \u5de5\u7a0b\uff08\u4e0d\u662f springboot \uff09<\/p>\n<p>\u5728 mvnrepository \u627e\u4e86 slf4j \u548c log4j2 \u7684\u5305<\/p>\n<p>\u628a\u6700\u65b0\u7248\u672c\u62ff\u4e86\u4e0b\u6765<\/p>\n<p>pom.xml \u91cc\u9762\u6309\u7167\u4e60\u60ef\u8fd9\u6837\u5199\u7684<\/p>\n<pre><code>     &lt;dependency&gt;       &lt;groupId&gt;org.apache.logging.log4j&lt;\/groupId&gt;       &lt;artifactId&gt;log4j-core&lt;\/artifactId&gt;       &lt;version&gt;2.14.0&lt;\/version&gt;     &lt;\/dependency&gt;      &lt;dependency&gt;       &lt;groupId&gt;org.apache.logging.log4j&lt;\/groupId&gt;       &lt;artifactId&gt;log4j-api&lt;\/artifactId&gt;       &lt;version&gt;2.14.0&lt;\/version&gt;     &lt;\/dependency&gt;      &lt;dependency&gt;       &lt;groupId&gt;org.apache.logging.log4j&lt;\/groupId&gt;       &lt;artifactId&gt;log4j-slf4j-impl&lt;\/artifactId&gt;       &lt;version&gt;2.14.0&lt;\/version&gt;     &lt;\/dependency&gt;       &lt;dependency&gt;       &lt;groupId&gt;org.slf4j&lt;\/groupId&gt;       &lt;artifactId&gt;slf4j-api&lt;\/artifactId&gt;       &lt;version&gt;2.0.0-alpha1&lt;\/version&gt;     &lt;\/dependency&gt;   <\/code><\/pre>\n<p>\u8fd0\u884c\u8d77\u6765\u6709\u63d0\u793a<\/p>\n<pre><code>SLF4J: No SLF4J providers were found. SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http:\/\/www.slf4j.org\/codes.html#noProviders for further details. SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8. SLF4J: Ignoring binding found at [jar:file:\/Users\/xxx\/develop\/code\/myservice\/target\/myservice\/WEB-INF\/lib\/log4j-slf4j-impl-2.14.0.jar!\/org\/slf4j\/impl\/StaticLoggerBinder.class] SLF4J: See http:\/\/www.slf4j.org\/codes.html#ignoredBindings for an explanation. <\/code><\/pre>\n<p>\u7136\u540e\uff0c\u6211\u6839\u636e\u63d0\u793a\u7684\u8fde\u63a5\u8fdb\u53bb\u770b\u4e86\u4e00\u4e0b\uff0c\u6709\u4e2a\u8bf4\u660e<\/p>\n<pre><code>Planning for the advent of Jigsaw (Java 9), slf4j-api version 1.8.x and later use the ServiceLoader mechanism. Earlier versions of SLF4J relied on the static binder mechanism which is no longer honored by slf4j-api. In case SLF4J finds no providers targeting SLF4J 1.8 but finds instead bindings targeting SLF4J 1.7 or earlier, it will list the bindings it finds but otherwise ignores them. <\/code><\/pre>\n<p>\u5b66\u827a\u4e0d\u7cbe\u3002\u3002\u3002\u6ca1\u641e\u61c2\u6211\u5230\u5e95\u5e94\u8be5\u600e\u4e48\u505a<\/p>\n<p>\u8bf7\u5404\u4f4d\u5927\u4f6c\u8d50\u6559\u3002\u3002\u3002\u8c22\u8c22\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>2<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4565643\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : skydiver <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5e94\u8be5\u662f\u7528\u8fd9\u4e2a\u5305 https:\/\/mvnrepository.com\/artifact\/org.apache.logging.log4j\/log4j-slf4j18-impl                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4565644\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : NoKey <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @skydiver \u8c22\u8c22\uff0c\u6211\u6628\u5929\u5c1d\u8bd5\u8fc7\u8fd9\u4e2a\u5305\uff0c\u8fd8\u662f\u6709\u95ee\u9898\uff0c\u53ef\u80fd\u662f\u6211\u542f\u52a8\u5de5\u7a0b\u6709\u95ee\u9898\uff0c\u4eca\u5929\u91cd\u65b0\u542f\u52a8\u4e00\u4e0b\u5c31 ok \u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Springmvc \u5f00\u53d1\u4e2d s&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/225594"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=225594"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/225594\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=225594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=225594"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=225594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}