关于cronolog的用法查看:https://www.freebsd.org/cgi/man.cgi?query=cronolog&apropos=0&sektion=0&manpath=FreeBSD+7.2-RELEASE+and+Ports&format=html

或者使用man cronolog:

[root@weblogic ~]# cronolog -h
usage: cronolog [OPTIONS] logfile-spec -H NAME, --hardlink=NAME maintain a hard link from NAME to current log
-S NAME, --symlink=NAME maintain a symbolic link from NAME to current log
-P NAME, --prev-symlink=NAME maintain a symbolic link from NAME to previous log
-l NAME, --link=NAME same as -S/--symlink
-h, --help print this help, then exit
-p PERIOD, --period=PERIOD set the rotation period explicitly
-d DELAY, --delay=DELAY set the rotation period delay
-o, --once-only create single output log from template (not rotated)
-x FILE, --debug=FILE write debug messages to FILE
( or to standard error if FILE is "-")
-a, --american American date formats
-e, --european European date formats (default)
-s, --start-time=TIME starting time
-z TZ, --time-zone=TZ use TZ for timezone
-V, --version print version number, then exit

1、安装cronolog这个工具,这里使用yum进行安装:

[root@weblogic scripts]# yum whatprovides */cronolog
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base | 3.7 kB :
epel | 4.7 kB :
epel/primary_db | 6.0 MB :
extras | 3.4 kB :
updates | 3.4 kB :
epel/filelists_db | 7.8 MB :
extras/filelists_db | kB :
cronolog-1.6.-.el6.x86_64 : Web log rotation program for Apache
Repo : epel
Matched from:
Filename : /usr/sbin/cronolog
[root@weblogic scripts]# yum -y install cronolog

安装完成后,查看执行程序位置:

[root@weblogic scripts]# which cronolog
/usr/sbin/cronolog

2、使用cronolog给tomcat进行日志切割,修改catalina.sh脚本文件:

修改之前为:

org.apache.catalina.startup.Bootstrap "$@" start \
>> "$CATALINA_OUT" >& &

修改完成后,启动tomcat服务,查看日志文件:

时间查不同,那是因为之前并没有同步时间导致,于是切割tomcat日志成功

使用cronolog工具给tomcat进行日志切割的更多相关文章

  1. tomcat之日志切割

    日志分割 场景:日志量比较大,且研发程序没有设置分卷 1.配置样例: 文件路径:/etc/logrotate.d/tomcat /data/logs/catalina.out { daily comp ...

  2. Tomcat关闭日志catalina.out

    catalina.out文件会越来越大,对系统的稳定造成了一定的影响.conf/logging.properties 一般在部署Tomcat后,运行久了,catalina.out文件会越来越大,对系统 ...

  3. Nginx访问日志、日志切割、静态文件不记录日志和过期时间

    6月8日任务 12.10 Nginx访问日志12.11 Nginx日志切割12.12 静态文件不记录日志和过期时间 12.10 Nginx访问日志 除了在主配置文件nginx.conf里定义日志格式外 ...

  4. 日志切割工具logrotate解决Tomcat catalina.out日志过大的问题

    一.介绍日志切割logrotate 对于Linux系统安全来说,日志文件是极其重要的工具.不知为何,我发现很多运维同学的服务器上都运行着一些诸如每天切分Nginx日志之类的CRON脚本,大家似乎遗忘了 ...

  5. Linux 日志切割工具cronolog详解

    一.前言 二.cronolog 简介 三.cronolog 特点 四.cronolog 安装 五.cronolog 使用 六.cronolog 总结 注,操作系统 CentOS 6.4 x86_64, ...

  6. tomcat日志切割和定期删除(转载)

    tomcat日志切割和定期删除 在tomcat的软件环境中,如果我们任由日志文件无限增长,总有一天会将磁盘占满的(废话).特别是在日志文件增长速度很快的一些情况下,按日志切割日志文件并删除,就是一件很 ...

  7. tomcat日志切割和定期删除

    tomcat日志切割和定期删除 在tomcat的软件环境中,如果我们任由日志文件无限增长,总有一天会将磁盘占满的(废话).特别是在日志文件增长速度很快的一些情况下,按日志切割日志文件并删除,就是一件很 ...

  8. tomcat 日志切割 catalina.out

    在实际生产环境中,tomcat的 catalina.out日志默认是不切割的,由于看起来很不方便,以及在备份等方面都比较麻烦.是时候切割该文件了. 环境说明 centos 7.3 tomcat 8.5 ...

  9. cronolog日志切割catalina.out

    cronolog日志切割catalina.out (一)解压安装cronolog 1:wget  https://files.cnblogs.com/files/crazyzero/cronolog- ...

随机推荐

  1. 有关InitialContext()的困惑 <转>

    Context initial = new InitialContext();Object objref = initial.lookup("java:comp/env/ejb/Simple ...

  2. ios UIImage图片拉伸 resizableImageWithCapInsets:

    常见的按钮添加和背景设置如下: UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(80, 130, 160, 44)];[bu ...

  3. java启动3个线程轮流打印数字

    转自:http://blog.csdn.net/u014011112/article/details/50988769 http://blog.csdn.net/perrywork/article/d ...

  4. 微信小程序 --- 组件

    view组件:小程序使用最多的组件.可以理解为 div: Text组件:用于展示文字.可以理解为 p span 标签.(除了Text组件以外的其他组件都无法被长按选中) Text组件无法解析HTML, ...

  5. rest_framework之版本详解 04

    访问不同版本,给不同内容. rest规范:版本要么放url上:要么放请求头里. 1.原来的url的版本都写死了.只能写v1 from django.conf.urls import url from ...

  6. Webpack基础入门学习笔记

    # Webpack Project Build 1.创建一个项目目录文件夹 如:D:/demo 2.打开demo文件夹,按住Shift + 鼠标右键,选择[在此处打开命令窗口] 3.初始化npm,生成 ...

  7. HOJ 2317 Pimp My Ride(状态压缩DP)

    Pimp My Ride My Tags (Edit) Source : TUD 2005 Time limit : 3 sec Memory limit : 64 M Submitted : 63, ...

  8. FNV hash算法

    原文:https://blog.csdn.net/u013137970/article/details/79020095 FNV算法简介FNV算法属于非密码学哈希函数,它最初由Glenn Fowler ...

  9. pandas的DataFrame用法

    用来生成DataFrame数据 1.说明: class pandas.DataFrame(data=None, index=None, columns=None, dtype=None, copy=F ...

  10. 基于linux-2.6.35的class_create(),device_create解析

    基于linux-2.6.35的class_create(),device_create解析 作者:苗老师,华清远见嵌入式学院讲师. 从linux内核2.6的某个版本之后,devfs不复存在,udev成 ...