Added whitelist for CLI log channels to include #2859
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Impact
Marked as a breaking change because 3rd party (non-liquibase) logging will no longer be logged without also specifying the --log-channels flag.
Description
While we can't control the log configuration in most environments liquibase runs in, we do control the log setup in the CLI.
Liquibase does not log any sensitive information, but we have no control over what other libraries will log and want to make sure nothing unexpected gets logged in user environments.
Therefore, when applying the "logLevel" setting in the CLI, we are switching to a whitelisting of channels to include. The whitelist defaults to only "liquibase", but it can be controlled via a new
liquibase.logChannel
setting. For example,--log-channels=liquibase,com.microsoft.sqlserver.jdbc
. We also support--log-channels=all
This replaces the previous reflection-based blacklisting of
net.sun.www.protocol.http.HttpURLConnection
which caused a warning in Java 11 and an ignored error in 17Things to be aware of
Things to worry about
Additional Context
I was not able to control the log level of
net.sun.www.protocol.http.HttpURLConnection
with the setting. I thing their use of the internal PlatformLogger is getting in the way. If anyone ever needs that, we can look at options for that. I was able to see it work withorg.mariadb
after adding?log=true
to the mariadb urlTesting
Setup: Configure liquibase to point to a mssql database
liquibase update
with no logLevel should print no logsliquibase --log-level=FINE update
should log only messages with[liquibase ...]
as the channel. No[com.microsoft...]
channelsliquibase --log-level=FINE --log-channels=liquibase,com.microsoft update
should log messages with both the liquibase and com.microsoft channels