Skip to content

Commit 534ac0a

Browse files
committed
Fall back to stderr if the log path contains colons
Signed-off-by: Bob Weinand <[email protected]>
1 parent c73b7f7 commit 534ac0a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Diff for: components-rs/sidecar.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,16 @@ pub extern "C" fn ddog_sidecar_connect_php(
120120
cfg.log_method = LogMethod::File(str.into());
121121
}
122122
#[cfg(not(windows))]
123-
{ cfg.log_method = LogMethod::File(OsStr::from_bytes(error_path).into()); }
123+
{
124+
// Paths containing a colon generally are some magic - just log to stderr directly
125+
// E.g. "/var/www/html/host:[3]" on a serverless platform
126+
// In general, stdio is the only way for having magic paths here.
127+
if error_path.contains(&b':') {
128+
cfg.log_method = LogMethod::Stderr;
129+
} else {
130+
cfg.log_method = LogMethod::File(OsStr::from_bytes(error_path).into());
131+
}
132+
}
124133
}
125134
#[cfg(windows)]
126135
let log_level = log_level.to_utf8_lossy().as_ref().into();

0 commit comments

Comments
 (0)