首页 > 其他分享 >记录一下tomcat报错日志分析(去重分类)

记录一下tomcat报错日志分析(去重分类)

时间:2024-05-15 15:22:27浏览次数:11  
标签:log tomcat 报错 file output path 日志 data line

#!/usr/bin/env python
# coding=utf-8
import os

folder_path = 'E:\\Desktop'
output_file = 'E:\\Desktop\\bsvc_error.log'


def merge_files(folder_path, output_file):
    with open(output_file, 'w', encoding='utf-8') as f:
        for root, dirs, files in os.walk(folder_path):
            for file in files:
                file_path = os.path.join(root, file)
                with open(file_path, 'r', encoding='utf-8') as f2:
                    content = f2.read()
                    f.write(content)


def find_error_log(log_name=output_file):
    original_file = open(log_name, encoding='utf-8')
    extract = []
    log = []
    for line_data in original_file:
        if '] ERROR' in line_data and 'Token失效,请重新登录' not in line_data:
            result = line_data[line_data.index("] ERROR") + 8:]
            extract.append(result)
    for i in extract:
        if i not in log:
            log.append(i)

    f = open("E:\\Desktop\\test.log", "w")
    for line in log:
        f.write(line)
    f.close()


if __name__ == '__main__':
    merge_files(folder_path, output_file)
    find_error_log()

 

标签:log,tomcat,报错,file,output,path,日志,data,line
From: https://www.cnblogs.com/teangtang/p/18193902

相关文章

  • docker启动java容器报错unable to allocate file descriptor table - out of memory
    问题:启动java进程报错{"log":"libraryinitializationfailed-unabletoallocatefiledescriptortable-outofmemory","stream":"stderr","time":"2024-05-15T06:27:14.681052443Z"}原因:LimitNOFILE=infinity......
  • Nginx配置https(证书)报错
    一、nginx配置问题nginx配置https的时候报错: nginx:[emerg]unknowndirective35+GAN"ssl"in/usr/local/nginx/conf/nginx.conf:28或者 nginx:[emerg]the"ssl"parameterrequiresngx_http_ssl_modulein/usr/loca....出现这个问题的时候可以检查一下是不是没有......
  • ROS学习日记:(报错)terminate called after throwing an instance of 'rclcpp::excepti
    论坛里的一个老哥给出答案https://discourse.ros.org/t/how-to-shutdown-and-reinitialize-a-publisher-node-in-ros-2/4090就是我在初始化环境前先初始化了节点autonode=std::make_shared<Static_tf_broadcaster>(argv);rclcpp::init(argc,argv);rclcpp::spin(nod......
  • root用户登陆ssh报错 /bin/bash: Permission denied
    CentOS7.5 ssh服务升级后,sshd服务状态正常,root用户登陆成功Xshell7(Build0157)Copyright(c)2020NetSarangComputer,Inc.Allrightsreserved.Type`help'tolearnhowtouseXshellprompt.[C:\~]$Connectingto127.0.0.1:XXXXX...Connectionestablished......
  • 关于npm install报错问题
    npminstall安装报错时,可能的原因有很多,以下是一些常见的解决方法:请记住,解决npm安装问题通常需要具体问题具体分析。根据错误消息和上下文信息,可能需要采用不同的方法来解决问题。清除npm缓存:有时候,npm的缓存可能会导致安装失败。你可以尝试运行npmcacheclean--force命令来......
  • 打开symlink类型的文件报错:无法遵循符号链接,因为其类型已禁用
     参考:https://blog.csdn.net/KEVERSO/article/details/84780368在英文系统中对应的是“Thesymboliclinkcannotbefollowedbecauseitstypeisdisabled.”简单的解决方案是,运行以下命令:FSUtilBehaviorSetSymlinkEvaluationL2L:1R2R:1L2R:1R2L:1Windows把文件......
  • 如何优雅的使用aop记录带参数的复杂web接口日志
    1、新建一个自定义注解packagecom.ninestar.userFile.aop.annotation;importcom.ninestar.userFile.constant.Constants;importjava.lang.annotation.*;/***系统日志注解**@AuthorTring*@Date2024年5月7日14:31:18*/@Target(ElementType.METHOD)@Re......
  • 【转】[IDEA] 启动报错 Internal error. Please refer to...
    转自:https://blog.csdn.net/liyh722/article/details/136699609 问题原因:java.net.BindException:地址已在使用中:也就是idea启动时需要占用一些端口,但是已经被其它打开的软件占用了。IDE正在本地主机上启动服务器,它将尝试在6942和6991之间的第一个可用端口上进行绑定,如果IDE......
  • 实现Python日志点击跳转到代码位置的方法
    前言在软件开发过程中,日志是一种非常重要的工具,用于记录程序运行时的状态、错误信息以及调试信息。当程序出现问题时,定位到具体的代码位置对于排查问题至关重要。本文将介绍如何在Python日志中实现点击跳转到代码位置的功能,以提高调试效率。为什么需要点击跳转功能?通常情况下,......
  • 连接SQL Server报错
    将框架从.NET6升级到8,顺便将各种依赖包也升级,容器化部署到测试环境后,SQLServer连接不了了:[2024-05-1313:48:10ERR][Microsoft.EntityFrameworkCore.Database.Connection]Anerroroccurredusingtheconnectiontodatabase'Demo'onserver'127.0.0.1'.[2024-05-131......