[pbs-devel] [PATCH proxmox-backup] log: adjust log level on sync job messages

Gabriel Goller g.goller at proxmox.com
Tue Nov 26 16:55:00 CET 2024


Some messages printed on a sync push job should have been logged in the
syslog as well. These are clearly errors, so they should also be printed
accordingly.

Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---
 src/server/pull.rs |  4 ++--
 src/server/push.rs | 28 ++++++++++++++--------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/server/pull.rs b/src/server/pull.rs
index 9abb673aea00..8afeec46350a 100644
--- a/src/server/pull.rs
+++ b/src/server/pull.rs
@@ -8,7 +8,7 @@ use std::time::SystemTime;
 
 use anyhow::{bail, format_err, Error};
 use proxmox_human_byte::HumanByte;
-use tracing::info;
+use tracing::{info, error};
 
 use pbs_api_types::{
     print_store_and_ns, ArchiveType, Authid, BackupArchiveName, BackupDir, BackupGroup,
@@ -837,7 +837,7 @@ pub(crate) async fn pull_store(mut params: PullParameters) -> Result<SyncStats,
             }
             Err(err) => {
                 errors = true;
-                info!(
+                error!(
                     "Encountered errors while syncing namespace {} - {err}",
                     &namespace,
                 );
diff --git a/src/server/push.rs b/src/server/push.rs
index 99757a3cc355..dcb238c06190 100644
--- a/src/server/push.rs
+++ b/src/server/push.rs
@@ -7,7 +7,7 @@ use anyhow::{bail, Context, Error};
 use futures::stream::{self, StreamExt, TryStreamExt};
 use tokio::sync::mpsc;
 use tokio_stream::wrappers::ReceiverStream;
-use tracing::{info, warn};
+use tracing::{info, warn, error};
 
 use pbs_api_types::{
     print_store_and_ns, ApiVersion, ApiVersionInfo, ArchiveType, Authid, BackupArchiveName,
@@ -429,8 +429,8 @@ pub(crate) async fn push_store(mut params: PushParameters) -> Result<SyncStats,
             }
             Err(err) => {
                 errors = true;
-                info!("Encountered errors: {err:#}");
-                info!("Failed to sync {source_store_and_ns} into {target_store_and_ns}!");
+                error!("Encountered errors: {err:#}");
+                error!("Failed to sync {source_store_and_ns} into {target_store_and_ns}!");
             }
         }
     }
@@ -478,8 +478,8 @@ pub(crate) async fn push_store(mut params: PushParameters) -> Result<SyncStats,
                     }
                 }
                 Err(err) => {
-                    warn!("Encountered errors: {err:#}");
-                    warn!("Failed to remove vanished namespace {target_namespace} from remote!");
+                    error!("Encountered errors: {err:#}");
+                    error!("Failed to remove vanished namespace {target_namespace} from remote!");
                     continue;
                 }
             }
@@ -554,8 +554,8 @@ pub(crate) async fn push_namespace(
         match push_group(params, namespace, &group, &mut progress).await {
             Ok(sync_stats) => stats.add(sync_stats),
             Err(err) => {
-                warn!("Encountered errors: {err:#}");
-                warn!("Failed to push group {group} to remote!");
+                error!("Encountered errors: {err:#}");
+                error!("Failed to push group {group} to remote!");
                 errors = true;
             }
         }
@@ -587,8 +587,8 @@ pub(crate) async fn push_namespace(
                     }));
                 }
                 Err(err) => {
-                    warn!("Encountered errors: {err:#}");
-                    warn!("Failed to remove vanished group {target_group} from remote!");
+                    error!("Encountered errors: {err:#}");
+                    error!("Failed to remove vanished group {target_group} from remote!");
                     errors = true;
                     continue;
                 }
@@ -748,8 +748,8 @@ pub(crate) async fn push_group(
                     );
                 }
                 Err(err) => {
-                    warn!("Encountered errors: {err:#}");
-                    warn!(
+                    error!("Encountered errors: {err:#}");
+                    error!(
                         "Failed to remove vanished snapshot {name} from remote!",
                         name = snapshot.backup
                     );
@@ -793,8 +793,8 @@ pub(crate) async fn push_snapshot(
         Ok((manifest, _raw_size)) => manifest,
         Err(err) => {
             // No manifest in snapshot or failed to read, warn and skip
-            log::warn!("Encountered errors: {err:#}");
-            log::warn!("Failed to load manifest for '{snapshot}'!");
+            error!("Encountered errors: {err:#}");
+            error!("Failed to load manifest for '{snapshot}'!");
             return Ok(stats);
         }
     };
@@ -816,7 +816,7 @@ pub(crate) async fn push_snapshot(
     if fetch_previous_manifest {
         match backup_writer.download_previous_manifest().await {
             Ok(manifest) => previous_manifest = Some(Arc::new(manifest)),
-            Err(err) => log::info!("Could not download previous manifest - {err}"),
+            Err(err) => info!("Could not download previous manifest - {err}"),
         }
     };
 
-- 
2.39.5





More information about the pbs-devel mailing list