Maven Mojo: Taking complete control over logging / Forbid other plugins to log

旧巷老猫 提交于 2020-01-15 10:53:32

问题


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.

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.

After my Mojo finishes, logging can, and should, return to normal.

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.

Thanks for your help!


回答1:


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.



来源:https://stackoverflow.com/questions/2779003/maven-mojo-taking-complete-control-over-logging-forbid-other-plugins-to-log

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!