Maven Mojo:完全控制日志记录/禁止其他插件进行日志记录 [英] Maven Mojo: Taking complete control over logging / Forbid other plugins to log
问题描述
我不知道这是否实际上可行,但是我可以完全控制Maven Mojo内部的日志记录吗?使用 complete 控件,我的意思是仅记录来自Mojo的消息,或者我可以决定是否记录给定消息.
I don't know if this is actually possible, but can I take complete control over logging from inside a Maven Mojo? With complete control I mean that only messages from my Mojo are logged or that I can decide wether a given message shall be logged.
上下文是我在插件中使用maven-scm-plugin
来执行一些SCM操作,并且使用
flood 日志
The context is that I'm using the maven-scm-plugin
in my plugin to do some SCM action and it floods the log with
[INFO] Executing: cmd.exe /X /C "svn --non-interactive update D:\..."
[INFO] Working directory: D:\...
我自己的消息迷路了并且很难注意到.
while my own messages get lost and are hard to notice.
我的Mojo完成后,日志记录可以而且应该恢复正常.
After my Mojo finishes, logging can, and should, return to normal.
我试图使用setLog( Log )
注入自己的记录器,但是那样我只能掌握自己的消息.我用来访问maven-scm-plugin
的ScmManager
实例似乎也没有合适的方法.
I tried to use setLog( Log )
to inject an own logger but that way I only get hold of my own messages. The instance of ScmManager
I use to access maven-scm-plugin
doesn't seem to have an appropiate method as well.
感谢您的帮助!
推荐答案
除了您自己的插件外,您无法真正控制其他插件的日志输出级别(仅通过-X).仅当您更改其他插件的代码时.
You can't really control the level of log output of an other plugin than your own (only via -X). Only if you change the code of the other plugins.
这篇关于Maven Mojo:完全控制日志记录/禁止其他插件进行日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!