我正在使用SpringMVC框架和Java 8进行开发。在Tomcat catalina.out文件中,日期时间戳和三个日期没有与我的应用程序日志一起添加。
我收到的日志如下
INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-9090"]
INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["https-jsse-nio-8443"]
INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
java.io.FileNotFoundException: /apps/opt/sws/logs
Request SecurityContextHolderAwareRequestWrapper
Beginning of the api method我需要在我的应用程序示例中添加日期时间戳和三个日期:-
2022-01-08 12:51:23:986[Thread - http-nio-exec-4id] INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-9090"]
2022-01-08 12:52:56:986[Thread - http-nio-exec-8id] INFO Request SecurityContextHolderAwareRequestWrapper
2022-01-08 12:58:45:986[Thread - http-nio-exec-9id] INFO Beginning of the api method
2022-01-08 12:58:55:986[Thread - http-nio-exec-47id] ERROR Exception happened while loading请帮助我,在我需要改变设置和提供任何样本。
发布于 2022-05-07 08:18:40
你可以做下面的事情来达到这个目的。将以下一行添加到log4j.properties中。
java.util.logging.SimpleFormatter.format=%1$tF %1$tT [%4$-7s] %5$s %n否则,还可以将Tomcat日志记录更改为log4j。您可以参考这里。
https://stackoverflow.com/questions/71149388
复制相似问题