kordamp / oci-maven-plugin

OCI Java SDK Maven Plugin
Apache License 2.0
5 stars 0 forks source link

Clean up warnings for download-object goal #7

Closed robertpatrick closed 2 years ago

robertpatrick commented 2 years ago

When using the latest download-object goal, my build output shows several warnings that are meaningless to me and seem to indicate possible issues with the mojo itself.

If the user doesn't need to know (e.g., since there is no action that they can take to rectify the warning), they should either be suppressed or written at a lower log level.

[INFO] --- oci-maven-plugin:0.5.1:download-object (download-generated-offline-file) @ weblogic-deploy-alias-test-verify ---
[INFO] Refreshing client 'null'.
[INFO] Setting connector provider to ApacheConnectorProvider
[INFO] Refreshed client 'class com.oracle.bmc.http.internal.RestClient'.
[INFO] Setting endpoint to https://objectstorage.us-phoenix-1.oraclecloud.com
[WARNING] getObject returns a stream, please make sure to close the stream to avoid any indefinite hangs
[WARNING] ApacheConnectionClosingStrategy set to org.glassfish.jersey.apache.connector.ApacheConnectionClosingStrategy$ImmediateClosingStrategy@1e734eee. For large streams with partial reads of stream, please use ImmediateClosingStrategy. For small streams with partial reads of stream, please use GracefulClosingStrategy. More info in ApacheConnectorProperties
[WARNING] Wrapping response stream into auto closeable stream, to disable this, please use com.oracle.bmc.Options.shouldAutoCloseResponseInputStream(false)
generatedOffline-12.2.1.4.0.210930.json:
    ETag: 2131534a-d1e1-4eab-9289-e855b2db62b8
    Modified: true
    Last Modified: Mon Oct 24 13:31:17 CDT 2022
    Content Length: 4527620
    Content Type: application/octet-stream
    Content MD5: Rex2U6OrddpljJhIBNK+QA==
Downloading to /Users/rpatrick/Projects/weblogic-deploy-tooling/integration-tests/alias-test/verify/target/generatedOffline-12.2.1.4.0.210930.json
[INFO] 
aalmiray commented 2 years ago

Mojos provided by this plugin do not alter log settings, hence these warnings are logged directly by the oci-java-sdk operations. See for reference https://github.com/kordamp/oci-maven-plugin/blob/643bcf361bd31ede708a2813dd5d54962643041d/oci-maven-plugin/src/main/groovy/org/kordamp/maven/plugin/oci/mojos/object/DownloadObjectMojo.groovy#L57-L80

What could be done in the meantime is update your project settings so that logging for oci-java-sdk calls are filtered, using regular Maven means and Slf4j.

robertpatrick commented 2 years ago

hmm...ok. I wonder why the SDK feels like these warrant log warnings...seems broken to me.

robertpatrick commented 2 years ago

@aalmiray Apparently, the extra warnings can be disabled with a Java System Property. I feel like the plugin should disable these by default since the plugin user cannot really do anything with these warnings since they are not using the Java SDK directly. WDYT?

https://github.com/oracle/oci-java-sdk/blob/master/ApacheConnector-README.md#disabling-extra-logs-related-to-streams

aalmiray commented 2 years ago

Agreed. Likely guardes by a boolean flag in case a user would like to see the hidden warnings.

robertpatrick commented 2 years ago

@aalmiray The other option would be to show the warnings only when running a build in debug mode (i.e., mvn -X)

aalmiray commented 2 years ago

Maven's debug mode is way too verbose for that. We can think of plugin verbosity vs. build verbosity.

Handling the system prop with a flag gives us the former, which could be forced to true if -X is given even if the flag was explicitly set to false.

Handling it just with -X gives us the latter option.