40#if defined(MYSQL_DYNAMIC_PLUGIN)
48#if defined(MYSQL_SERVER) && !defined(MYSQL_DYNAMIC_PLUGIN)
622 (const
char *name_or_ext,
void **my_errstream));
682 (const
char *
file,
void **my_errstream));
707 (const
char *a, const
char *b,
size_t len,
708 bool case_insensitive));
723 (
char *to,
size_t n, const
char *fmt, va_list ap))
724MY_ATTRIBUTE((format(printf, 3, 0)));
728MY_ATTRIBUTE((format(printf, 3, 4)));
738 (
void *thd, uint severity, uint code,
char *to,
size_t n,
739 const
char *format, ...))
740MY_ATTRIBUTE((format(printf, 6, 7)));
748 (const
char *
name,
int option,
int facility));
761#define log_line_init log_bi->line_init
762#define log_line_exit log_bi->line_exit
763#define log_line_item_set_with_key log_bi->line_item_set_with_key
764#define log_line_item_set log_bi->line_item_set
765#define log_line_item_types_seen log_bi->line_item_types_seen
766#define log_line_submit log_bi->line_submit
767#define log_set_int log_bi->item_set_int
768#define log_set_float log_bi->item_set_float
769#define log_set_lexstring log_bi->item_set_lexstring
770#define log_set_cstring log_bi->item_set_cstring
771#define log_line_set_flag log_bi->line_set_flag
772#define log_malloc log_bs->malloc
773#define log_free log_bs->free
774#define log_msg log_bs->substitutev
775#define error_msg_by_errcode log_bi->errmsg_by_errcode
776#define error_code_by_errsymbol log_bi->errcode_by_errsymbol
781#define log_malloc(s) my_malloc(0, (s), MYF(0))
782#define log_free my_free
783#define log_msg vsnprintf
784#define error_msg_by_errcode error_message_for_error_log
785#define error_code_by_errsymbol mysql_symbol_to_errno
786#define log_set_int log_item_set_int
787#define log_set_float log_item_set_float
788#define log_set_lexstring log_item_set_lexstring
789#define log_set_cstring log_item_set_cstring
793#ifndef DISABLE_ERROR_LOGGING
795#if defined(LOG_COMPONENT_TAG)
797#define LogErr(severity, ecode, ...) \
801 .subsys(LOG_SUBSYSTEM_TAG) \
802 .component(LOG_COMPONENT_TAG) \
803 .source_line(__LINE__) \
804 .source_file(MY_BASENAME) \
805 .function(__FUNCTION__) \
806 .lookup(ecode, ##__VA_ARGS__)
808#define LogComponentErr(severity, ecode, ...) \
812 .subsys(LOG_SUBSYSTEM_TAG) \
813 .component("component:" LOG_COMPONENT_TAG) \
814 .source_line(__LINE__) \
815 .source_file(MY_BASENAME) \
816 .function(__FUNCTION__) \
817 .lookup_quoted(ecode, "Component " LOG_COMPONENT_TAG " reported", \
820#define LogPluginErr(severity, ecode, ...) \
824 .subsys(LOG_SUBSYSTEM_TAG) \
825 .component("plugin:" LOG_COMPONENT_TAG) \
826 .source_line(__LINE__) \
827 .source_file(MY_BASENAME) \
828 .function(__FUNCTION__) \
829 .lookup_quoted(ecode, "Plugin " LOG_COMPONENT_TAG " reported", \
832#define LogPluginErrV(severity, ecode, vl) \
836 .subsys(LOG_SUBSYSTEM_TAG) \
837 .component("plugin:" LOG_COMPONENT_TAG) \
838 .source_line(__LINE__) \
839 .source_file(MY_BASENAME) \
840 .function(__FUNCTION__) \
841 .lookup_quotedv(ecode, "Plugin " LOG_COMPONENT_TAG " reported", vl)
843#define LogPluginErrMsg(severity, ecode, ...) \
847 .subsys(LOG_SUBSYSTEM_TAG) \
848 .component("plugin:" LOG_COMPONENT_TAG) \
849 .source_line(__LINE__) \
850 .source_file(MY_BASENAME) \
851 .function(__FUNCTION__) \
852 .message_quoted("Plugin " LOG_COMPONENT_TAG " reported", ##__VA_ARGS__)
856#define LogErr(severity, ecode, ...) \
860 .subsys(LOG_SUBSYSTEM_TAG) \
861 .source_line(__LINE__) \
862 .source_file(MY_BASENAME) \
863 .function(__FUNCTION__) \
864 .lookup(ecode, ##__VA_ARGS__)
870inline void dummy_log_message(
longlong severity [[maybe_unused]],
871 longlong ecode [[maybe_unused]], ...) {
875#define LogErr(severity, ecode, ...) \
876 dummy_log_message(severity, ecode, ##__VA_ARGS__)
878#define LogPluginErr(severity, ecode, ...) \
879 dummy_log_message(severity, ecode, ##__VA_ARGS__)
880#define LogPluginErrV(severity, ecode, ...) \
881 dummy_log_message(severity, ecode, ##__VA_ARGS__)
882#define LogPluginErrMsg(severity, ecode, ...) \
883 dummy_log_message(severity, ecode, ##__VA_ARGS__)
910 if (
ll ==
nullptr)
return true;
926 MY_ATTRIBUTE((format(printf, 2, 0)));
1347 MY_ATTRIBUTE((format(printf, 2, 0))) {
1367 LogEvent &
message(
const char *fmt, ...) MY_ATTRIBUTE((format(printf, 2, 3)));
1381 MY_ATTRIBUTE((format(printf, 3, 4))) {
1385 va_start(args, fmt);
1433 va_start(args, tag);
1524 if ((fmt ==
nullptr) || (*fmt ==
'\0')) fmt =
"invalid error code";
1531 if ((
ll !=
nullptr) && (
msg !=
nullptr)) {
1539 const char ellipsis[] =
" <...>";
1553 va_start(args, fmt);
1561#if defined(MYSQL_DYNAMIC_PLUGIN)
1570inline void deinit_logging_service_for_plugin(
1576 (*reg_srv)->release(
1580 const_cast<log_builtins_string_t *
>(*
log_bs)));
1597inline bool init_logging_service_for_plugin(
1603 if (!(*reg_srv)->acquire(
"log_builtins.mysql_server", &log_srv) &&
1604 !(*reg_srv)->acquire(
"log_builtins_string.mysql_server", &log_str_srv)) {
1605 (*log_bi) =
reinterpret_cast<SERVICE_TYPE(log_builtins) *
>(log_srv);
1607 reinterpret_cast<SERVICE_TYPE(log_builtins_string) *
>(log_str_srv);
1615#elif defined(EXTRA_CODE_FOR_UNIT_TESTING)
1627inline bool init_logging_service_for_plugin(
1643inline void deinit_logging_service_for_plugin(
Modular logger: fluid API.
Definition: log_builtins.h:894
~LogEvent()
Destructor automatically sends the event on.
Definition: log_builtins.h:944
LogEvent & host(const char *val)
Whose session did the issue appear in?
Definition: log_builtins.h:1227
LogEvent & user(const char *val)
What user were we working for at the time of the issue?
Definition: log_builtins.h:1202
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:1486
LogEvent()
"Full customization" constructor.
Definition: log_builtins.h:980
char * msg
Definition: log_builtins.h:897
LogEvent & lookup_quoted(longlong errcode, const char *tag,...)
Definition: log_builtins.h:1429
LogEvent & lookup_quotedv(longlong errcode, const char *tag, va_list vl)
Definition: log_builtins.h:1440
bool have_msg
Definition: log_builtins.h:899
LogEvent & prio(longlong val)
Set error message priority.
Definition: log_builtins.h:1286
LogEvent & subsys(const char *val)
Which subsystem in the source was the problem detected in? ("Repl"/"InnoDB"/"Server")
Definition: log_builtins.h:1161
LogEvent & errcode(longlong val)
Append a numeric error code.
Definition: log_builtins.h:1063
LogEvent & source_file(const char *val)
Which source file was the problem detected in?
Definition: log_builtins.h:1124
bool set_errcode(longlong errcode)
Set MySQL error-code if none has been set yet.
Definition: log_builtins.h:909
LogEvent & os_errno(longlong val)
Append a numeric (operating system, as opposed to MySQL) error number.
Definition: log_builtins.h:1099
LogEvent & type(enum_log_type val)
Set log type.
Definition: log_builtins.h:1051
LogEvent & thread_id(longlong val)
What thread / "connection ID" was the issue detected in?
Definition: log_builtins.h:1239
LogEvent & os_errmsg(const char *val)
Append a textual (operating system, as opposed to MySQL) error message, vulgo, strerror()
Definition: log_builtins.h:1112
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:1176
LogEvent & lookupv(longlong errcode, va_list args)
Find an error message by its MySQL error code.
Definition: log_builtins.h:1423
const char * msg_tag
Definition: log_builtins.h:898
LogEvent & verbatim(const char *msg_arg)
Add a message to the event, verbatim (i.e.
Definition: log_builtins.h:1329
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:1551
LogEvent & errsymbol(const char *val)
Append a (string) error symbol.
Definition: log_builtins.h:1075
void steal(log_line **save_to)
Definition: log_builtins.h:1026
LogEvent & table_name(const char *val)
What table were we working on?
Definition: log_builtins.h:1263
LogEvent & label(const char *val)
Set a label (usually "warning"/"error"/"information").
Definition: log_builtins.h:1300
LogEvent & source_line(longlong val)
Which line in the source file was the problem detected on?
Definition: log_builtins.h:1136
LogEvent & query_id(longlong val)
What query apparently caused the issue?
Definition: log_builtins.h:1251
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:1380
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:1346
LogEvent & sqlstate(const char *val)
Append a (string) SQL state.
Definition: log_builtins.h:1087
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:1470
log_line * ll
Definition: log_builtins.h:896
LogEvent & int_value(const char *key, longlong val)
Add a ad hoc integer value with the given key.
Definition: log_builtins.h:1455
LogEvent & user(LEX_CSTRING val)
What user were we working for at the time of the issue?
Definition: log_builtins.h:1189
LogEvent & string_value(const char *key, const char *val)
Add a ad hoc string value with the given key.
Definition: log_builtins.h:1502
void set_message_by_errcode(longlong errcode, va_list ap)
Set the error message (by MySQL error code).
Definition: log_builtins.h:1521
void set_message(const char *fmt, va_list ap)
Set the error message.
Definition: log_builtins.h:1530
LogEvent & lookup(longlong errcode,...)
Find an error message by its MySQL error code.
Definition: log_builtins.h:1403
LogEvent & host(LEX_CSTRING val)
Whose session did the issue appear in?
Definition: log_builtins.h:1214
LogEvent & no_telemetry()
Mark log line to skip being additionally emitted as a telemetry log record.
Definition: log_builtins.h:1515
Specifies macros to define Components.
static char buf[MAX_BUF]
Definition: conf_to_src.cc:73
void write(W *w, const T &t, const char *key, size_t key_sz)
Definition: sdi_impl.h:335
struct my_h_service_imp * my_h_service
A handle type for acquired Service.
Definition: registry.h:33
#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:761
#define log_line_item_types_seen
Definition: log_builtins.h:765
const mysql_service_log_builtins_string_t * log_bs
string built-ins
Definition: keyring_file.cc:142
void log_line_process_hook_set(log_line_processor llp)
Set the log-event processor.
Definition: log_builtins.cc:126
#define log_set_cstring
Definition: log_builtins.h:770
#define log_set_float
Definition: log_builtins.h:768
log_line_processor log_line_process_hook_get(void)
Get current log-event processor.
Definition: log_builtins.cc:140
#define log_malloc
Definition: log_builtins.h:772
#define log_line_set_flag
Definition: log_builtins.h:771
#define log_line_exit
Definition: log_builtins.h:762
#define log_line_submit
Definition: log_builtins.h:766
#define log_line_item_set
Definition: log_builtins.h:764
#define log_set_int
Definition: log_builtins.h:767
#define log_msg
Definition: log_builtins.h:774
#define error_msg_by_errcode
Definition: log_builtins.h:775
#define log_free
Definition: log_builtins.h:773
bool(* log_line_processor)(log_line *ll)
This defines built-in functions for use by logging services.
Definition: log_builtins.h:56
#define log_line_item_set_with_key
Definition: log_builtins.h:763
const mysql_service_log_builtins_t * log_bi
accessor built-ins
Definition: keyring_file.cc:141
#define log_set_lexstring
Definition: log_builtins.h:769
enum enum_log_service_error log_service_error
Error codes.
@ LOG_LINE_EMIT_TELEMETRY
emit log line as telemetry record
Definition: log_shared.h:161
uint64 log_line_flags_mask
a bit mask with flags describing a log line
Definition: log_shared.h:230
#define LOG_BUFF_MAX
advisory.
Definition: log_shared.h:233
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:66
@ LOG_ITEM_SRV_COMPONENT
log called from component ...
Definition: log_shared.h:136
@ LOG_ITEM_SRC_FUNC
log called from function ...
Definition: log_shared.h:134
@ LOG_ITEM_LOG_LABEL
label, unless auto-derived
Definition: log_shared.h:143
@ LOG_ITEM_SQL_QUERY_ID
query ID
Definition: log_shared.h:140
@ LOG_ITEM_SQL_ERRSYMBOL
mysql error code (symbolic)
Definition: log_shared.h:128
@ LOG_ITEM_GEN_FLOAT
float not otherwise specified
Definition: log_shared.h:151
@ LOG_ITEM_LOG_TYPE
error log, etc.
Definition: log_shared.h:126
@ LOG_ITEM_SRC_FILE
log called from file ...
Definition: log_shared.h:132
@ LOG_ITEM_SQL_TABLE_NAME
table name
Definition: log_shared.h:141
@ LOG_ITEM_MSC_USER
offending thread owned by ...
Definition: log_shared.h:137
@ LOG_ITEM_LOG_MESSAGE
the message, format string
Definition: log_shared.h:145
@ LOG_ITEM_GEN_INTEGER
integer not otherwise specified
Definition: log_shared.h:152
@ LOG_ITEM_LOG_PRIO
log priority (error, warn, ...)
Definition: log_shared.h:142
@ LOG_ITEM_SRV_SUBSYS
log called from subsystem ...
Definition: log_shared.h:135
@ LOG_ITEM_SYS_ERRNO
OS errno.
Definition: log_shared.h:130
@ LOG_ITEM_SQL_ERRCODE
mysql error code (numeric)
Definition: log_shared.h:127
@ LOG_ITEM_SRV_THREAD
connection ID
Definition: log_shared.h:139
@ LOG_ITEM_SRC_LINE
log called from line ...
Definition: log_shared.h:133
@ LOG_ITEM_GEN_LEX_STRING
lex string not otherwise specified
Definition: log_shared.h:153
@ LOG_ITEM_MSC_HOST
responsible user on host ...
Definition: log_shared.h:138
@ LOG_ITEM_SYS_STRERROR
OS strerror()
Definition: log_shared.h:131
@ LOG_ITEM_SQL_STATE
SQL state.
Definition: log_shared.h:129
@ LOG_ITEM_FREE_NONE
Definition: log_shared.h:184
@ LOG_ITEM_FREE_VALUE
Definition: log_shared.h:186
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:221
static int log_type
Definition: mi_log.cc:47
static mi_bit_type mask[]
Definition: mi_packrec.cc:141
Header for compiler-dependent features.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
long long int longlong
Definition: my_inttypes.h:55
uint32_t uint32
Definition: my_inttypes.h:67
loglevel
Definition: my_loglevel.h:41
Definition: buf0block_hint.cc:30
constexpr value_type timestamp
Definition: classic_protocol_constants.h:278
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:76
char * strndup(const char *s, size_t n)
The strndup() function returns a pointer to a new string which is a duplicate of the string s,...
Definition: wrapper_functions.h:123
stdx::expected< void, std::error_code > close(file_handle_type native_handle)
close file handle.
Definition: file.h:239
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
stdx::expected< int, std::error_code > open(const char *fname, int flags, mode_t mode) noexcept
Definition: file_handle.cc:79
required string key
Definition: replication_asynchronous_connection_failover.proto:60
static int compare(size_t a, size_t b)
Function to compare two size_t integers for their relative order.
Definition: rpl_utility.cc:107
#define DECLARE_METHOD(retval, name, args)
Declares a method as a part of the Service definition.
Definition: service.h:103
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:91
#define SERVICE_TYPE_NO_CONST(name)
Generates the standard Service type name.
Definition: service.h:71
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:86
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:47
int mysql_plugin_registry_release(const mysql_service_registry_t *)
Releases a registry service reference.
Definition: plugin_registry_service.cc:75
case opt name
Definition: sslopt-case.h:29
Definition: mysql_lex_string.h:40
const char * str
Definition: mysql_lex_string.h:41
size_t length
Definition: mysql_lex_string.h:42
Iterator over the key/value pairs of a log_line.
Definition: keyring_log_builtins_definition.cc:64
Definition: log_shared.h:201
log_line ("log event")
Definition: keyring_log_builtins_definition.cc:72
static const mysql_service_registry_t * reg_srv
Initialize parameters required for error logging.
Definition: test_plugin.cc:62
Definition: log_shared.h:190
int n
Definition: xcom_base.cc:509