log4j:如何获得最后插入的日志信息?[英] log4j: how to get the last inserted log message?

本文是小编为大家收集整理的关于log4j:如何获得最后插入的日志信息?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我想知道是否有办法将最后一个插入的日志检索到我的log4j日志文件中? 另外,我需要在Spock上进行单位测试时进行运行.

谢谢!

推荐答案

您可以随时在日志消息中写下自己的appender:

本文地址:https://www.itbaoku.cn/post/1575115.html

问题描述

I wonder if there is way to retrieve the last inserted log to my log4j log file ? Also, I need it to be run while unit-testing on Spock.

Thanks!

推荐答案

You can always write your own appender where log messages go through:

Get live Log4J messages