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,
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#ifdef HAVE_LOG_DIAGNOSTIC
809#define LogDiag(severity, ecode, ...) \
813 .subsys(LOG_SUBSYSTEM_TAG) \
814 .component(LOG_COMPONENT_TAG) \
815 .source_line(__LINE__) \
816 .source_file(MY_BASENAME) \
817 .function(__FUNCTION__) \
818 .type(LOG_TYPE_DIAG) \
819 .lookup(ecode, ##__VA_ARGS__)
824#define LogComponentErr(severity, ecode, ...) \
828 .subsys(LOG_SUBSYSTEM_TAG) \
829 .component("component:" LOG_COMPONENT_TAG) \
830 .source_line(__LINE__) \
831 .source_file(MY_BASENAME) \
832 .function(__FUNCTION__) \
833 .lookup_quoted(ecode, "Component " LOG_COMPONENT_TAG " reported", \
836#define LogPluginErr(severity, ecode, ...) \
840 .subsys(LOG_SUBSYSTEM_TAG) \
841 .component("plugin:" LOG_COMPONENT_TAG) \
842 .source_line(__LINE__) \
843 .source_file(MY_BASENAME) \
844 .function(__FUNCTION__) \
845 .lookup_quoted(ecode, "Plugin " LOG_COMPONENT_TAG " reported", \
848#define LogPluginErrV(severity, ecode, vl) \
852 .subsys(LOG_SUBSYSTEM_TAG) \
853 .component("plugin:" LOG_COMPONENT_TAG) \
854 .source_line(__LINE__) \
855 .source_file(MY_BASENAME) \
856 .function(__FUNCTION__) \
857 .lookup_quotedv(ecode, "Plugin " LOG_COMPONENT_TAG " reported", vl)
859#define LogPluginErrMsg(severity, ecode, ...) \
863 .subsys(LOG_SUBSYSTEM_TAG) \
864 .component("plugin:" LOG_COMPONENT_TAG) \
865 .source_line(__LINE__) \
866 .source_file(MY_BASENAME) \
867 .function(__FUNCTION__) \
868 .message_quoted("Plugin " LOG_COMPONENT_TAG " reported", ##__VA_ARGS__)
872#define LogErr(severity, ecode, ...) \
876 .subsys(LOG_SUBSYSTEM_TAG) \
877 .source_line(__LINE__) \
878 .source_file(MY_BASENAME) \
879 .function(__FUNCTION__) \
880 .lookup(ecode, ##__VA_ARGS__)
882#ifdef HAVE_LOG_DIAGNOSTIC
883#define LogDiag(severity, ecode, ...) \
887 .subsys(LOG_SUBSYSTEM_TAG) \
888 .source_line(__LINE__) \
889 .source_file(MY_BASENAME) \
890 .function(__FUNCTION__) \
891 .type(LOG_TYPE_DIAG) \
892 .lookup(ecode, ##__VA_ARGS__)
900inline void dummy_log_message(
longlong severity [[maybe_unused]],
901 longlong ecode [[maybe_unused]], ...) {
905#define LogErr(severity, ecode, ...) \
906 dummy_log_message(severity, ecode, ##__VA_ARGS__)
908#define LogPluginErr(severity, ecode, ...) \
909 dummy_log_message(severity, ecode, ##__VA_ARGS__)
910#define LogPluginErrV(severity, ecode, ...) \
911 dummy_log_message(severity, ecode, ##__VA_ARGS__)
912#define LogPluginErrMsg(severity, ecode, ...) \
913 dummy_log_message(severity, ecode, ##__VA_ARGS__)
940 if (
ll ==
nullptr)
return true;
956 MY_ATTRIBUTE((
format(printf, 2, 0)));
1377 MY_ATTRIBUTE((
format(printf, 2, 0))) {
1411 MY_ATTRIBUTE((
format(printf, 3, 4))) {
1415 va_start(args, fmt);
1463 va_start(args, tag);
1554 if ((fmt ==
nullptr) || (*fmt ==
'\0')) fmt =
"invalid error code";
1561 if ((
ll !=
nullptr) && (
msg !=
nullptr)) {
1569 const char ellipsis[] =
" <...>";
1583 va_start(args, fmt);
1591#if defined(MYSQL_DYNAMIC_PLUGIN)
1600inline void deinit_logging_service_for_plugin(
1606 (*reg_srv)->release(
1610 const_cast<log_builtins_string_t *
>(*
log_bs)));
1627inline bool init_logging_service_for_plugin(
1633 if (!(*reg_srv)->acquire(
"log_builtins.mysql_server", &log_srv) &&
1634 !(*reg_srv)->acquire(
"log_builtins_string.mysql_server", &log_str_srv)) {
1635 (*log_bi) =
reinterpret_cast<SERVICE_TYPE(log_builtins) *
>(log_srv);
1637 reinterpret_cast<SERVICE_TYPE(log_builtins_string) *
>(log_str_srv);
1645#elif defined(EXTRA_CODE_FOR_UNIT_TESTING)
1657inline bool init_logging_service_for_plugin(
1673inline void deinit_logging_service_for_plugin(
Modular logger: fluid API.
Definition: log_builtins.h:924
~LogEvent()
Destructor automatically sends the event on.
Definition: log_builtins.h:974
LogEvent & host(const char *val)
Whose session did the issue appear in?
Definition: log_builtins.h:1257
LogEvent & user(const char *val)
What user were we working for at the time of the issue?
Definition: log_builtins.h:1232
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:1516
LogEvent()
"Full customization" constructor.
Definition: log_builtins.h:1010
char * msg
Definition: log_builtins.h:927
LogEvent & lookup_quoted(longlong errcode, const char *tag,...)
Definition: log_builtins.h:1459
LogEvent & lookup_quotedv(longlong errcode, const char *tag, va_list vl)
Definition: log_builtins.h:1470
bool have_msg
Definition: log_builtins.h:929
LogEvent & prio(longlong val)
Set error message priority.
Definition: log_builtins.h:1316
LogEvent & subsys(const char *val)
Which subsystem in the source was the problem detected in? ("Repl"/"InnoDB"/"Server")
Definition: log_builtins.h:1191
LogEvent & errcode(longlong val)
Append a numeric error code.
Definition: log_builtins.h:1093
LogEvent & source_file(const char *val)
Which source file was the problem detected in?
Definition: log_builtins.h:1154
bool set_errcode(longlong errcode)
Set MySQL error-code if none has been set yet.
Definition: log_builtins.h:939
LogEvent & os_errno(longlong val)
Append a numeric (operating system, as opposed to MySQL) error number.
Definition: log_builtins.h:1129
LogEvent & type(enum_log_type val)
Set log type.
Definition: log_builtins.h:1081
LogEvent & thread_id(longlong val)
What thread / "connection ID" was the issue detected in?
Definition: log_builtins.h:1269
LogEvent & os_errmsg(const char *val)
Append a textual (operating system, as opposed to MySQL) error message, vulgo, strerror()
Definition: log_builtins.h:1142
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:1206
LogEvent & lookupv(longlong errcode, va_list args)
Find an error message by its MySQL error code.
Definition: log_builtins.h:1453
const char * msg_tag
Definition: log_builtins.h:928
LogEvent & verbatim(const char *msg_arg)
Add a message to the event, verbatim (i.e.
Definition: log_builtins.h:1359
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:1581
LogEvent & errsymbol(const char *val)
Append a (string) error symbol.
Definition: log_builtins.h:1105
void steal(log_line **save_to)
Definition: log_builtins.h:1056
LogEvent & table_name(const char *val)
What table were we working on?
Definition: log_builtins.h:1293
LogEvent & label(const char *val)
Set a label (usually "warning"/"error"/"information").
Definition: log_builtins.h:1330
LogEvent & source_line(longlong val)
Which line in the source file was the problem detected on?
Definition: log_builtins.h:1166
LogEvent & query_id(longlong val)
What query apparently caused the issue?
Definition: log_builtins.h:1281
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:1410
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:1376
LogEvent & sqlstate(const char *val)
Append a (string) SQL state.
Definition: log_builtins.h:1117
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:1500
log_line * ll
Definition: log_builtins.h:926
LogEvent & int_value(const char *key, longlong val)
Add a ad hoc integer value with the given key.
Definition: log_builtins.h:1485
LogEvent & user(LEX_CSTRING val)
What user were we working for at the time of the issue?
Definition: log_builtins.h:1219
LogEvent & string_value(const char *key, const char *val)
Add a ad hoc string value with the given key.
Definition: log_builtins.h:1532
void set_message_by_errcode(longlong errcode, va_list ap)
Set the error message (by MySQL error code).
Definition: log_builtins.h:1551
void set_message(const char *fmt, va_list ap)
Set the error message.
Definition: log_builtins.h:1560
LogEvent & lookup(longlong errcode,...)
Find an error message by its MySQL error code.
Definition: log_builtins.h:1433
LogEvent & host(LEX_CSTRING val)
Whose session did the issue appear in?
Definition: log_builtins.h:1244
LogEvent & no_telemetry()
Mark log line to skip being additionally emitted as a telemetry log record.
Definition: log_builtins.h:1545
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: connection_control.cc:42
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: connection_control.cc:41
#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:162
uint64 log_line_flags_mask
a bit mask with flags describing a log line
Definition: log_shared.h:231
#define LOG_BUFF_MAX
advisory.
Definition: log_shared.h:234
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:137
@ LOG_ITEM_SRC_FUNC
log called from function ...
Definition: log_shared.h:135
@ LOG_ITEM_LOG_LABEL
label, unless auto-derived
Definition: log_shared.h:144
@ LOG_ITEM_SQL_QUERY_ID
query ID
Definition: log_shared.h:141
@ LOG_ITEM_SQL_ERRSYMBOL
mysql error code (symbolic)
Definition: log_shared.h:129
@ LOG_ITEM_GEN_FLOAT
float not otherwise specified
Definition: log_shared.h:152
@ LOG_ITEM_LOG_TYPE
error log, etc.
Definition: log_shared.h:127
@ LOG_ITEM_SRC_FILE
log called from file ...
Definition: log_shared.h:133
@ LOG_ITEM_SQL_TABLE_NAME
table name
Definition: log_shared.h:142
@ LOG_ITEM_MSC_USER
offending thread owned by ...
Definition: log_shared.h:138
@ LOG_ITEM_LOG_MESSAGE
the message, format string
Definition: log_shared.h:146
@ LOG_ITEM_GEN_INTEGER
integer not otherwise specified
Definition: log_shared.h:153
@ LOG_ITEM_LOG_PRIO
log priority (error, warn, ...)
Definition: log_shared.h:143
@ LOG_ITEM_SRV_SUBSYS
log called from subsystem ...
Definition: log_shared.h:136
@ LOG_ITEM_SYS_ERRNO
OS errno.
Definition: log_shared.h:131
@ LOG_ITEM_SQL_ERRCODE
mysql error code (numeric)
Definition: log_shared.h:128
@ LOG_ITEM_SRV_THREAD
connection ID
Definition: log_shared.h:140
@ LOG_ITEM_SRC_LINE
log called from line ...
Definition: log_shared.h:134
@ LOG_ITEM_GEN_LEX_STRING
lex string not otherwise specified
Definition: log_shared.h:154
@ LOG_ITEM_MSC_HOST
responsible user on host ...
Definition: log_shared.h:139
@ LOG_ITEM_SYS_STRERROR
OS strerror()
Definition: log_shared.h:132
@ LOG_ITEM_SQL_STATE
SQL state.
Definition: log_shared.h:130
@ LOG_ITEM_FREE_NONE
Definition: log_shared.h:185
@ LOG_ITEM_FREE_VALUE
Definition: log_shared.h:187
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:222
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:202
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:191
int n
Definition: xcom_base.cc:509