Skip to content

Commit

Permalink
Use O_APPEND for logs and log version number (#588)
Browse files Browse the repository at this point in the history
In background mode we have two processes both racing on the log file,
and they can scribble each other's log entries (I saw this in #566).
O_APPEND should fix that. We should also log the version number as a
point of reference.

Signed-off-by: James Bornholt <[email protected]>
  • Loading branch information
jamesbornholt authored Oct 31, 2023
1 parent 8e5688d commit 301ee16
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mountpoint-s3/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn init_tracing_subscriber(config: LoggingConfig) -> anyhow::Result<()> {
let mut dir_builder = DirBuilder::new();
dir_builder.recursive(true).mode(0o750);
let mut file_options = OpenOptions::new();
file_options.mode(0o640).write(true).create(true);
file_options.mode(0o640).append(true).create(true);

dir_builder.create(path).context("failed to create log folder")?;
let file = file_options
Expand Down
2 changes: 2 additions & 0 deletions mountpoint-s3/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ fn main() -> anyhow::Result<()> {
fn mount(args: CliArgs) -> anyhow::Result<FuseSession> {
const DEFAULT_TARGET_THROUGHPUT: f64 = 10.0;

tracing::info!("mount-s3 {}", build_info::FULL_VERSION);

validate_mount_point(&args.mount_point)?;

let bucket_description = args.bucket_description();
Expand Down

0 comments on commit 301ee16

Please sign in to comment.