level日志级别:off/severe/warning/info/config/fine/finer/finest/all
path日志文件路径:log/stdout.log
archive-format归档格式:如2007-5-10.stdout.log.gz
rollover-period日志回滚方式:按天(15D)、按周(1W)、按月(1M)、按小时(1h)等。
按文件大小生成日志
<log name="" level="warning" path="log/stdout.log" timestamp="[%H:%M:%S.%s] "
archive-format="%Y-%m-%d.stdout.log.gz"
rollover-size="10mb"/>
rollover-size每个日志文件的大小:byte(5000)、kb(128kb)、mb(10mb)
其他参数同上。
按照USBOSS的日志输出方式,可能看文件大小比较合适,每个日志文件10M-20M就差不多了。
4.4.1 指定debug日志
A useful technique is to enable full debug logging to track down a problem:
<log name='' level='finer' path='log/debug.log' timestamp="[%H:%M:%S.%s]" rollover-period='1h' rollover-count='1'/>
4.4.2 日志标准
Name API Meaning
off turn off logging
severe log.severe("...") a serious failure, likely to prevent normal program execution
warning log.warning("...") a potential problem
info log.info("...") informational messages
config log.config("...") static configuration messages, meant to assist in debugging problems associated with particular configurations
fine log.fine("...") tracing information
finer log.finer("...") fairly detailed tracing message
finest log.finest("...") highly detailed tracing message
all all messages should be logged
4.5 当出现内存耗没、或日志写的太快时,如果解决?
答:用top命令来查询一下全部进程的使用情况,发现有问题的进程,kill -9 processId。
4.6 当out of memory时,出现死锁进程,如果解决?
答: 首先用ps –ef|grep java查看进程命令,看系统内存使用情况。如果是存在死锁进程,可以通过kill -9 PID,来杀死它,然后重启。如果系统内存很小,可以对$RESION_HOME/bin/httpd.sh内的参数进行调整。
4.7 当resin启动时,如何指定java的内存大小?
1.Window下内存设置: -J"-server -Xms500m -Xmx1000m”
2.Linux配置: resin3/bin/httpd.sh 中的args。
4.8 Kill了指定的java进程后,resin它又自动的重启,怎么kill那?
答: 在httpd.sh文件中,有一个自动重启的perl脚本。可以通过ps –ef|grep java,来找出谁在调用java进程,发现perl进程在调用java,使用 ps –ef|grep perl,查找出来,先kill掉perl进程。然后再kill java进程。
4.9 查看resin是否是自动重启?
答: httpd.sh –h,中一个-no-auto-restart : disable automatic server restart,默认是自动重启的,可以指定这个启动参数,使得resin不自动重启。ps –ef|grep perl,看看这个进程是否是在启动状态。是否是让应用是否重启,可以根据具体情况来设定。更多信息,可以看wrapper.pl文件,搜索keepalive或auto-restart关键字,看它的初始参数值。
4.10 Resin不能启动,报java不能发现?
答:首先,检查java是否安装和是否在用户下的.bash_profile中进行了配置。
其次,如果安装和配置正确,再检查用户是否正确。如果用户是通过su to Change the effective user id and group id to that of USER. 例如:su –foo。这时执行shell命令:source或者. .bash_profile。
4.11 如何查看resin的命令参数解释?
答:查看命令参数httpd.sh –h, man httpd.sh,vi http.sh,
4.12 如何配置session的超时时间?
using session-config and session-timeout to control the number of sessions
<web-app id='/dir'>
4.13 Resin正常启动,DB中有用户,报用户不存在?
答:resin.conf中,一个conf只能配置一个<jndi-name>名称,并且这个名称必须是唯一的。否则, 前面的将覆盖前面的,所以导致不能登陆。
4.14 程序的建立连接数多时,系统死锁?
答:原因是resin.conf中,最大连接数配置的太少。这是可以调节到一个比较大的值。缺省为128个连接。
<max-connections> configures the maximum number of open connections allowed for Resin's database pool. Sites can use <max-connections> to throttle the number of database connections for an overloaded server. When max-connections is reached and an application calls getConnection, Resin will wait connection-wait-time or until a connection is freed before allocating a new connection.
default 128
4.15 服务器上的resin启动不了?
答:首先要查看,log/ stderr.log,看看是什么原因。例如:resin-2.1.17用root用户启动过,那么就会在logs/access.log日志,当重新启动时,当向access.log文件中写东西时,将报错,因为是不同的用户建立的这个文件,需要首先删除这个文件。