在项目访问量不断增加时,tomcat下logs也迅速增大,有时甚至因为填满了所在分区而出现无空间写入日志而导致程序出问题。

这时要更改logs的默认目录,指向更大的磁盘。修改主要有两步:

1. 修改tomcat/conf下的logging.properties 

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License. handlers = 1catalina.org.apache.juli.AsyncFileHandler, 2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler .handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler ############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################ 1catalina.org.apache.juli.AsyncFileHandler.level = FINE
1catalina.org.apache.juli.AsyncFileHandler.directory = /data/logs/tomcat8log/logs
1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina. 2localhost.org.apache.juli.AsyncFileHandler.level = FINE
2localhost.org.apache.juli.AsyncFileHandler.directory = /data/logs/tomcat8log/logs
2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost. 3manager.org.apache.juli.AsyncFileHandler.level = FINE
3manager.org.apache.juli.AsyncFileHandler.directory = /data/logs/tomcat8log/logs
3manager.org.apache.juli.AsyncFileHandler.prefix = manager. 4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
4host-manager.org.apache.juli.AsyncFileHandler.directory = /data/logs/tomcat8log/logs
4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager. java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter

把其中各个directory路径更改为要存储对应日志的路径,一般都是设置为同一个地方。

2. 修改tomcat/bin/catalina.sh 

if [ -z "$CATALINA_OUT" ] ; then
CATALINA_OUT=/data/logs/tomcat8log/logs/catalina.out
fi

把CATALINA_OUT修改为与logging.properties修改一样的路径,便于日志集中管理。

重启tomcat就能看到diska/tomcatlog/logs/下开始产生新日志了。

tomcat默认日志路径更改的更多相关文章

  1. Tomcat配置虚拟主机、tomcat的日志

    1.配置Tomcat的虚拟主机修改:vim /usr/local/tomcat9/conf/server.xml 添加一个虚拟主机:加入: <Host name="www.tomcat ...

  2. 修改docker默认存储路径

    默认情况下,docker镜像的默认存储路径是/var/lib/docker,这相当于直接挂载系统目录下,而一般在搭系统时,这个区都不会太大,所以如果长期使用docker开发应用,就需要把默认的路径更改 ...

  3. Nginx 配置日志路径(nginx.conf没有写log路径,所以debug的时候找不到日志)

    缘由:nginx.conf没有写log路径,所以debug的时候找不到日志,遂在conf文件里写入了log路径 Setp1.nginx默认日志路径: /var/log/nginx Setp2.conf ...

  4. 更改 Tomcat 日志路径

    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...

  5. 【转】Tomcat的默认访问路径

    放在外网的应用,用户多是直接输入域名访问,相信没有哪个后面还加个尾巴,而Tomcat的默认目录是ROOT,所以我们需要更改其默认目录. 更改Tomcat的默认目录很简单,只需要修改server.xml ...

  6. 更改Windows Live Writer默认日志与草稿保存路径

    目的:把保存Windows Live Writer的日志与草稿文件夹My Weblog Posts移动到E:\Blog\路径下 用mklink命令,创建E:\Blog\路径下的My Weblog Po ...

  7. 更改git bash默认的路径

    更改git bash默认的路径   在打开git bash时,每次都是在C:\Uer路径下,每次都需要先用cd命令转换到自己需要工作的路径(cd  /f/dss).修改打开git bash 时的默认的 ...

  8. eclipse tomcat路径更改后启动报错

      eclipse tomcat路径更改后启动报错 CreateTime--2018年5月3日14:48:22 Author:Marydon 1.情景还原 2.原因 本地的tomcat路径修改后,ec ...

  9. Linux 更改默认安装路径

    一.rpm -qal |grep mysql 二.除了根据软件包来找文件位置之外,最常用的就是通过find查找某个关键字比如mysql所有包含mysql服务的文件路径 find / -name unr ...

随机推荐

  1. 由throw new Error() 引发的探讨

    问题复现 在工作时遇到了需要抛出异常并且需要自己捕获处理的地方,于是在抛出的地方写下 function parseExcel(con) { try { // doSomething } catch ( ...

  2. 如何保存或读取数据(到android的data目录)利用context获取常见目录可优化代码

    读取用户信息 当然这里可以有多种返回值 非硬性

  3. angularui 自定义选项卡

    ng-include 选取ng-template <!DOCTYPE html> <html lang="en" ng-app="myApp" ...

  4. Writing Science 7.10 (The Opening and The Funnel)

    Opening: 1.文章的第一句话必须要达到如下目标:找出推动研究的问题,介绍内容,并确定本文针对的观众.如果你足够聪明的话甚至可以将遇到的挑战以及结论写进来. 2.通过第一段话建立本文的重点和基调 ...

  5. springmvc返回枚举属性值

    使用fastJSON ,在枚举中写toString 方法 如下@Overridepublic String toString() {return "{" + this.name() ...

  6. Linux命令行与脚本编程大全第一章

    1, 2,linux内核:内存管理.进程管理.文件管理.设备管理. 其中内存管理如下图: 通过命令 cat/proc/meminfo查看系统的内存状态.通过ipcs查看共享内存.信号量.消息队列信息. ...

  7. [SDOI2011]工作安排

    Description 你的公司接到了一批订单.订单要求你的公司提供n类产品,产品被编号为1~n,其中第i类产品共需要Ci件.公司共有m名员工,员工被编号为1~m员工能够制造的产品种类有所区别.一件产 ...

  8. I/P/B/SI/SP帧和PTS/DTS的关系

    I frame:帧内编码帧 又称intra picture,I 帧通常是每个 GOP(MPEG 所使用的一种视频压缩技术)的第一个帧,经过适度地压缩,做为随机访问的参考点,可以当成图象.I帧可以看成是 ...

  9. 使用jsonp完美解决跨域问题

    调用web接口,get请求,发现提示:No 'Access-Control-Allow-Origin' header is present on the requested resource. 这个和 ...

  10. ZOJ 1489 HDU1395 2^x mod n = 1 数学

    2^x mod n = 1 Time Limit: 2 Seconds      Memory Limit:65536 KB Give a number n, find the minimum x t ...