{"id":856,"date":"2018-10-16T11:25:32","date_gmt":"2018-10-16T02:25:32","guid":{"rendered":"https:\/\/vongg.com\/?p=856"},"modified":"2018-10-18T23:12:30","modified_gmt":"2018-10-18T14:12:30","slug":"%e4%bd%bf%e7%94%a8log4j%e7%9a%84dailyrollingfileappender%e6%97%b6%e6%97%a5%e5%bf%97rolling%e4%b8%8d%e6%88%90%e5%8a%9f%e8%b0%83%e6%9f%a5","status":"publish","type":"post","link":"https:\/\/vongg.com\/?p=856","title":{"rendered":"\u4f7f\u7528log4j\u7684DailyRollingFileAppender\u65f6,\u65e5\u5fd7rolling\u4e0d\u6210\u529f\u8c03\u67e5"},"content":{"rendered":"<p>https:\/\/blog.csdn.net\/lmmzsn\/article\/details\/77988716?utm_source=blogxgwz0<\/p>\n<p>\u89e3\u51b3 log4j:ERROR Failed to rename\uff0c\u4e0d\u9700\u8981\u4fee\u6539\u6e90\u7801\u3002\u540c\u65f6\u89e3\u51b3\u5de5\u7a0b\u91cd\u590d\u52a0\u8f7d\u7684\u95ee\u9898\u3002<\/p>\n<p>\u5f88\u591a\u4eba\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u529e\u6cd5\u5c31\u662f\u4fee\u6539log4j\u6e90\u7801\uff0c\u5c06\u6587\u4ef6\u91cd\u547d\u540d\u7684\u4ee3\u7801\u6539\u4e3a\u6587\u4ef6\u590d\u5236\u7684\u4ee3\u7801\u3002\u5176\u5b9e\u627e\u5230\u6839\u672c\u539f\u56e0\uff0c\u5c31\u4e0d\u9700\u8981\u4fee\u6539\u6e90\u7801\u4e86\u3002<\/p>\n<p>\u95ee\u9898\u73b0\u8c61\uff1a<\/p>\n<p>\u5728\u63a7\u5236\u53f0\u53ef\u4ee5\u770b\u5230\u65e5\u5fd7\uff1alog4j:ERROR Failed to renameDailyRollingFileAppender\u6ca1\u6709\u5468\u671f\u6027\u7684\u751f\u6210\u65e5\u5fd7\u6587\u4ef6\uff0c\u53ea\u751f\u6210\u4e86\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u3002Tomcat\u542f\u52a8\u6162\u5e76\u4e14\u5360\u5185\u5b58\u5927\uff08\u4fee\u6539log4j\u6e90\u7801\u662f\u4e0d\u80fd\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\uff09<br \/>\n\u95ee\u9898\u53d1\u751f\u7684\u73af\u5883\uff1a<\/p>\n<p>Log4j\u4f7f\u7528DailyRollingFileAppender\u5468\u671f\u6027\u751f\u6210\u65e5\u5fd7\u4f7f\u7528Tomcat\u670d\u52a1\u5668\u5728tomcat\u7684\u9ed8\u8ba4\u7684server.xml\u91cc\u9762\uff0c\u9519\u8bef\u7684\u914d\u7f6e\u4e86Host\u6216\u8005Context\u6807\u7b7e<br \/>\n\u95ee\u9898\u53d1\u751f\u7684\u76f4\u63a5\u539f\u56e0\uff1a<br \/>\n\u5f53DailyRollingFileAppender\u5bf9\u65e5\u5fd7\u6587\u4ef6\u8fdb\u884c\u91cd\u547d\u540d\u65f6\uff0c\u56e0\u4e3a\u5176\u4ed6\u7a0b\u5e8f\u5360\u7528\u4e86\u8be5\u65e5\u5fd7\u6587\u4ef6\uff0c\u5bfc\u81f4\u91cd\u547d\u540d\u5931\u8d25\u800c\u62a5\u9519\u3002<\/p>\n<p>\u95ee\u9898\u53d1\u751f\u7684\u6839\u672c\u539f\u56e0\uff1a<br \/>\n\u5728tomcat\u7684\u9ed8\u8ba4\u7684server.xml\u91cc\u9762\uff0c\u9519\u8bef\u7684\u914d\u7f6e\u4e86Host\u6216\u8005Context\u6807\u7b7e\uff0c\u8fd9\u5bfc\u81f4\u4e86Tomcat\u591a\u6b21\u52a0\u8f7dWeb\u5de5\u7a0b\uff0c\u8fdb\u800c\u5bfc\u81f4\u591a\u4e2aDailyRollingFileAppender\u5bf9\u8c61\u6301\u6709\u76f8\u540c\u65e5\u5fd7\u6587\u4ef6\u3002<\/p>\n<p>\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\uff1a<br \/>\n\u6211\u4eec\u5728\u914d\u7f6e\u57df\u540d\u8bbf\u95ee\u7684\u65f6\u5019\u4e00\u822c\u4f1a\u5728server.xml\u91cc\u914d\u7f6e\u65b0\u7684host\uff0c\u4ee5\u6b64\u4e3a\u4f8b\uff0c\u5176\u4e2d\u6700\u5173\u952e\u7684\u5730\u65b9\u5c31\u662f\u4e3aContext\u914d\u7f6ename\u5c5e\u6027<\/p>\n<p>\u5bf9\u4e0b\u9762\u914d\u7f6e\u7684\u8bf4\u660e\uff1a<\/p>\n<p>path=&#8221;&#8221;\u65f6\uff0c\u53ef\u4ee5\u76f4\u63a5\u7528\u57df\u540d\uff08www.xxx.com\uff09\u6765\u8bbf\u95ee\u5de5\u7a0b\uff1aweb-syspath=&#8221;\/web-sys&#8221;\u65f6\uff0c\u53ea\u80fd\u901a\u8fc7\u57df\u540d+path\uff08www.xxx.com\/web-sys\uff09\u6765\u8bbf\u95ee\u5de5\u7a0b\uff1aweb-sysmywebapps\u4e0ewebapps\u662f\u540c\u4e00\u76ee\u5f55\u7684\u6587\u4ef6\u5939\uff0c\u5728\u6b63\u786e\u914d\u7f6e\u91cc\uff0c\u6211\u4eec\u7684\u5de5\u7a0bweb-sys\u662f\u653e\u5728mywebapps\u91cc\u9762\u7684\uff08webapps\u91cc\u9762\u5343\u4e07\u4e0d\u80fd\u6709web-sys\uff09\u5230\u5e95\u6709\u51e0\u4e2a\u5bf9\u8c61\u5360\u7528\u4e86\u6587\u4ef6\uff0c\u53ef\u4ee5\u901a\u8fc7\u8d44\u6e90\u76d1\u89c6\u5668\u6765\u67e5\u770b\u3002<br \/>\n\u9519\u8bef\u7684\u914d\u7f6e1\uff1a\u8fd9\u4e2a\u914d\u7f6e\u4f1a\u5bfc\u81f4\u4e09\u4e2a\u5bf9\u8c61\u540c\u65f6\u6301\u6709\u65e5\u5fd7\u6587\u4ef6\uff0c\u53ef\u4ee5\u76f4\u63a5\u7528\u57df\u540d\u8bbf\u95ee\u5de5\u7a0b\uff1aweb-sys<br \/>\n&lt;Host name=&#8221;www.xxx.com&#8221; appBase=&#8221;webapps&#8221; autoDeploy=&#8221;true&#8221; unpackWARs=&#8221;true&#8221;&gt;&lt;Alias&gt;www.xxx.cn&lt;\/Alias&gt; &lt;Alias&gt;www.xxx.com.cn&lt;\/Alias&gt; &lt;Context docBase=&#8221;web-sys&#8221; path=&#8221;&#8221;\/&gt;&lt;\/Host&gt;<br \/>\n\u9519\u8bef\u7684\u914d\u7f6e2\uff1a\u8fd9\u4e2a\u914d\u7f6e\u4f1a\u5bfc\u81f4\u4e8c\u4e2a\u5bf9\u8c61\u540c\u65f6\u6301\u6709\u65e5\u5fd7\u6587\u4ef6\uff0c\u53ef\u4ee5\u76f4\u63a5\u7528\u57df\u540d\u8bbf\u95ee\u5de5\u7a0b\uff1aweb-sys<br \/>\n&lt;Host name=&#8221;www.xxx.com&#8221; appBase=&#8221;mywebapps&#8221; autoDeploy=&#8221;true&#8221; unpackWARs=&#8221;true&#8221;&gt;&lt;Alias&gt;www.xxx.cn&lt;\/Alias&gt; &lt;Alias&gt;www.xxx.com.cn&lt;\/Alias&gt; &lt;Context docBase=&#8221;web-sys&#8221; path=&#8221;&#8221;\/&gt;&lt;\/Host&gt;<br \/>\n\u6b63\u786e\u7684\u914d\u7f6e1\uff1a\u53ea\u6709\u4e00\u4e2a\u5bf9\u8c61\u6301\u6709\u65e5\u5fd7\u6587\u4ef6\uff0c\u4e0d\u80fd\u76f4\u63a5\u7528\u57df\u540d\u8bbf\u95ee\u5de5\u7a0b\uff1aweb-sys<br \/>\n&lt;Host name=&#8221;www.xxx.com&#8221; appBase=&#8221;mywebapps&#8221; autoDeploy=&#8221;true&#8221; unpackWARs=&#8221;true&#8221;&gt;&lt;Alias&gt;www.xxx.cn&lt;\/Alias&gt; &lt;Alias&gt;www.xxx.com.cn&lt;\/Alias&gt; &lt;Context docBase=&#8221;web-sys&#8221; path=&#8221;\/web-sys&#8221;\/&gt;&lt;\/Host&gt;<br \/>\n\u6b63\u786e\u7684\u914d\u7f6e2\uff1a\u53ea\u6709\u4e00\u4e2a\u5bf9\u8c61\u6301\u6709\u65e5\u5fd7\u6587\u4ef6\uff0c\u53ef\u4ee5\u76f4\u63a5\u7528\u57df\u540d\u8bbf\u95ee\u5de5\u7a0b\uff1aweb-sys<br \/>\n&lt;Host name=&#8221;www.xxx.com&#8221; appBase=&#8221;mywebapps&#8221; autoDeploy=&#8221;true&#8221; unpackWARs=&#8221;true&#8221;&gt;&lt;Alias&gt;www.xxx.cn&lt;\/Alias&gt; &lt;Alias&gt;www.xxx.com.cn&lt;\/Alias&gt; &lt;Context docBase=&#8221;web-sys&#8221; path=&#8221;&#8221; name=&#8221;\/web-sys&#8221;\/&gt;&lt;\/Host&gt;<br \/>\n\u5173\u4e8eserver.xml\u914d\u7f6e\u7684\u603b\u7ed3\uff1a<\/p>\n<p>\u5982\u679c\u65b0\u589e\u4e86Host\uff0c\u90a3Host\/appBase\u7684\u503c\u662f\u4e0d\u80fd\u548c\u5176\u4ed6Host\/appBase\u7684\u503c\u4e00\u6837\u7684\u3002\u6bd4\u5982appBase\u90fd\u662fwebapps\uff0c\u90a3\u4e48\u4e24\u4e2aHost\u4f1a\u5bfc\u81f4webapps\u4e0b\u9762\u7684\u5de5\u7a0b\u88ab\u52a0\u8f7d\u4e24\u904d\u3002\u5982\u679c\u914d\u7f6e\u4e86Context\u6807\u7b7e\u90a3\u4e48\u5c31\u4e00\u5b9a\u8981\u914d\u7f6ename\u5c5e\u6027\u503c\u4e3a\uff1a\u5de5\u7a0b\u540d\uff08\/web-sys\uff09\uff0c\u6216\u8005\u914d\u7f6epath\u503c\u4e3a\u5de5\u7a0b\u540d\uff08\/web-sys\uff09\uff0c\u5426\u5219\u5c31\u4f1a\u5f15\u8d77\u91cd\u590d\u52a0\u8f7d\u5de5\u7a0b\u7684\u95ee\u9898\u3002&lt;Alias&gt;\u6807\u7b7e\uff0c\u5141\u8bb8\u6211\u4eec\u628a\u591a\u4e2a\u57df\u540d\u914d\u7f6e\u5728\u4e00\u4e2aHost\u4e0b\u9762\uff0c\u4f8b\u5982\uff1axxx.com\u3001xxx.cn\u3001xxx.com.cn\uff0c\u90fd\u53ef\u4ee5\u914d\u7f6e\u5728\u4e00\u4e2aHost\u4e0b\u9762\u5230\u8fd9\uff0c\u95ee\u9898\u5df2\u7ecf\u89e3\u51b3\u3002\u63a8\u8350\u4f7f\u7528\u4e0a\u9762\u7684\u3010\u6b63\u786e\u7684\u914d\u7f6e2\u3011\u3002\u4e0b\u9762\u518d\u5206\u4eab\u4e00\u4e0b\u6211\u5206\u6790\u8fd9\u4e2a\u95ee\u9898\u7684\u8fc7\u7a0b\uff0c\u4e0d\u60f3\u770b\u7684\u5c31\u53ef\u4ee5\u8df3\u8fc7\u4e86\u3002<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/p>\n<p>\u5206\u6790\u8fc7\u7a0b<\/p>\n<p>\u67e5\u770blog4j\u6e90\u7801\uff0c\u53d1\u73b0log4j:ERROR Failed to rename\u8fd9\u4e2a\u65e5\u5fd7\u662f\u5728org.apache.log4j.DailyRollingFileAppender.rollOver()\u91cc\u9762\u8f93\u51fa\u7684\u627e\u5230DailyRollingFileAppender\u8f93\u51fa\u65e5\u5fd7\u6587\u4ef6\u7684\u53d8\u91cf\u662f\u7236\u7c7b\uff1aWriterAppender\u4e2d\u7684\uff1aQuietWriter qw\u3002\u627e\u5230\u8bbe\u5b9aqw\u7684\u5730\u65b9\uff1aorg.apache.log4j.FileAppender.setQWForFiles(Writer)\u5728setQWForFiles\u91cc\u8bbe\u7f6e\u65ad\u70b9\uff0c\u53d1\u73b0\u6709\u4e24\u4e2a\u4e0d\u540c\u7684Trace\uff0c\u4ed6\u4eec\u90fd\u662f\u7528\u6765\u521d\u59cb\u5316DispatcherServlet\uff08Spring\u6846\u67b6\uff09\uff0c\u4e0d\u540c\u70b9\u5728Tomcat\u6e90\u7801\u91cc\u901a\u8fc7\u5206\u6790Tomcat\u6e90\u7801\uff0c\u53d1\u73b0\u8fd9\u4e24\u4e2aTrace\u662f\u7531\u4e24\u4e2aStandardContext\u5bf9\u8c61\uff1aStandardContext[]\u548cStandardContext[\/web-sys])\u53d1\u8d77\u7684\u3002StandardContext[]\u6765\u81ea\u4e8eserver.xml\u914d\u7f6e\u7684Context\uff1bstandardContext[\/web-sys]\u662f\u6839\u636e\u5de5\u7a0b(web-sys)\uff0c\u81ea\u52a8\u751f\u6210\u7684\u3002StandardContext[]\u548cstandardContext[\/web-sys]\u5176\u5b9e\u4ee3\u8868\u7684\u90fd\u662f\u4e00\u4e2a\u5de5\u7a0b\uff08web-sys\uff09\uff0c\u4f46\u662f\u56e0\u4e3a\u6709\u4e24\u4e2a\u5bf9\u8c61\uff0c\u6240\u4ee5\u5de5\u7a0b\uff08web-sys\uff09\u4e5f\u88ab\u52a0\u8f7d\u4e86\u4e24\u6b21\u3002\u5206\u6790StandardContext\u7684\u751f\u6210\u53ca\u8c03\u7528\u8fc7\u7a0b\uff0c\u53d1\u73b0StandardContext[]\u548cStandardContext[\/web-sys]\u6700\u7ec8\u90fd\u4f1a\u88ab\u5b58\u50a8\u5728StandardHost\u7684\u5c5e\u6027children(HashMap)\u91cc,children\u7684KEY\u662f\u7528StandardContext\u7684name\u5c5e\u6027\u6765\u6807\u8bc6\u7684\u5206\u6790StandardContext[\/web-sys]\u7684\u751f\u6210\u8fc7\u7a0b\uff0c\u5176\u4e2d\u6709\u4e2a\u5224\u65ad\uff1a\u5982\u679cchildren\u91cc\u5b58\u5728\u76f8\u540c\u7684StandardContext\uff0c\u5c31\u8df3\u8fc7\u8be5\u8fc7\u7a0b\u3002\u5230\u8fd9\u91cc\u6211\u4eec\u53d1\u73b0\u4e86\u5173\u952e\u7684\u5730\u65b9\uff0cStandardContext[]\u548cstandardContext[\/web-sys]\u4ed6\u4eec\u7684\u4e0d\u540c\u70b9\u5c31\u5728\u4e8ename\u5c5e\u6027\u3002StandardContext[]\u7684name\u5c5e\u6027\u503c\u5c31\u6765\u81ea\u4e8eserver.xml\u91cc\u7684Context\u6807\u7b7e\uff0cstandardContext[\/web-sys]\u7684name\u5c5e\u6027\u503c\u6765\u81ea\u4e8e\u5de5\u7a0b\u7684\u540d\u5b57\uff08\/web-sys\uff09\u5982\u4f55\u624d\u80fd\u6539\u53d8StandardContext[]\u7684name\u5c5e\u6027\u503c\u5462\uff1f\u8fd9\u5c31\u8981\u4eceContext\u6807\u7b7e\u4e0a\u9762\u4e0b\u529f\u592b\u3002\u5728Tomcat\u5b98\u65b9\u6587\u6863\u4e2d\uff0cContext\u6807\u7b7e\u7684\u8bf4\u660e\u91cc\u5e76\u6ca1\u6709\u63d0\u5230name\u8fd9\u4e2a\u5c5e\u6027\uff0c\u800c\u5728StandardContext.setPath(String)\u91cc\u6211\u4eec\u53d1\u73b0\u4e0b\u9762\u4ee3\u7801\uff0c\u5c31\u662f\u8bf4\u5982\u679c\u6ca1\u6709name\uff0c\u90a3\u5c31\u628aname\u8bbe\u5b9a\u4e3apath\u7684\u503c\u3002\u00a0if (getName() == null) {\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 setName(this.path);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\u6211\u4ee5\u4e3a\u53ea\u6709Context\u6807\u7b7e\u7684path\u5c5e\u6027\u624d\u80fd\u6539\u53d8StandardContext\u7684name\u5c5e\u6027\u503c\u3002\u4f46\u662f\u4e3a\u4e86\u76f4\u63a5\u7528\u57df\u540d\u8bbf\u95ee\u5de5\u7a0b\uff0cpath\u53ea\u80fd\u4e3a\u7a7a\u3002\u5206\u6790StandardContext\u52a0\u8f7dContext\u6807\u7b7e\u7684\u8fc7\u7a0b\uff0c\u53d1\u73b0\u4ed6\u662f\u901a\u8fc7\u53cd\u5c04\u8fdb\u884c\u8bbe\u503c\u7684\u3002\u6bd4\u5982Context\u6807\u7b7e\u914d\u7f6e\u4e86path,\u5b83\u5c31\u8c03\u7528\u4e86StandardContext.setPath\u3002\u90a3\u5982\u679cContext\u6807\u7b7e\u914d\u7f6e\u4e86name,\u5b83\u662f\u4e0d\u662f\u4e5f\u4f1a\u8c03\u7528StandardContext.setName\u5462\uff1f\u8bd5\u7740\u5728Context\u6807\u7b7e\u91cc\u914d\u7f6ename\u5c5e\u6027\u503c\u4e3a\u5de5\u7a0b\u540d\uff1a&#8221;\/web-sys&#8221;\uff0c\u53d1\u73b0StandardContext[]\u7684name\u503c\u53d8\u4e86\uff0c\u800c\u4e14standardContext[\/web-sys]\u4e5f\u6ca1\u6709\u88ab\u52a0\u8f7d\u3002\u5230\u6b64\u6210\u529f\u3002<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><span style=\"color: #ff0000;\"><strong>GOOOOOOOOD<\/strong><\/span><\/p>\n<p><span style=\"color: #ff0000;\"><strong>Tomcat\u7ec4\u6210\u4e0e\u5de5\u4f5c\u539f\u7406<\/strong><\/span><\/p>\n<p><span style=\"color: #ff0000;\"><strong>https:\/\/juejin.im\/post\/58eb5fdda0bb9f00692a78fc<\/strong><\/span><\/p>\n<p><strong>Web \u5e94\u7528\u7684\u90e8\u7f72\u65b9\u5f0f<\/strong><br \/>\n\u6ce8\uff1acatalina.home\uff1a\u5b89\u88c5\u76ee\u5f55;catalina.base\uff1a\u5de5\u4f5c\u76ee\u5f55;\u9ed8\u8ba4\u503c user.dir<\/p>\n<ul>\n<li>Server.xml \u914d\u7f6e Host \u5143\u7d20\uff0c\u6307\u5b9a appBase \u5c5e\u6027\uff0c\u9ed8\u8ba4\\$catalina.base\/webapps\/<\/li>\n<li>Server.xml \u914d\u7f6e Context \u5143\u7d20\uff0c\u6307\u5b9a docBase\uff0c\u5143\u7d20\uff0c\u6307\u5b9a web \u5e94\u7528\u7684\u8def\u5f84<\/li>\n<li>\u81ea\u5b9a\u4e49\u914d\u7f6e\uff1a\u5728\\$catalina.base\/EngineName\/HostName\/XXX.xml \u914d\u7f6e Context \u5143\u7d20<\/li>\n<\/ul>\n<p>HostConfig \u76d1\u542c\u4e86 StandardHost \u5bb9\u5668\u7684\u4e8b\u4ef6\uff0c\u5728 start \u65b9\u6cd5\u4e2d\u89e3\u6790\u4e0a\u8ff0\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<ul>\n<li>\u626b\u63cf appbase \u8def\u5f84\u4e0b\u7684\u6240\u6709\u6587\u4ef6\u5939\u548c war \u5305\uff0c\u89e3\u6790\u5404\u4e2a\u5e94\u7528\u7684 META-INF\/context.xml\uff0c\u5e76 \u521b\u5efa StandardContext\uff0c\u5e76\u5c06 Context \u52a0\u5165\u5230 Host \u7684\u5b50\u5bb9\u5668\u4e2d\u3002<\/li>\n<li>\u89e3\u6790$catalina.base\/EngineName\/HostName\/\u4e0b\u7684\u6240\u6709 Context \u914d\u7f6e\uff0c\u627e\u5230\u76f8\u5e94 web \u5e94 \u7528\u7684\u4f4d\u7f6e\uff0c\u89e3\u6790\u5404\u4e2a\u5e94\u7528\u7684 META-INF\/context.xml\uff0c\u5e76\u521b\u5efa StandardContext\uff0c\u5e76\u5c06 Context \u52a0\u5165\u5230 Host \u7684\u5b50\u5bb9\u5668\u4e2d\u3002<\/li>\n<\/ul>\n<p>\u6ce8\uff1a<\/p>\n<ul>\n<li>HostConfig \u5e76\u6ca1\u6709\u5b9e\u9645\u89e3\u6790 Context.xml\uff0c\u800c\u662f\u5728 ContextConfig \u4e2d\u8fdb\u884c\u7684\u3002<\/li>\n<li>HostConfig \u4e2d\u4f1a\u5b9a\u671f\u68c0\u67e5 watched \u8d44\u6e90\u6587\u4ef6(context.xml \u914d\u7f6e\u6587\u4ef6)<\/li>\n<\/ul>\n<p>ContextConfig \u89e3\u6790 context.xml \u987a\u5e8f\uff1a<\/p>\n<ul>\n<li>\u5148\u89e3\u6790\u5168\u5c40\u7684\u914d\u7f6e config\/context.xml<\/li>\n<li>\u7136\u540e\u89e3\u6790 Host \u7684\u9ed8\u8ba4\u914d\u7f6e EngineName\/HostName\/context.xml.default<\/li>\n<li>\u6700\u540e\u89e3\u6790\u5e94\u7528\u7684 META-INF\/context.xml<\/li>\n<\/ul>\n<p>ContextConfig \u89e3\u6790 web.xml \u987a\u5e8f\uff1a<\/p>\n<ul>\n<li>\u5148\u89e3\u6790\u5168\u5c40\u7684\u914d\u7f6e config\/web.xml<\/li>\n<li>\u7136\u540e\u89e3\u6790 Host \u7684\u9ed8\u8ba4\u914d\u7f6e EngineName\/HostName\/web.xml.default \u63a5\u7740\u89e3\u6790\u5e94\u7528\u7684 MEB-INF\/web.xml<\/li>\n<li>\u626b\u63cf\u5e94\u7528 WEB-INF\/lib\/\u4e0b\u7684 jar \u6587\u4ef6\uff0c\u89e3\u6790\u5176\u4e2d\u7684 META-INF\/web-fragment.xml \u6700\u540e\u5408\u5e76 xml \u5c01\u88c5\u6210 WebXml\uff0c\u5e76\u8bbe\u7f6e Context<\/li>\n<\/ul>\n<p>\u6ce8\uff1a<\/p>\n<ul>\n<li>\u626b\u63cf web \u5e94\u7528\u548c jar \u4e2d\u7684\u6ce8\u89e3(Filter\u3001Listener\u3001Servlet)\u5c31\u662f\u4e0a\u8ff0\u6b65\u9aa4\u4e2d\u8fdb\u884c\u7684\u3002<\/li>\n<li>\u5bb9\u5668\u7684\u5b9a\u671f\u6267\u884c\uff1abackgroundProcess\uff0c\u7531 ContainerBase \u6765\u5b9e\u73b0\u7684\uff0c\u5e76\u4e14\u53ea\u6709\u5728\u9876\u5c42\u5bb9\u5668 \u4e2d\u624d\u4f1a\u5f00\u542f\u7ebf\u7a0b\u3002(backgroundProcessorDelay=10 \u6807\u5fd7\u4f4d\u6765\u63a7\u5236)<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>\u4e5f\u53ef\u80fd\u662f\u5728Tomcat\u7684\u540c\u4e00\u4e2ahost\u4e0b\u6709\u4e24\u4e2aApp\uff0c\u6bcf\u4e2aapp\u7684lib\u4e0b\u90fd\u6709\u4e00\u4e2alog4j\u7684jar\u5305\uff0c\u800c\u5bfc\u81f4\u4e86\u4e24\u4e2ajar\u5305\u540c\u65f6\u5360\u6709log\u6587\u4ef6\u3002\u81f4\u4f7flog\u6587\u4ef6rename\u4e0d\u6210\u529f\u3002\u53ef\u4ee5\u628a\u4e24\u4e2aapp\u7684jar\u5305\u653e\u5165tomcat\u7684\u516c\u7528lib\u4e0b\uff0c\u53ef\u4ee5\u89e3\u51b3\u6b64\u95ee\u9898\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/blog.csdn.net\/lmmzsn\/article\/details\/77988716?u [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20,53,33],"tags":[134],"_links":{"self":[{"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/posts\/856"}],"collection":[{"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vongg.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=856"}],"version-history":[{"count":8,"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/posts\/856\/revisions"}],"predecessor-version":[{"id":873,"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/posts\/856\/revisions\/873"}],"wp:attachment":[{"href":"https:\/\/vongg.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=856"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vongg.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=856"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vongg.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=856"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}