diff --git a/filesystems/blob/src/main/scala/cromwell/filesystems/blob/BlobFileSystemManager.scala b/filesystems/blob/src/main/scala/cromwell/filesystems/blob/BlobFileSystemManager.scala index a3e6f33572a..3ebce4db878 100644 --- a/filesystems/blob/src/main/scala/cromwell/filesystems/blob/BlobFileSystemManager.scala +++ b/filesystems/blob/src/main/scala/cromwell/filesystems/blob/BlobFileSystemManager.scala @@ -17,6 +17,7 @@ import java.time.{Duration, Instant, OffsetDateTime} import scala.jdk.CollectionConverters._ import scala.util.{Failure, Success, Try} import com.azure.resourcemanager.storage.models.StorageAccountKey +import com.typesafe.scalalogging.LazyLogging case class FileSystemAPI() { def getFileSystem(uri: URI): Try[FileSystem] = Try(FileSystems.getFileSystem(uri)) @@ -44,7 +45,7 @@ case class BlobFileSystemManager( expiryBufferMinutes: Long, blobTokenGenerator: BlobTokenGenerator, fileSystemAPI: FileSystemAPI = FileSystemAPI(), - private val initialExpiration: Option[Instant] = None) { + private val initialExpiration: Option[Instant] = None) extends LazyLogging { private var expiry: Option[Instant] = initialExpiration val buffer: Duration = Duration.of(expiryBufferMinutes, ChronoUnit.MINUTES) @@ -57,10 +58,13 @@ case class BlobFileSystemManager( shouldReopenFilesystem match { case false => fileSystemAPI.getFileSystem(uri).recoverWith { // If no filesystem already exists, this will create a new connection, with the provided configs - case _: FileSystemNotFoundException => blobTokenGenerator.generateAccessToken.flatMap(generateFilesystem(uri, container, _)) + case _: FileSystemNotFoundException => + logger.info(s"Creating new blob filesystem for URI $uri") + blobTokenGenerator.generateAccessToken.flatMap(generateFilesystem(uri, container, _)) } // If the token has expired, OR there is no token record, try to close the FS and regenerate case true => + logger.info(s"Closing & regenerating token for existing blob filesystem at URI $uri") fileSystemAPI.closeFileSystem(uri) blobTokenGenerator.generateAccessToken.flatMap(generateFilesystem(uri, container, _)) }