diff --git a/artifactory/commands/transferfiles/delayedartifactshandler.go b/artifactory/commands/transferfiles/delayedartifactshandler.go index adab43f5c..11af1d3cb 100644 --- a/artifactory/commands/transferfiles/delayedartifactshandler.go +++ b/artifactory/commands/transferfiles/delayedartifactshandler.go @@ -161,6 +161,7 @@ func handleDelayedArtifactsFiles(filesToConsume []string, base phaseBase, delayU } func consumeDelayedArtifactsFiles(pcWrapper *producerConsumerWrapper, filesToConsume []string, uploadChunkChan chan UploadedChunk, base phaseBase, delayHelper delayUploadHelper, errorsChannelMng *ErrorsChannelMng) error { + log.Debug(fmt.Sprintf("Starting to handle delayed artifacts files. Found %d files.", len(filesToConsume))) for _, filePath := range filesToConsume { log.Debug("Handling delayed artifacts file: '" + filePath + "'") delayedArtifactsFile, err := readDelayFile(filePath) diff --git a/artifactory/commands/transferfiles/errorshandler.go b/artifactory/commands/transferfiles/errorshandler.go index f67079039..db9a8cb3e 100644 --- a/artifactory/commands/transferfiles/errorshandler.go +++ b/artifactory/commands/transferfiles/errorshandler.go @@ -11,6 +11,7 @@ import ( "github.com/jfrog/jfrog-client-go/utils/io/fileutils" "github.com/jfrog/jfrog-client-go/utils/log" "os" + "path" "time" ) @@ -189,7 +190,7 @@ func (mng *TransferErrorsMng) writeErrorContent(e ExtendedFileUploadStatusRespon } func (mng *TransferErrorsMng) writeSkippedErrorContent(e ExtendedFileUploadStatusResponse) error { - log.Debug(fmt.Sprintf("Writing '%s' to file %s", e.Reason, mng.errorWriterMng.skipped.filePath)) + logWritingArtifact(e, mng.errorWriterMng.skipped.filePath) mng.errorWriterMng.skipped.writer.Write(e) mng.errorWriterMng.skipped.errorCount++ // If file contains maximum number of errors - create and write to a new errors file @@ -213,7 +214,7 @@ func (mng *TransferErrorsMng) writeSkippedErrorContent(e ExtendedFileUploadStatu } func (mng *TransferErrorsMng) writeRetryableErrorContent(e ExtendedFileUploadStatusResponse) error { - log.Debug(fmt.Sprintf("Writing '%s' to file %s", e.Reason, mng.errorWriterMng.retryable.filePath)) + logWritingArtifact(e, mng.errorWriterMng.retryable.filePath) mng.errorWriterMng.retryable.writer.Write(e) mng.errorWriterMng.retryable.errorCount++ // If file contains maximum number of errors - create and write to a new errors file @@ -236,6 +237,17 @@ func (mng *TransferErrorsMng) writeRetryableErrorContent(e ExtendedFileUploadSta return nil } +func logWritingArtifact(e ExtendedFileUploadStatusResponse, errorsFilePath string) { + if log.GetLogger().GetLogLevel() != log.DEBUG { + return + } + msg := fmt.Sprintf("Writing artifact '%s' to errors file '%s'.", path.Join(e.Repo, e.Path, e.Name), errorsFilePath) + if e.Reason != "" { + msg += fmt.Sprintf(" Reason: '%s'.", e.Reason) + } + log.Debug(msg) +} + func (writerMng *errorWriter) closeWriter() error { // Close content writer and move output file to our working directory if writerMng.writer == nil { diff --git a/artifactory/commands/transferfiles/manager.go b/artifactory/commands/transferfiles/manager.go index 2b825f88b..e9904b592 100644 --- a/artifactory/commands/transferfiles/manager.go +++ b/artifactory/commands/transferfiles/manager.go @@ -228,6 +228,8 @@ func runProducerConsumers(pcWrapper *producerConsumerWrapper) (executionErr erro go func() { // Wait till notified that the builder has no additional tasks, and close the builder producer consumer. <-pcWrapper.chunkBuilderProducerConsumer.GetFinishedNotification() + log.Debug("Chunk builder producer consumer has completed all tasks. " + + "All files relevant to this phase were found and added to chunks that are being uploaded...") pcWrapper.chunkBuilderProducerConsumer.Done() }() @@ -261,6 +263,7 @@ func pollUploads(phaseBase *phaseBase, srcUpService *srcUserPluginService, uploa } for i := 0; ; i++ { if ShouldStop(phaseBase, nil, errorsChannelMng) { + log.Debug("Stop signal received while polling on uploads...") return } time.Sleep(waitTimeBetweenChunkStatusSeconds * time.Second) @@ -284,6 +287,7 @@ func pollUploads(phaseBase *phaseBase, srcUpService *srcUserPluginService, uploa // it will be written to the error channel if chunksLifeCycleManager.totalChunks == 0 { if shouldStopPolling(doneChan) { + log.Debug("Stopping to poll on uploads...") return } continue @@ -386,6 +390,7 @@ func handleChunksStatuses(phase *phaseBase, chunksStatus *api.UploadChunksStatus stopped := handleFilesOfCompletedChunk(chunk.Files, errorsChannelMng) // In case an error occurred while writing errors status's to the errors file - stop transferring. if stopped { + log.Debug("Stop signal received while handling chunks statuses...") return true } err = setChunkCompletedInRepoSnapshot(phase.stateManager, chunk.Files)