Skip to content

Log Service & Vault Information Service

Logging is an essential part of any application, and the LogService interface provides methods to send messages to the Debug Log and Runtime Log, which are available in the Vault UI from Admin > Logs > Developer Logs.

When logging, you may need to retrieve basic configuration information about your Vault. The VaultInformation interface provides methods to retrieve the following information about the local Vault:

  • Name: Returns the name of the Vault.
  • ID: The ID of the Vault.
  • Language: Returns the admin_key__sys value. For example, en for English.
  • Locale: Returns the admin_key__sys value. For example, en_GB for United Kingdom.
  • Timezone: Returns a value from the timezone__sys picklist. For example, europe_london__sys.
  • DNS: Returns the DNS of the Vault.

The VaultInformationService interface provides methods to retrieve the VaultInformation for remote and local Vaults.

The following example creates a new instance of VaultInformationService and uses the getLocalVautInformation() method to retrieve the local Vault's information. Next, the example uses LogService to log the dns, id, name, language, locale, and timezone values in the Debug Log.

LogService logService = ServiceLocator.locate(LogService.class); VaultInformationService vaultInformationService = ServiceLocator.locate(VaultInformationService.class); VaultInformation vaultInformation = vaultInformationService.getLocalVaultInformation(); logService.debug("dns = {}", vaultInformation.getDNS()); logService.debug("id = {}", vaultInformation.getID()); logService.debug("name = {}", vaultInformation.getName()); logService.debug("language = {}", vaultInformation.getLanguageCode()); logService.debug("locale = {}", vaultInformation.getLocaleCode()); logService.debug("timezone = {}", vaultInformation.getTimezoneName());