private File downloadToTempFolder ( final String applicationId ) throws URISyntaxException , StorageException , IOException { final File outputFolder = Files . createTempDirectory ( "reeflogs-" + applicationId ) . toFile ( ) ; if ( ! outputFolder . exists ( ) && ! outputFolder . mkdirs ( ) ) { LOG . log ( Level . WARNING , "Failed to create [{0}]" , outputFolder . getAbsolutePath ( ) ) ; } final CloudBlobDirectory logFolder = this . container . getDirectoryReference ( LOG_FOLDER_PREFIX + applicationId + "/" ) ; int fileCounter = 0 ; for ( final ListBlobItem blobItem : logFolder . listBlobs ( ) ) { if ( blobItem instanceof CloudBlob ) { try ( final OutputStream outputStream = new FileOutputStream ( new File ( outputFolder , "File-" + fileCounter ) ) ) { ( ( CloudBlob ) blobItem ) . download ( outputStream ) ; ++ fileCounter ; } } } LOG . log ( Level . FINE , "Downloaded logs to: {0}" , outputFolder . getAbsolutePath ( ) ) ; return outputFolder ; }
Downloads the logs to a local temp folder .