39#if defined(MYSQL_DYNAMIC_PLUGIN)
47#if defined(MYSQL_SERVER) && !defined(MYSQL_DYNAMIC_PLUGIN)
609 (const
char *name_or_ext,
void **my_errstream));
669 (const
char *
file,
void **my_errstream));
694 (const
char *a, const
char *b,
size_t len,
695 bool case_insensitive));
710 (
char *to,
size_t n, const
char *fmt, va_list ap))
711MY_ATTRIBUTE((format(printf, 3, 0)));
715MY_ATTRIBUTE((format(printf, 3, 4)));
725 (
void *thd, uint severity, uint code,
char *to,
size_t n,
726 const
char *format, ...))
727MY_ATTRIBUTE((format(printf, 6, 7)));
735 (const
char *
name,
int option,
int facility));
748#define log_line_init log_bi->line_init
749#define log_line_exit log_bi->line_exit
750#define log_line_item_set_with_key log_bi->line_item_set_with_key
751#define log_line_item_set log_bi->line_item_set
752#define log_line_item_types_seen log_bi->line_item_types_seen
753#define log_line_submit log_bi->line_submit
754#define log_set_int log_bi->item_set_int
755#define log_set_float log_bi->item_set_float
756#define log_set_lexstring log_bi->item_set_lexstring
757#define log_set_cstring log_bi->item_set_cstring
758#define log_malloc log_bs->malloc
759#define log_free log_bs->free
760#define log_msg log_bs->substitutev
761#define error_msg_by_errcode log_bi->errmsg_by_errcode
762#define error_code_by_errsymbol log_bi->errcode_by_errsymbol
767#define log_malloc(s) my_malloc(0, (s), MYF(0))
768#define log_free my_free
769#define log_msg vsnprintf
770#define error_msg_by_errcode error_message_for_error_log
771#define error_code_by_errsymbol mysql_symbol_to_errno
772#define log_set_int log_item_set_int
773#define log_set_float log_item_set_float
774#define log_set_lexstring log_item_set_lexstring
775#define log_set_cstring log_item_set_cstring
779#ifndef DISABLE_ERROR_LOGGING
781#if defined(LOG_COMPONENT_TAG)
783#define LogErr(severity, ecode, ...) \
787 .subsys(LOG_SUBSYSTEM_TAG) \
788 .component(LOG_COMPONENT_TAG) \
789 .source_line(__LINE__) \
790 .source_file(MY_BASENAME) \
791 .function(__FUNCTION__) \
792 .lookup(ecode, ##__VA_ARGS__)
794#define LogComponentErr(severity, ecode, ...) \
798 .subsys(LOG_SUBSYSTEM_TAG) \
799 .component("component:" LOG_COMPONENT_TAG) \
800 .source_line(__LINE__) \
801 .source_file(MY_BASENAME) \
802 .function(__FUNCTION__) \
803 .lookup_quoted(ecode, "Component " LOG_COMPONENT_TAG " reported", \
806#define LogPluginErr(severity, ecode, ...) \
810 .subsys(LOG_SUBSYSTEM_TAG) \
811 .component("plugin:" LOG_COMPONENT_TAG) \
812 .source_line(__LINE__) \
813 .source_file(MY_BASENAME) \
814 .function(__FUNCTION__) \
815 .lookup_quoted(ecode, "Plugin " LOG_COMPONENT_TAG " reported", \
818#define LogPluginErrV(severity, ecode, vl) \
822 .subsys(LOG_SUBSYSTEM_TAG) \
823 .component("plugin:" LOG_COMPONENT_TAG) \
824 .source_line(__LINE__) \
825 .source_file(MY_BASENAME) \
826 .function(__FUNCTION__) \
827 .lookup_quotedv(ecode, "Plugin " LOG_COMPONENT_TAG " reported", vl)
829#define LogPluginErrMsg(severity, ecode, ...) \
833 .subsys(LOG_SUBSYSTEM_TAG) \
834 .component("plugin:" LOG_COMPONENT_TAG) \
835 .source_line(__LINE__) \
836 .source_file(MY_BASENAME) \
837 .function(__FUNCTION__) \
838 .message_quoted("Plugin " LOG_COMPONENT_TAG " reported", ##__VA_ARGS__)
842#define LogErr(severity, ecode, ...) \
846 .subsys(LOG_SUBSYSTEM_TAG) \
847 .source_line(__LINE__) \
848 .source_file(MY_BASENAME) \
849 .function(__FUNCTION__) \
850 .lookup(ecode, ##__VA_ARGS__)
856inline void dummy_log_message(
longlong severity [[maybe_unused]],
857 longlong ecode [[maybe_unused]], ...) {
861#define LogErr(severity, ecode, ...) \
862 dummy_log_message(severity, ecode, ##__VA_ARGS__)
864#define LogPluginErr(severity, ecode, ...) \
865 dummy_log_message(severity, ecode, ##__VA_ARGS__)
866#define LogPluginErrV(severity, ecode, ...) \
867 dummy_log_message(severity, ecode, ##__VA_ARGS__)
868#define LogPluginErrMsg(severity, ecode, ...) \
869 dummy_log_message(severity, ecode, ##__VA_ARGS__)
896 if (
ll ==
nullptr)
return true;
912 MY_ATTRIBUTE((format(printf, 2, 0)));
1333 MY_ATTRIBUTE((format(printf, 2, 0))) {
1353 LogEvent &
message(
const char *fmt, ...) MY_ATTRIBUTE((format(printf, 2, 3)));
1367 MY_ATTRIBUTE((format(printf, 3, 4))) {
1371 va_start(args, fmt);
1419 va_start(args, tag);
1500 if ((fmt ==
nullptr) || (*fmt ==
'\0')) fmt =
"invalid error code";
1507 if ((
ll !=
nullptr) && (
msg !=
nullptr)) {
1515 const char ellipsis[] =
" <...>";
1529 va_start(args, fmt);
1537#if defined(MYSQL_DYNAMIC_PLUGIN)
1546inline void deinit_logging_service_for_plugin(
1552 (*reg_srv)->release(
1556 const_cast<log_builtins_string_t *
>(*
log_bs)));
1573inline bool init_logging_service_for_plugin(
1579 if (!(*reg_srv)->acquire(
"log_builtins.mysql_server", &log_srv) &&
1580 !(*reg_srv)->acquire(
"log_builtins_string.mysql_server", &log_str_srv)) {
1581 (*log_bi) =
reinterpret_cast<SERVICE_TYPE(log_builtins) *
>(log_srv);
1583 reinterpret_cast<SERVICE_TYPE(log_builtins_string) *
>(log_str_srv);
1591#elif defined(EXTRA_CODE_FOR_UNIT_TESTING)
1603inline bool init_logging_service_for_plugin(
1619inline void deinit_logging_service_for_plugin(
Modular logger: fluid API.
Definition: log_builtins.h:880
~LogEvent()
Destructor automatically sends the event on.
Definition: log_builtins.h:930
LogEvent & host(const char *val)
Whose session did the issue appear in?
Definition: log_builtins.h:1213
LogEvent & user(const char *val)
What user were we working for at the time of the issue?
Definition: log_builtins.h:1188
LogEvent & string_value(const char *key, const char *val, size_t len)
Add a ad hoc string value with the given key.
Definition: log_builtins.h:1472
LogEvent()
"Full customization" constructor.
Definition: log_builtins.h:966
char * msg
Definition: log_builtins.h:883
LogEvent & lookup_quoted(longlong errcode, const char *tag,...)
Definition: log_builtins.h:1415
LogEvent & lookup_quotedv(longlong errcode, const char *tag, va_list vl)
Definition: log_builtins.h:1426
bool have_msg
Definition: log_builtins.h:885
LogEvent & prio(longlong val)
Set error message priority.
Definition: log_builtins.h:1272
LogEvent & subsys(const char *val)
Which subsystem in the source was the problem detected in? ("Repl"/"InnoDB"/"Server")
Definition: log_builtins.h:1147
LogEvent & errcode(longlong val)
Append a numeric error code.
Definition: log_builtins.h:1049
LogEvent & source_file(const char *val)
Which source file was the problem detected in?
Definition: log_builtins.h:1110
bool set_errcode(longlong errcode)
Set MySQL error-code if none has been set yet.
Definition: log_builtins.h:895
LogEvent & os_errno(longlong val)
Append a numeric (operating system, as opposed to MySQL) error number.
Definition: log_builtins.h:1085
LogEvent & type(enum_log_type val)
Set log type.
Definition: log_builtins.h:1037
LogEvent & thread_id(longlong val)
What thread / "connection ID" was the issue detected in?
Definition: log_builtins.h:1225
LogEvent & os_errmsg(const char *val)
Append a textual (operating system, as opposed to MySQL) error message, vulgo, strerror()
Definition: log_builtins.h:1098
LogEvent & component(const char *val)
Which component in the source was the problem detected in? This should be the same string that is giv...
Definition: log_builtins.h:1162
LogEvent & lookupv(longlong errcode, va_list args)
Find an error message by its MySQL error code.
Definition: log_builtins.h:1409
const char * msg_tag
Definition: log_builtins.h:884
LogEvent & verbatim(const char *msg_arg)
Add a message to the event, verbatim (i.e.
Definition: log_builtins.h:1315
LogEvent & message(const char *fmt,...)
Fill in a format string by substituting the % with the given arguments, then add the result as the ev...
Definition: log_builtins.h:1527
LogEvent & errsymbol(const char *val)
Append a (string) error symbol.
Definition: log_builtins.h:1061
void steal(log_line **save_to)
Definition: log_builtins.h:1012
LogEvent & table_name(const char *val)
What table were we working on?
Definition: log_builtins.h:1249
LogEvent & label(const char *val)
Set a label (usually "warning"/"error"/"information").
Definition: log_builtins.h:1286
LogEvent & source_line(longlong val)
Which line in the source file was the problem detected on?
Definition: log_builtins.h:1122
LogEvent & query_id(longlong val)
What query apparently caused the issue?
Definition: log_builtins.h:1237
LogEvent & message_quoted(const char *tag, const char *fmt,...)
Fill in a format string by substituting the % with the given arguments and tag, then add the result a...
Definition: log_builtins.h:1366
LogEvent & messagev(const char *fmt, va_list ap)
Fill in a format string by substituting the % with the given arguments, then add the result as the ev...
Definition: log_builtins.h:1332
LogEvent & sqlstate(const char *val)
Append a (string) SQL state.
Definition: log_builtins.h:1073
LogEvent & float_value(const char *key, double val)
Add a ad hoc (not "well-known") float value with the given key.
Definition: log_builtins.h:1456
log_line * ll
Definition: log_builtins.h:882
LogEvent & int_value(const char *key, longlong val)
Add a ad hoc integer value with the given key.
Definition: log_builtins.h:1441
LogEvent & user(LEX_CSTRING val)
What user were we working for at the time of the issue?
Definition: log_builtins.h:1175
LogEvent & string_value(const char *key, const char *val)
Add a ad hoc string value with the given key.
Definition: log_builtins.h:1488
void set_message_by_errcode(longlong errcode, va_list ap)
Set the error message (by MySQL error code).
Definition: log_builtins.h:1497
void set_message(const char *fmt, va_list ap)
Set the error message.
Definition: log_builtins.h:1506
LogEvent & lookup(longlong errcode,...)
Find an error message by its MySQL error code.
Definition: log_builtins.h:1389
LogEvent & host(LEX_CSTRING val)
Whose session did the issue appear in?
Definition: log_builtins.h:1200
Specifies macros to define Components.
static char buf[MAX_BUF]
Definition: conf_to_src.cc:72
void write(W *w, const T &t, const char *key, size_t key_sz)
Definition: sdi_impl.h:334
struct my_h_service_imp * my_h_service
A handle type for acquired Service.
Definition: registry.h:32
#define malloc(A)
Definition: lexyy.cc:914
#define free(A)
Definition: lexyy.cc:915
Error logging, slow query logging, general query logging: If it's server-internal,...
#define log_line_init
Definition: log_builtins.h:748
#define log_line_item_types_seen
Definition: log_builtins.h:752
const mysql_service_log_builtins_string_t * log_bs
string built-ins
Definition: keyring_file.cc:136
void log_line_process_hook_set(log_line_processor llp)
Set the log-event processor.
Definition: log_builtins.cc:104
#define log_set_cstring
Definition: log_builtins.h:757
#define log_set_float
Definition: log_builtins.h:755
log_line_processor log_line_process_hook_get(void)
Get current log-event processor.
Definition: log_builtins.cc:118
#define log_malloc
Definition: log_builtins.h:758
#define log_line_exit
Definition: log_builtins.h:749
#define log_line_submit
Definition: log_builtins.h:753
#define log_line_item_set
Definition: log_builtins.h:751
#define log_set_int
Definition: log_builtins.h:754
#define log_msg
Definition: log_builtins.h:760
#define error_msg_by_errcode
Definition: log_builtins.h:761
#define log_free
Definition: log_builtins.h:759
bool(* log_line_processor)(log_line *ll)
This defines built-in functions for use by logging services.
Definition: log_builtins.h:55
#define log_line_item_set_with_key
Definition: log_builtins.h:750
const mysql_service_log_builtins_t * log_bi
accessor built-ins
Definition: keyring_file.cc:135
#define log_set_lexstring
Definition: log_builtins.h:756
enum enum_log_service_error log_service_error
Error codes.
#define LOG_BUFF_MAX
advisory.
Definition: log_shared.h:224
enum enum_log_item_class log_item_class
enum_log_type
log_type – which log to send data to check vs enum_log_table_type and LOG_FILE/LOG_TABLE/LOG_NONE
Definition: log_shared.h:65
@ LOG_ITEM_SRV_COMPONENT
log called from component ...
Definition: log_shared.h:135
@ LOG_ITEM_SRC_FUNC
log called from function ...
Definition: log_shared.h:133
@ LOG_ITEM_LOG_LABEL
label, unless auto-derived
Definition: log_shared.h:142
@ LOG_ITEM_SQL_QUERY_ID
query ID
Definition: log_shared.h:139
@ LOG_ITEM_SQL_ERRSYMBOL
mysql error code (symbolic)
Definition: log_shared.h:127
@ LOG_ITEM_GEN_FLOAT
float not otherwise specified
Definition: log_shared.h:150
@ LOG_ITEM_LOG_TYPE
error log, etc.
Definition: log_shared.h:125
@ LOG_ITEM_SRC_FILE
log called from file ...
Definition: log_shared.h:131
@ LOG_ITEM_SQL_TABLE_NAME
table name
Definition: log_shared.h:140
@ LOG_ITEM_MSC_USER
offending thread owned by ...
Definition: log_shared.h:136
@ LOG_ITEM_LOG_MESSAGE
the message, format string
Definition: log_shared.h:144
@ LOG_ITEM_GEN_INTEGER
integer not otherwise specified
Definition: log_shared.h:151
@ LOG_ITEM_LOG_PRIO
log priority (error, warn, ...)
Definition: log_shared.h:141
@ LOG_ITEM_SRV_SUBSYS
log called from subsystem ...
Definition: log_shared.h:134
@ LOG_ITEM_SYS_ERRNO
OS errno.
Definition: log_shared.h:129
@ LOG_ITEM_SQL_ERRCODE
mysql error code (numeric)
Definition: log_shared.h:126
@ LOG_ITEM_SRV_THREAD
connection ID
Definition: log_shared.h:138
@ LOG_ITEM_SRC_LINE
log called from line ...
Definition: log_shared.h:132
@ LOG_ITEM_GEN_LEX_STRING
lex string not otherwise specified
Definition: log_shared.h:152
@ LOG_ITEM_MSC_HOST
responsible user on host ...
Definition: log_shared.h:137
@ LOG_ITEM_SYS_STRERROR
OS strerror()
Definition: log_shared.h:130
@ LOG_ITEM_SQL_STATE
SQL state.
Definition: log_shared.h:128
@ LOG_ITEM_FREE_NONE
Definition: log_shared.h:178
@ LOG_ITEM_FREE_VALUE
Definition: log_shared.h:180
enum enum_log_item_type log_item_type
item_type – what to log
uint64 log_item_type_mask
a bit mask of log_types.
Definition: log_shared.h:215
static int log_type
Definition: mi_log.cc:46
Header for compiler-dependent features.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
long long int longlong
Definition: my_inttypes.h:54
uint32_t uint32
Definition: my_inttypes.h:66
loglevel
Definition: my_loglevel.h:40
Definition: buf0block_hint.cc:29
constexpr value_type timestamp
Definition: classic_protocol_constants.h:277
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
stdx::expected< void, std::error_code > close(file_handle_type native_handle)
close file handle.
Definition: file.h:238
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:419
stdx::expected< int, std::error_code > open(const char *fname, int flags, mode_t mode) noexcept
Definition: file_handle.cc:78
required string key
Definition: replication_asynchronous_connection_failover.proto:59
static int compare(size_t a, size_t b)
Function to compare two size_t integers for their relative order.
Definition: rpl_utility.cc:106
#define DECLARE_METHOD(retval, name, args)
Declares a method as a part of the Service definition.
Definition: service.h:102
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:75
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:90
#define SERVICE_TYPE_NO_CONST(name)
Generates the standard Service type name.
Definition: service.h:70
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:85
Specifies macros to define Service Implementations.
Declaration of the registry plugin service.
const mysql_service_registry_t * mysql_plugin_registry_acquire()
Returns a new reference to the "registry" service.
Definition: plugin_registry_service.cc:46
int mysql_plugin_registry_release(const mysql_service_registry_t *)
Releases a registry service reference.
Definition: plugin_registry_service.cc:74
case opt name
Definition: sslopt-case.h:32
Definition: mysql_lex_string.h:39
const char * str
Definition: mysql_lex_string.h:40
size_t length
Definition: mysql_lex_string.h:41
Iterator over the key/value pairs of a log_line.
Definition: keyring_log_builtins_definition.cc:63
Definition: log_shared.h:195
log_line ("log event")
Definition: keyring_log_builtins_definition.cc:71
static const mysql_service_registry_t * reg_srv
Initialize parameters required for error logging.
Definition: test_plugin.cc:61
Definition: log_shared.h:184
int n
Definition: xcom_base.cc:508