在ext项目中 在docroot/WEB-INF/ext-impl/src 目录下 创建文件夹 META-INF 把源码对应目录中的 log4j.dtd复制至此。
把源码中对应目录的portal-log4j.xml复制到此目录下 更名为 portal-log4j-ext.xml 内容修改为
<?xml version="1.0"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.EnhancedPatternLayout"> <param name="ConversionPattern" value="%d{yyyy MM dd HH:mm:ss,SSS} %-5p [%t][%c{1}] %m%n" /> </layout> </appender> <appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender"> <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"> <param name="FileNamePattern" value="@liferay.home@/logs/liferay@spi.id@.%d{yyyy-MM-dd}.log" /> </rollingPolicy> <layout class="org.apache.log4j.EnhancedPatternLayout"> <param name="ConversionPattern" value="%d{yyyy MM dd HH:mm:ss,SSS} %-5p [%t][%c{1}] %m%n" /> </layout> </appender> <appender name="ASYNC" class="org.apache.log4j.AsyncAppender"> <appender-ref ref="CONSOLE" /> <appender-ref ref="FILE" /> </appender> <category name="com.liferay.portlet.login.util.LoginLog"> <priority value="INFO" /> </category> <category name="com.liferay.portlet.login.util.LogoutLog"> <priority value="INFO" /> </category> <category name="com.liferay.portal.kernel.search.Hits"> <priority value="INFO" /> </category> <category name="com.liferay.portlet.blogs.action.BlogFilterService"> <priority value="INFO" /> </category> <root> <priority value="INFO" /> <appender-ref ref="ASYNC" /> </root> </log4j:configuration>