applicationContext-log.xml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xmlns:aop="http://www.springframework.org/schema/aop"
  4. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
  5. <description>日志高级演示配置</description>
  6. <!-- 消息Queue管理器-->
  7. <bean class="com.pentair.showcase.queue.QueuesHolder">
  8. <property name="queueSize" value="1000" />
  9. </bean>
  10. <!-- 读出Queue中日志消息写入数据库的任务 -->
  11. <bean id="jdbcLogWriter" class="com.pentair.showcase.log.appender.JdbcLogWriter">
  12. <property name="queueName" value="dblog" />
  13. <property name="batchSize" value="10" />
  14. <property name="sql">
  15. <value>
  16. insert into SS_LOG(THREAD_NAME,LOGGER_NAME,LOG_TIME,LEVEL,MESSAGE)
  17. values(:thread_name,:logger_name,:log_time,:level,:message)
  18. </value>
  19. </property>
  20. </bean>
  21. <!-- 动态配置log4j日志级别的JMX MBean -->
  22. <bean id="log4jMBean" class="org.springside.modules.log.Log4jMBean" />
  23. <!-- 使用annotation定义Aspect -->
  24. <aop:aspectj-autoproxy proxy-target-class="true" />
  25. <!-- 配置执行TraceUtils的Aspect -->
  26. <bean class="com.pentair.showcase.log.trace.TraceAspect" />
  27. <!-- 配置实用perf4j的log4j.xml,仅在性能调试时打开 -->
  28. <!--
  29. <bean id="log4jConfigurer" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
  30. <property name="targetClass" value="org.springframework.util.Log4jConfigurer" />
  31. <property name="targetMethod" value="initLogging" />
  32. <property name="arguments">
  33. <list>
  34. <value>classpath:log4j-perf4j.xml</value>
  35. </list>
  36. </property>
  37. </bean>
  38. -->
  39. </beans>