Skip to content

Commit

Permalink
add liquibaseHostName MDC key (DAT-14956) (liquibase#4370)
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenMassaro authored Jul 6, 2023
1 parent fbe608c commit fc64f90
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,12 @@ public int execute(String[] args) {
*/
private void logMdcData() throws IOException {
MdcManager mdcManager = Scope.getCurrentScope().getMdcManager();
String localHostName = NetUtil.getLocalHostName();
try (MdcObject version = mdcManager.put(MdcKey.LIQUIBASE_VERSION, LiquibaseUtil.getBuildVersion());
MdcObject systemUser = mdcManager.put(MdcKey.LIQUIBASE_SYSTEM_USER, System.getProperty("user.name"));
MdcObject systemName = mdcManager.put(MdcKey.LIQUIBASE_SYSTEM_NAME, NetUtil.getLocalHostName())) {
MdcObject systemName = mdcManager.put(MdcKey.LIQUIBASE_SYSTEM_NAME, localHostName);
// The host name here is purposefully the same as the system name. The system name is retained for backwards compatibility.
MdcObject hostName = mdcManager.put(MdcKey.LIQUIBASE_HOST_NAME, localHostName)) {
Scope.getCurrentScope().getLog(getClass()).info("Starting command execution.");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ public class MdcKey {
public static final String DEPLOYMENT_OUTCOME = "deploymentOutcome";
public static final String LIQUIBASE_COMMAND_NAME = "liquibaseCommandName";
public static final String LIQUIBASE_VERSION = "liquibaseVersion";
/**
* Use the {@link MdcKey}#LIQUIBASE_HOST_NAME instead.
*/
@Deprecated
public static final String LIQUIBASE_SYSTEM_NAME = "liquibaseSystemName";
public static final String LIQUIBASE_HOST_NAME = "liquibaseHostName";
public static final String LIQUIBASE_SYSTEM_USER = "liquibaseSystemUser";
public static final String OUTPUT_FILE = "outputFile";
public static final String OUTPUT_FILE_ENCODING = "outputFileEncoding";
Expand Down

0 comments on commit fc64f90

Please sign in to comment.