Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output changeset execution to UI like rollback does #1932

Merged
merged 3 commits into from Jan 18, 2022

Conversation

sergeevik
Copy link
Contributor

@sergeevik sergeevik commented Jun 24, 2021

Environment

Liquibase Version: 4.4.0

Liquibase Integration & Version: CLI

Pull Request Type

  • Bug fix (non-breaking change which fixes an issue.)

Description

When use rollback command cli, i see in terminal this log:

Rollback to version R1.0
Liquibase Community 3.10.1 by Datical
Rolling Back Changeset:R1.0...
Rolling Back Changeset:R1.0...
Rolling Back Changeset:R1.0...
Rolling Back Changeset:R1.0...
Rolling Back Changeset:R1.0...
Liquibase: Rollback has been successful.

But when use update, i see only:

Liquibase Community 3.10.1 by Datical
Liquibase: Update has been successful.

PS.. use 4.4.0 version have same result:

Rollback to version R1.0
Liquibase Community 4.4.0 by Datical
####################################################
##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ##
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ##
##  Free schema change activity reports at        ##
##      https://hub.liquibase.com                 ##
##                                                ##
####################################################
Starting Liquibase at 19:47:49 (version 4.4.0 #11 built at 2021-06-09 16:36+0000)
Skipping auto-registration
Rolling Back Changeset:R1.0/...
Rolling Back Changeset:R1.0/...
Rolling Back Changeset:R1.0/...
Rolling Back Changeset:R1.0/...
Rolling Back Changeset:R1.0/...
Rolling Back Changeset:R1.0/...
Liquibase: Rollback has been successful.


Liquibase Community 4.4.0 by Datical
####################################################
##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ##
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ##
##  Free schema change activity reports at        ##
##      https://hub.liquibase.com                 ##
##                                                ##
####################################################
Starting Liquibase at 19:47:54 (version 4.4.0 #11 built at 2021-06-09 16:36+0000)
Skipping auto-registration
Liquibase: Update has been successful.In pr, i copy logic from ```liquibase.changelog.visitor.RollbackVisitor``` to ```liquibase.changelog.visitor.UpdateVisitor``` wich log info to ui.

With this change. log looks like:

Rollback to version R1.0
####################################################
##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ##
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ##
##  Free schema change activity reports at        ##
##      https://hub.liquibase.com                 ##
##                                                ##
####################################################
Starting Liquibase at 20:27:22 (version 4.4.0-local-SNAPSHOT #0 built at 2021-06-24 17:24+0000)
Skipping auto-registration
Rolling Back Changeset:R1.0/...
Rolling Back Changeset:R1.0/...
Liquibase: Rollback has been successful.    ####################################################
##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ##
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ##
##  Free schema change activity reports at        ##
##      https://hub.liquibase.com                 ##
##                                                ##
####################################################
Starting Liquibase at 20:27:27 (version 4.4.0-local-SNAPSHOT #0 built at 2021-06-24 17:24+0000)
Skipping auto-registration
Running Changeset:R1.0/...
Running Changeset:R1.0/...
Liquibase: Update has been successful.That may help to see progress in terminal. Without log, user may think that update hung

Fast Track PR Acceptance Checklist:

  • Build is successful and all new and existing tests pass

Dev Handoff Notes (Internal Use)

Links

Testing

  • Steps to Reproduce: See above
  • Guidance:
    • Impact: Calls through our UI service, so doesn't impact outputfile or logging

Dev Verification

Ran new code to see additional messages on update

@nvoxland nvoxland changed the base branch from master to 1_9 December 22, 2021 22:12
@nvoxland nvoxland changed the base branch from 1_9 to master December 22, 2021 22:12
@nvoxland nvoxland changed the title made the logging of visitors(update/rollback) the same Output changeset execution to UI like rollback does Dec 22, 2021
@nvoxland
Copy link
Contributor

Thanks for the PR!

I added a missing space after the : on both the existing rollback and the new update message and updated the branch with the current master code.

@nvoxland nvoxland moved this from To Do to Code Review in Conditioning++ Dec 22, 2021
@suryaaki2 suryaaki2 moved this from Code Review to Ready for Handoff (In JIRA) in Conditioning++ Dec 28, 2021
@suryaaki2 suryaaki2 merged commit f7571ab into liquibase:master Jan 18, 2022
Conditioning++ automation moved this from Ready for Handoff (In JIRA) to Done Jan 18, 2022
@sergeevik sergeevik deleted the update_log_to_ui branch January 19, 2022 00:57
@nvoxland nvoxland removed this from Done in Conditioning++ Jan 21, 2022
@nvoxland nvoxland added this to the v4.7.1 milestone Jan 21, 2022
@@ -40,8 +43,12 @@ public Direction getDirection() {
@Override
public void visit(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database,
Set<ChangeSetFilterResult> filterResults) throws LiquibaseException {
Executor executor = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", database);
if (! (executor instanceof LoggingExecutor)) {
Scope.getCurrentScope().getUI().sendMessage("Running Changeset: " + changeSet);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this logs directly to stdout or it should respect logging levels? On what level it logs then? I have logging.level.liquibase: WARN (in Spring Boot's application.properties) and after update I see all these messages in console as-is, without date/level/class/etc. For example:

2022-01-22 15:02:34.380 [user:  ]  INFO 18949 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
Running Changeset: liquibase/initial-state.xml::create-users_activation-table::php-coder
Running Changeset: liquibase/initial-state.xml::create-users_table::php-coder
Running Changeset: liquibase/initial-state.xml::create-countries-table::php-coder
...

Copy link

@php-coder php-coder Jan 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be related to my dated Spring Boot version, so I'm not fully sure whether it's a bug in Liquibase..

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional observation: these messages appears also when I run unit tests that use H2 :-/

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree on this one. We have a few hundreds of change logs and thousands of tests. Imagine how messy build logs are now.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants