您的当前位置:首页正文

Log4j2中properties配置文件

2022-10-08 来源:钮旅网
Log4j2中properties配置文件

Log4j2 一开始抛弃了properties配置文件格式,到2.4版本时,又开始支持properties配置文件格式。到2.6版本又有新的要求。我用的是写本文时的最近版本2.8

1. status = error 2.

3. property.LOG_HOME=/output/logs 4. property.BACKUP_HOME=backup 5. property.SERVER_NAME=buddie-Service 6. property.EVERY_FILE_SIZE=10M 7. property.OUTPUT_LOG_LEVEL=INFO 8. property.FILE_MAX=10 9.

10. appender.console.type = Console 11. appender.console.name = STDOUT

12. appender.console.layout.type = PatternLayout 13. appender.console.layout.pattern = %m%n 14.

15. appender.rolling.type=RollingFile 16. appender.rolling.name=RollingFileAll 17. appender.rolling.filter.threshold.level = trace

18. appender.rolling.filter.threshold.type = ThresholdFilter

19. appender.rolling.fileName=${LOG_HOME}/dev_${SERVER_NAME}_all.log

20. appender.rolling.filePattern=${LOG_HOME}/dev_${BACKUP_HOME}/dev_${SERVER_NAME}_all.%d{yyyy-MM-dd-HH}.log

21. appender.rolling.layout.type=PatternLayout

22. appender.rolling.layout.pattern=%d %p %C{1.} [%t] %m%n

23. appender.rolling.policies.type=Policies

24. appender.rolling.policies.time.type=TimeBasedTriggeringPolicy

25. appender.rolling.policies.time.interval=2 26. appender.rolling.policies.time.modulate=true 27. appender.rolling.policies.size.type=SizeBasedTriggeringPolicy

28. appender.rolling.policies.size.size=${EVERY_FILE_SIZE}

29. appender.rolling.strategy.type=DefaultRolloverStrategy

30.

31. appender.error.type=RollingFile 32. appender.error.name=RollingFileError 33. appender.error.filter.threshold.level = error

34. appender.error.filter.threshold.type = ThresholdFilter 35. appender.error.fileName=${LOG_HOME}/dev_${SERVER_NAME}_error.log

36. appender.error.filePattern=${LOG_HOME}/dev_${BACKUP_HOME}/dev_${SERVER_NAME}_error.%d{yyyy-MM-dd-HH}.log

37. appender.error.layout.type=PatternLayout

38. appender.error.layout.pattern=%d %p %C{1.} [%t] %m%n

39. appender.error.policies.type=Policies

40. appender.error.policies.time.type=TimeBasedTriggeringPolicy

41. appender.error.policies.time.interval=2

42. appender.error.policies.time.modulate=true 43. appender.error.policies.size.type=SizeBasedTriggeringPolicy

44. appender.error.policies.size.size=${EVERY_FILE_SIZE} 45. appender.error.strategy.type=DefaultRolloverStrategy 46.

47. appender.charge.type=RollingFile 48. appender.charge.name=RollingFileCharge 49. appender.charge.filter.threshold.level = trace 50. appender.charge.filter.threshold.type = ThresholdFilter

51. appender.charge.fileName=${LOG_HOME}/dev_${SERVER_NAME}_charge.log

52. appender.charge.filePattern=${LOG_HOME}/dev_${BACKUP_HOME}/dev_${SERVER_NAME}_charge.%d{yyyy-MM-dd-HH}.log

53. appender.charge.layout.type=PatternLayout 54. appender.charge.layout.pattern=%d %p %C{1.} [%t] %m%n

55. appender.charge.policies.type=Policies

56. appender.charge.policies.time.type=TimeBasedTriggeringPolicy

57. appender.charge.policies.time.interval=2 58. appender.charge.policies.time.modulate=true 59. appender.charge.policies.size.type=SizeBasedTriggeringPolicy

60. appender.charge.policies.size.size=${EVERY_FILE_SIZE}

61. appender.charge.strategy.type=DefaultRolloverStrategy

62. 63. 64. 65. 66. 67.

68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. rge

83. 84. 85. 86. 87. 88.

logger.activity.name = buddie.activity logger.activity.level = debug logger.activity.additivity = false

logger.activity.appenderRef.all.ref = RollingFileAll logger.activity.appenderRef.error.ref = RollingFileError logger.activity.appenderRef.stdout.ref = STDOUT

logger.login.name = buddie.login logger.login.level = debug logger.login.additivity = false

logger.login.appenderRef.all.ref = RollingFileAll logger.login.appenderRef.error.ref = RollingFileError logger.login.appenderRef.stdout.ref = STDOUT

logger.charge.name = buddie.charge logger.charge.level = trace logger.charge.additivity = false

logger.charge.appenderRef.all.ref = RollingFileAll logger.charge.appenderRef.error.ref = RollingFileError logger.charge.appenderRef.charge.ref = RollingFileChalogger.charge.appenderRef.stdout.ref = STDOUT

rootLogger.level = info

rootLogger.appenderRef.stdout.ref = STDOUT rootLogger.appenderRef.all.ref = RollingFileAll rootLogger.appenderRef.error.ref = RollingFileError

因篇幅问题不能全部显示,请点此查看更多更全内容