Log exception (with query info) into text log (not into system table).
| 470 | |
| 471 | /// Log exception (with query info) into text log (not into system table). |
| 472 | static void logException(ContextPtr context, QueryLogElement & elem) |
| 473 | { |
| 474 | String comment; |
| 475 | if (!elem.log_comment.empty()) |
| 476 | comment = fmt::format(" (comment: {})", elem.log_comment); |
| 477 | |
| 478 | if (elem.stack_trace.empty()) |
| 479 | LOG_ERROR( |
| 480 | &Poco::Logger::get("executeQuery"), |
| 481 | "{} (from {}){} (in query: {})", |
| 482 | elem.exception, |
| 483 | context->getClientInfo().current_address.toString(), |
| 484 | comment, |
| 485 | joinLines(elem.query)); |
| 486 | else |
| 487 | LOG_ERROR( |
| 488 | &Poco::Logger::get("executeQuery"), |
| 489 | "{} (from {}){} (in query: {})" |
| 490 | ", Stack trace (when copying this message, always include the lines below):\n\n{}", |
| 491 | elem.exception, |
| 492 | context->getClientInfo().current_address.toString(), |
| 493 | comment, |
| 494 | joinLines(elem.query), |
| 495 | elem.stack_trace); |
| 496 | } |
| 497 | |
| 498 | static LabelledMetrics::MetricLabels markQueryProfileEventLabels( |
| 499 | ContextMutablePtr context, |
no test coverage detected