log4j配置 && maven配置
一、log4j配置
----------------------------
<appender name="sqlFile" class="org.apache.log4j.DailyRollingFileAppender"> <param name="DatePattern" value="'.'yyyy-MM-dd"/> <param name="file" value="/export/home/tomcat/logs/order.log.ybin.com/sql.log" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d [%7r] %6p - %30.30c - %m \n"/> </layout> <filter class="org.apache.log4j.varia.LevelRangeFilter"> <param name="LevelMin" value="info" /> <param name="levelMax" value="info" /> </filter> </appender> <logger name="java.sql.PreparedStatement" additivity="false"> <level value="DEBUG"/> <appender-ref ref="sqlFile"/> </logger>
<logger name="com.yb.order.log" additivity="false"> <level value="info" /> <appender-ref ref="CONSOLE" /> <!--测试时看一个日志方便 线上拿掉--> <appender-ref ref="infoFile"/> <appender-ref ref="errorFile" /> </logger> <root> <level value="ERROR" /> <appender-ref ref="CONSOLE" /> </root>
<dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency>
二、log4j引入 ------------------------ <!-- log4j相关 start --> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.16</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.13</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.13</version> <exclusions> <exclusion> <groupId>log4j</groupId> <artifactId>log4j</artifactId> </exclusion> </exclusions> </dependency> <!-- log4j相关 end -->
相关推荐
chw0 2020-11-04
sdaq 2020-07-26
MrLiar 2020-07-07
sdaq 2020-06-16
丨Fanny丨Cri 2020-06-13
CXC0 2020-06-08
MrLiar 2020-06-04
丨Fanny丨Cri 2020-06-03
丨Fanny丨Cri 2020-05-17
JavaWinner 2020-05-10
JavaWinner 2020-05-04
CXC0 2020-04-20
CXC0 2020-04-10
丨Fanny丨Cri 2020-02-18
MrLiar 2020-02-16
CXC0 2020-02-09