Skip to content

Commit

Permalink
chore(query): keep queries detail and profile log format (#16822)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhang2014 authored Nov 12, 2024
1 parent 5e2095c commit aca2fe4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/tracing/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ pub fn init_logging(
EnvFilterBuilder::new()
.filter(Some("databend::log::query"), LevelFilter::Trace),
))
.append(query_log_file);
.append(query_log_file.with_layout(get_layout("identical")));
logger = logger.dispatch(dispatch);
}
if let Some(endpoint) = &cfg.query.otlp {
Expand Down Expand Up @@ -312,7 +312,7 @@ pub fn init_logging(
EnvFilterBuilder::new()
.filter(Some("databend::log::profile"), LevelFilter::Trace),
))
.append(profile_log_file);
.append(profile_log_file.with_layout(get_layout("identical")));
logger = logger.dispatch(dispatch);
}
if let Some(endpoint) = &cfg.profile.otlp {
Expand Down
5 changes: 5 additions & 0 deletions src/common/tracing/src/loggers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@ pub fn get_layout(format: &str) -> Layout {
match format {
"text" => text_layout(),
"json" => json_layout(),
"identical" => identical_layout(),
_ => unimplemented!("file logging format {format} is not supported"),
}
}

fn identical_layout() -> Layout {
CustomLayout::new(|record: &Record| Ok(format!("{}\n", record.args()).into_bytes())).into()
}

fn text_layout() -> Layout {
CustomLayout::new(|record: &Record| {
let s = match ThreadTracker::query_id() {
Expand Down

0 comments on commit aca2fe4

Please sign in to comment.