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=NONE
format的取值如下(贴出来纯属官网依赖google的cdn或嵌入广告,不翻墙打开实在慢):
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
java service wrapper日志参数设置及优化的更多相关文章
- Java Service Wrapper将java程序设置为服务
有时候我们希望我们java写的程序作为服务注册到系统中,Java Service Wrapper(下面简称wrapper)是目前较为流行的将Java程序部署成Windows服务的解决方案, 本文将讨论 ...
- Java Service Wrapper 发布Java程序为Windows服务
下载Windows版本:https://www.krenger.ch/blog/java-service-wrapper-3-5-37-for-windows-x64/ 转自:F:\java\bhGe ...
- java service wrapper 级别为info导致内存剧增直至溢出
上周,公司某一环境发生java service wrapper内存剧增导致最后被自动killed的情况,经过分析,确定导致java service wrapper(后续简称wrapper)守护进程内存 ...
- Java Service Wrapper简介与使用
在实际开发过程中很多模块需要独立运行,他们并不会以web形式发布,传统的做法是将其压缩为jar包独立运行,这种形式简单易行也比较利于维护,但是一旦服务器重启或出现异常时,程序往往无法自行修复或重启.解 ...
- 使用 Java Service Wrapper 启动java后台进程服务
Java Service Wrapper (http://wrapper.tanukisoftware.com/doc/english/product-overview.html)可以很方便得在各个平 ...
- 利用JAVA Service Wrapper把JAVA程序做成windows服务
今天做了一个读取数据入库的程序.由于读取的数据每天都更新,于是就想把程序做成一个服务,每天定时执行.研究了一下,发现有几种方式可以做.下面我主要记录一下JAVA Service Wrapper方式. ...
- 使用Java Service Wrapper在Linux下配置Tomcat应用
前言 Java Service Wrapper是Tanuki Software的一个产品,可以将Java应用注册成Windows或Linux服务,使其可以随系统开机启动,同时可以监控Java应用的状态 ...
- Java Service Wrapper 使用
版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/sinat_26279177/article/details/70807173 1 简介 ...
- Java Service Wrapper简介与使用(转)
本文转自https://www.cnblogs.com/zcy_soft/p/3738947.html,写的非常好,珍藏一下 1. wrapper的意思? wrapper在此处理解为“包装”. 2. ...
随机推荐
- java成员变量和局部变量的初始化和内存中的运行机制
成员变量: 当系统加载类或创建类的实例时,系统会自动为成员变量分配内存空间,并在分配内存空间后,自动为成员变量指定初始值. eyeNum是类属性.name是实例属性 所有person实例访问eyeNu ...
- POJ 2528 - Mayor's posters - [离散化+区间修改线段树]
题目链接:http://poj.org/problem?id=2528 Time Limit: 1000MS Memory Limit: 65536K Description The citizens ...
- 七种RAID技术
想把好多硬盘组在一起使用的基本方式为:连接所有硬盘,先向第一个硬盘中写数据,满了之后,再向第二个硬盘上写数据,如此只是简单的连通了多个硬盘. 再此基础上发展了RAID技术:由独立磁盘组成的具有冗余特性 ...
- 使用Homebrew在Mac OS X EI Capitan上安装与配置nginx和PHP
安装nginx brew install nginx sudo nginx 测试安装 在浏览器打开下面的链接地址 http://localhost:8080 nginx.conf配置 # HTTPS ...
- Rotate Image(二位数组顺时针旋转)
问题描述: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockw ...
- 【python基础】字符串格式化(% VS format)
字符串格式化 Python的字符串格式化有两种方式: 百分号方式.format方式 百分号的方式相对来说比较老,而format方式则是比较先进的方式,企图替换古老的方式,目前两者并存. 1.百分号方式 ...
- seajs引入jquery为什么无效?
简单来说,你的jquery没有模块化? 答案:传送门1.传送门2
- [py]requests+json模块处理api数据,flask前台展示
需要处理接口json数据,过滤字段,处理字段等. 一大波json数据来了 参考: https://stedolan.github.io/jq/tutorial/ https://api.github. ...
- PAT 1015 Reversible Primes[求d进制下的逆][简单]
1015 Reversible Primes (20)(20 分)提问 A reversible prime in any number system is a prime whose "r ...
- jmeter Bean Shell的使用(一)
未经作者允许,禁止转载!!! Jmeter有哪些Bean Shell 定时器: BeanShell Timer 前置处理器:BeanShell PreProcessor 采样器: BeanShell ...