Skip to content

Commit aca2fe4

Browse files
authored
chore(query): keep queries detail and profile log format (#16822)
1 parent 5e2095c commit aca2fe4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/common/tracing/src/init.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ pub fn init_logging(
270270
EnvFilterBuilder::new()
271271
.filter(Some("databend::log::query"), LevelFilter::Trace),
272272
))
273-
.append(query_log_file);
273+
.append(query_log_file.with_layout(get_layout("identical")));
274274
logger = logger.dispatch(dispatch);
275275
}
276276
if let Some(endpoint) = &cfg.query.otlp {
@@ -312,7 +312,7 @@ pub fn init_logging(
312312
EnvFilterBuilder::new()
313313
.filter(Some("databend::log::profile"), LevelFilter::Trace),
314314
))
315-
.append(profile_log_file);
315+
.append(profile_log_file.with_layout(get_layout("identical")));
316316
logger = logger.dispatch(dispatch);
317317
}
318318
if let Some(endpoint) = &cfg.profile.otlp {

src/common/tracing/src/loggers.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,15 @@ pub fn get_layout(format: &str) -> Layout {
4949
match format {
5050
"text" => text_layout(),
5151
"json" => json_layout(),
52+
"identical" => identical_layout(),
5253
_ => unimplemented!("file logging format {format} is not supported"),
5354
}
5455
}
5556

57+
fn identical_layout() -> Layout {
58+
CustomLayout::new(|record: &Record| Ok(format!("{}\n", record.args()).into_bytes())).into()
59+
}
60+
5661
fn text_layout() -> Layout {
5762
CustomLayout::new(|record: &Record| {
5863
let s = match ThreadTracker::query_id() {

0 commit comments

Comments
 (0)