Improve usage of silent parameter in Copy and Unpack goals#1517
Improve usage of silent parameter in Copy and Unpack goals#1517slawekjaranowski wants to merge 1 commit intoapache:masterfrom
Conversation
slawekjaranowski
commented
Sep 13, 2025
- parameter should be defined where is used, so move to child class from root class AbstractDependencyMojo
- use it during logging of coping or unpacking
| * | ||
| * @param sourceArtifact the artifact (file) to copy | ||
| * @param destination file name of destination file | ||
| * @param silent if true, use debug log level, otherwise info for logging |
There was a problem hiding this comment.
This feels wrong. Logging should be controlled by log levels, not Maven parameters
| * @since 3.2.0 | ||
| */ | ||
| public void copyFile(File source, File destination) throws IOException { | ||
| logger.debug("Copying file '{}' to {}", source, destination); |
There was a problem hiding this comment.
I really can't see why this should be anything other than debug by default. This is not an actionable message.
There was a problem hiding this comment.
eg. When using copy mojo from cli I need an information what was copied for auditing
| logger.debug("Copying file '{}' to {}", source, destination); | ||
| public void copyFile(File source, File destination, boolean silent) throws IOException { | ||
| if (!silent) { | ||
| logger.info("Copying file '{}' to {}", source, destination); |
There was a problem hiding this comment.
and now if the user turns on debugging but this is silent they don't see this
| * Use {@code -q} command line option if you want to suppress all output. | ||
| * @since 2.0 | ||
| */ | ||
| @Parameter(property = "silent", defaultValue = "false") |
There was a problem hiding this comment.
This should still be deprecated as it was where it was moved from
|
@elharo @michael-o I know that you worked on silent parameter, and proposed to deprecate it. It is directly used only in a few places so I propose move it to place where is used. I alos remove overvriting logger in Mojo at all - it should be done by I would like to have possibility to log what is copied, unpacked - form some of auditing perspective. |
|
related: #447 |
|
I do not want a large set of switches for every imaginable combination of logging this and that but not some other thing. The default is not to log things users don;t need to know and aren't going to act on the vast majority of the time. If you need more than that, turn on the debug logs. Yes, it's verbose but so is logging every file that's copied. |
so I moved it where is used ... we have small number of switches
In this case I think it is useful information what happens
Similar we can say, if you don't want logs use -q options |
d35f602 to
cd9084a
Compare
- parameter should be defined where is used, so move to child class from root class AbstractDependencyMojo - use it during logging of coping or unpacking
3fd0746 to
cdc8f20
Compare
|
@elharo changing log to system-out make be a problematic in Maven4 I don't understood why we can not use silent option where is needed .. eg is used in how do you want to replace such code: Do we want to move every message into debug level? |
|
Yes, exactly. Silent is debug, We don't need anything else. Our logs are vastly too noisy with severe consequences for usability. |