发表于: 2020-05-25 21:51:43

1 1363


今天完成的事情:tomcat jetty resin 的日志配置 以及奇奇怪怪的bug

一、跑代码

代码在window上跑得好好的,跑服务器就一堆问题

在Linux上部署好了resin服务器,然后将war包放在webapps目录下启动,然后就出现

说明我部署的没有问题,但是图片不显示,而且我查询所有的时候也一直在等待响应

 然后我分别用了tomcat Jetty 进行部署,结果每一个正常的,都是在等待响应。.....甚至Jetty一直在蹦代码

暂时解决不了 放一放

二、配置access.log

1、resin 部署access.log

      路径:resin/conf/cluster-default.xml

<host-default>

      <access-log path="log/access.log"

                 format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"%D'

                 rollover-period="1W"/>

%D 毫秒级别


2、tomcat部署access.log

tomcat/conf/server.xml

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"

               prefix="localhost_access_log" suffix=".txt"

               pattern="%h %l %u %t &quot;%r&quot; %s %b %D %F" />

  • %D-以毫秒为单位处理请求所花费的时间。注意:在httpd中,%D是微秒。从Tomcat 10开始,行为将与httpd对齐。
  • %F-提交响应所花费的时间(以毫秒为单位)
  • http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Access_Logging



3、Jetty 部署access.log

发现jetty中不像 tomcat  resin 有专门的日志配置文件,Jetty的日志配置需要增加一个模块首

配置请求日志模块

要通过Jetty分发为整个服务器启用请求日志模块,首先需要在命令行上启用它:

  • java -jar start.jar --add-to-start=requestlog  (执行该命令行)

  •  INFO: requestlog      initialised in ${jetty.base}/start.d/requestlog.ini 
  • MKDIR: ${jetty.base}/logs
    INFO: Base directory was modified

执行完之后 就会在start.ini文件的最下方出现 requestlog 这个模块 

(NCSA是国家计算机安全协会)

# ---------------------------------------

# Module: requestlog

# Enables a NCSA style request log.

# ---------------------------------------

--module=requestlog

## Logging directory (relative to $jetty.base)

# jetty.requestlog.dir=logs


## File path

# jetty.requestlog.filePath=${jetty.requestlog.dir}/yyyy_mm_dd.request.log

## Date format for rollovered files (uses SimpleDateFormat syntax)

# jetty.requestlog.filenameDateFormat=yyyy_MM_dd


## How many days to retain old log files(保留日志文件天数)

# jetty.requestlog.retainDays=90


## Whether to append to existing file(是否追加到现有文件)

# jetty.requestlog.append=false


## Whether to use the extended log output(是否使用扩展日志输出)

# jetty.requestlog.extended=true


## Whether to log http cookie information(是否记录http cookie信息)

# jetty.requestlog.cookies=true

日志部署好了

回头解决一直蹦代码的问题

查看了三者日志都在报错

Mon May 25 16:04:28 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

CST 2020警告:不建议在没有服务器身份验证的情况下建立SSL连接。根据MySQL 5.5.45+、5.6.26+和5.7.6+的要求,如果没有设置显式选项,则必须在默认情况下建立SSL连接。您需要通过设置useSSL=false显式地禁用SSL,或者设置useSSL=true并为服务器证书验证提供信任存储。)SSL?

修改前

db.url=jdbc:mysql://localhost:3306/task1?characterEncoding=UTF-8

修改后

db.url=jdbc:mysql://localhost:3306/task1?useSSL=true&characterEncoding=UTF-8

这样修改就可以了。(看了也不懂为啥,改了再说)

本来以为已经好了,结果又报错,找不到配置文件

this web application instance has been stopped already. Could not load [com/mapper/IStudentMapper.xml]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access

(此web应用程序实例已经停止。无法加载[com/mapper/IStudentMapper.xml]。下面的堆栈跟踪是为了调试以及试图终止导致非法访问的线程而抛出的)

暂时解决不了

明天的计划:尝试跑代码,解决不了就去深度思考



返回列表 返回列表
评论

    分享到