java service wrapper日志参数设置及优化
一般在容器比如tomcat/weblogic中運行時,我們都是通過log4j控制日志輸出的,因為我們現在很多服務端使用java service wrapper(至于為什么使用jsw,原先是比較排斥使用的,但是當一臺服務器上部署10來個應用時,我們無條件的選擇了jsw,因為不需要折騰和規劃這么多的端口了,尤其是我們還是自己的RPC時,每個應用的端口需求從4個變成了1個)進行啟動和管理,而JSW還有自己的日志格式,可以說在log4j上又套了一層馬甲,默認的日志格式并不是輸出原始log4j信息,因為我們已經使用log4j管理了,所以不再需要JSW的馬甲,其通過如下參數控制日志格式、大小以及滾動。
# Format of output for the console. (See docs for formats) wrapper.console.format=PM# Log Level for console output. (See docs for log levels) wrapper.console.loglevel=INFO# Log file to use for wrapper output logging. wrapper.logfile=../logs/osm-runtime.log# Format of output for the log file. (See docs for formats) wrapper.logfile.format=M# Log Level for log file output. (See docs for log levels) wrapper.logfile.loglevel=INFO# Maximum size that the log file will be allowed to grow to before # the log is rolled. Size is specified in bytes. The default value # of 0, disables log rolling. May abbreviate with the 'k' (kb) or # 'm' (mb) suffix. For example: 10m = 10 megabytes. wrapper.logfile.maxsize=10m# Maximum number of rolled log files which will be allowed before old # files are deleted. The default value of 0 implies no limit. wrapper.logfile.maxfiles=100# Log Level for sys/event log output. (See docs for log levels) wrapper.syslog.loglevel=NONEformat的取值如下(貼出來純屬官網依賴google的cdn或嵌入廣告,不FQ打開實在慢):
Format to use for logging to the log file. Logging has been intentionally kept simple.
The format consists of the following tokens:
- 'L' for log level,
- 'P' for prefix,
- 'D' (Since ver. 3.1.0) for thread,
- 'T' for time,
- 'Z' for millisecond time,
- 'R' quite duration milliseconds showing the time since the previous JVM output,
- 'U' (Since ver. 3.5.0) for approximate uptime in seconds (based on internal tick counter and is valid up to one year from startup),
- 'G' (Since ver. 3.5.8) for time in milliseconds it tool to log the previous log entry (See wrapper.log.warning.threshold for more information),
- 'W' (Since ver. 3.5.30) for the PID of the Wrapper process.
- 'J' (Since ver. 3.5.30) for the PID of the Java process (if the JVM is up).
- 'M' for message.
If the format contains these tokens above, then it will be output with the specified formation. The order of the tokens does not affect the way the log appears, but the 'M' (for message) token should usually be placed last as it is the only column without a uniform width. If the property is missing tokens or commented out, then the default value 'LPTM' will be used.
Logging Disable:
Setting the property to a blank value will cause file logging to be disabled.
wrapper.logfile.format=設置日志刷新間隔: wrapper.logfile.flush.timeout=min(5,1*進程數)
eclipse集成wrapper,可參考http://wrapper.tanukisoftware.com/doc/english/qna-eclipse-integration.html
轉載于:https://www.cnblogs.com/zhjh256/p/6364119.html
總結
以上是生活随笔為你收集整理的java service wrapper日志参数设置及优化的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: django(7)modelform操作
- 下一篇: UVA-804 模拟