40#if defined(MYSQL_DYNAMIC_PLUGIN)
48#if defined(MYSQL_SERVER) && !defined(MYSQL_DYNAMIC_PLUGIN)
610 (const
char *name_or_ext,
void **my_errstream));
670 (const
char *
file,
void **my_errstream));
695 (const
char *a, const
char *b,
size_t len,
696 bool case_insensitive));
711 (
char *to,
size_t n, const
char *fmt, va_list ap))
712MY_ATTRIBUTE((format(printf, 3, 0)));
716MY_ATTRIBUTE((format(printf, 3, 4)));
726 (
void *thd,
uint severity,
uint code,
char *to,
size_t n,
727 const
char *format, ...))
728MY_ATTRIBUTE((format(printf, 6, 7)));
736 (const
char *
name,
int option,
int facility));
749#define log_line_init log_bi->line_init
750#define log_line_exit log_bi->line_exit
751#define log_line_item_set_with_key log_bi->line_item_set_with_key
752#define log_line_item_set log_bi->line_item_set
753#define log_line_item_types_seen log_bi->line_item_types_seen
754#define log_line_submit log_bi->line_submit
755#define log_set_int log_bi->item_set_int
756#define log_set_float log_bi->item_set_float
757#define log_set_lexstring log_bi->item_set_lexstring
758#define log_set_cstring log_bi->item_set_cstring
759#define log_malloc log_bs->malloc
760#define log_free log_bs->free
761#define log_msg log_bs->substitutev
762#define error_msg_by_errcode log_bi->errmsg_by_errcode
763#define error_code_by_errsymbol log_bi->errcode_by_errsymbol
768#define log_malloc(s) my_malloc(0, (s), MYF(0))
769#define log_free my_free
770#define log_msg vsnprintf
771#define error_msg_by_errcode error_message_for_error_log
772#define error_code_by_errsymbol mysql_symbol_to_errno
773#define log_set_int log_item_set_int
774#define log_set_float log_item_set_float
775#define log_set_lexstring log_item_set_lexstring
776#define log_set_cstring log_item_set_cstring
780#ifndef DISABLE_ERROR_LOGGING
782#if defined(LOG_COMPONENT_TAG)
784#define LogErr(severity, ecode, ...) \
788 .subsys(LOG_SUBSYSTEM_TAG) \
789 .component(LOG_COMPONENT_TAG) \
790 .source_line(__LINE__) \
791 .source_file(MY_BASENAME) \
792 .function(__FUNCTION__) \
793 .lookup(ecode, ##__VA_ARGS__)
795#define LogComponentErr(severity, ecode, ...) \
799 .subsys(LOG_SUBSYSTEM_TAG) \
800 .component("component:" LOG_COMPONENT_TAG) \
801 .source_line(__LINE__) \
802 .source_file(MY_BASENAME) \
803 .function(__FUNCTION__) \
804 .lookup_quoted(ecode, "Component " LOG_COMPONENT_TAG " reported", \
807#define LogPluginErr(severity, ecode, ...) \
811 .subsys(LOG_SUBSYSTEM_TAG) \
812 .component("plugin:" LOG_COMPONENT_TAG) \
813 .source_line(__LINE__) \
814 .source_file(MY_BASENAME) \
815 .function(__FUNCTION__) \
816 .lookup_quoted(ecode, "Plugin " LOG_COMPONENT_TAG " reported", \
819#define LogPluginErrV(severity, ecode, vl) \
823 .subsys(LOG_SUBSYSTEM_TAG) \
824 .component("plugin:" LOG_COMPONENT_TAG) \
825 .source_line(__LINE__) \
826 .source_file(MY_BASENAME) \
827 .function(__FUNCTION__) \
828 .lookup_quotedv(ecode, "Plugin " LOG_COMPONENT_TAG " reported", vl)
830#define LogPluginErrMsg(severity, ecode, ...) \
834 .subsys(LOG_SUBSYSTEM_TAG) \
835 .component("plugin:" LOG_COMPONENT_TAG) \
836 .source_line(__LINE__) \
837 .source_file(MY_BASENAME) \
838 .function(__FUNCTION__) \
839 .message_quoted("Plugin " LOG_COMPONENT_TAG " reported", ##__VA_ARGS__)
843#define LogErr(severity, ecode, ...) \
847 .subsys(LOG_SUBSYSTEM_TAG) \
848 .source_line(__LINE__) \
849 .source_file(MY_BASENAME) \
850 .function(__FUNCTION__) \
851 .lookup(ecode, ##__VA_ARGS__)
857inline void dummy_log_message(
longlong severity [[maybe_unused]],
858 longlong ecode [[maybe_unused]], ...) {
862#define LogErr(severity, ecode, ...) \
863 dummy_log_message(severity, ecode, ##__VA_ARGS__)
865#define LogPluginErr(severity, ecode, ...) \
866 dummy_log_message(severity, ecode, ##__VA_ARGS__)
867#define LogPluginErrV(severity, ecode, ...) \
868 dummy_log_message(severity, ecode, ##__VA_ARGS__)
869#define LogPluginErrMsg(severity, ecode, ...) \
870 dummy_log_message(severity, ecode, ##__VA_ARGS__)
897 if (
ll ==
nullptr)
return true;
913 MY_ATTRIBUTE((format(printf, 2, 0)));
1334 MY_ATTRIBUTE((format(printf, 2, 0))) {
1354 LogEvent &
message(
const char *fmt, ...) MY_ATTRIBUTE((format(printf, 2, 3)));
1368 MY_ATTRIBUTE((format(printf, 3, 4))) {
1372 va_start(args, fmt);
1420 va_start(args, tag);
1501 if ((fmt ==
nullptr) || (*fmt ==
'\0')) fmt =
"invalid error code";
1508 if ((
ll !=
nullptr) && (
msg !=
nullptr)) {
1516 const char ellipsis[] =
" <...>";
1530 va_start(args, fmt);
1538#if defined(MYSQL_DYNAMIC_PLUGIN)
1547inline void deinit_logging_service_for_plugin(
1553 (*reg_srv)->release(
1557 const_cast<log_builtins_string_t *
>(*
log_bs)));
1574inline bool init_logging_service_for_plugin(
1580 if (!(*reg_srv)->acquire(
"log_builtins.mysql_server", &log_srv) &&
1581 !(*reg_srv)->acquire(
"log_builtins_string.mysql_server", &log_str_srv)) {
1582 (*log_bi) =
reinterpret_cast<SERVICE_TYPE(log_builtins) *
>(log_srv);
1584 reinterpret_cast<SERVICE_TYPE(log_builtins_string) *
>(log_str_srv);
1592#elif defined(EXTRA_CODE_FOR_UNIT_TESTING)
1604inline bool init_logging_service_for_plugin(
1620inline void deinit_logging_service_for_plugin(
Modular logger: fluid API.
Definition: log_builtins.h:881
~LogEvent()
Destructor automatically sends the event on.
Definition: log_builtins.h:931
LogEvent & host(const char *val)
Whose session did the issue appear in?
Definition: log_builtins.h:1214
LogEvent & user(const char *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, size_t len)
Add a ad hoc string value with the given key.
Definition: log_builtins.h:1473
LogEvent()
"Full customization" constructor.
Definition: log_builtins.h:967
char * msg
Definition: log_builtins.h:884
LogEvent & lookup_quoted(longlong errcode, const char *tag,...)
Definition: log_builtins.h:1416
LogEvent & lookup_quotedv(longlong errcode, const char *tag, va_list vl)
Definition: log_builtins.h:1427
bool have_msg
Definition: log_builtins.h:886
LogEvent & prio(longlong val)
Set error message priority.
Definition: log_builtins.h:1273
LogEvent & subsys(const char *val)
Which subsystem in the source was the problem detected in? ("Repl"/"InnoDB"/"Server")
Definition: log_builtins.h:1148
LogEvent & errcode(longlong val)
Append a numeric error code.
Definition: log_builtins.h:1050
LogEvent & source_file(const char *val)
Which source file was the problem detected in?
Definition: log_builtins.h:1111
bool set_errcode(longlong errcode)
Set MySQL error-code if none has been set yet.
Definition: log_builtins.h:896
LogEvent & os_errno(longlong val)
Append a numeric (operating system, as opposed to MySQL) error number.
Definition: log_builtins.h:1086
LogEvent & type(enum_log_type val)
Set log type.
Definition: log_builtins.h:1038
LogEvent & thread_id(longlong val)
What thread / "connection ID" was the issue detected in?
Definition: log_builtins.h:1226
LogEvent & os_errmsg(const char *val)
Append a textual (operating system, as opposed to MySQL) error message, vulgo, strerror()
Definition: log_builtins.h:1099
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:1163
LogEvent & lookupv(longlong errcode, va_list args)
Find an error message by its MySQL error code.
Definition: log_builtins.h:1410
const char * msg_tag
Definition: log_builtins.h:885
LogEvent & verbatim(const char *msg_arg)
Add a message to the event, verbatim (i.e.
Definition: log_builtins.h:1316
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:1528
LogEvent & errsymbol(const char *val)
Append a (string) error symbol.
Definition: log_builtins.h:1062
void steal(log_line **save_to)
Definition: log_builtins.h:1013
LogEvent & table_name(const char *val)
What table were we working on?
Definition: log_builtins.h:1250
LogEvent & label(const char *val)
Set a label (usually "warning"/"error"/"information").
Definition: log_builtins.h:1287
LogEvent & source_line(longlong val)
Which line in the source file was the problem detected on?
Definition: log_builtins.h:1123
LogEvent & query_id(longlong val)
What query apparently caused the issue?
Definition: log_builtins.h:1238
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:1367
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:1333
LogEvent & sqlstate(const char *val)
Append a (string) SQL state.
Definition: log_builtins.h:1074
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:1457
log_line * ll
Definition: log_builtins.h:883
LogEvent & int_value(const char *key, longlong val)
Add a ad hoc integer value with the given key.
Definition: log_builtins.h:1442
LogEvent & user(LEX_CSTRING val)
What user were we working for at the time of the issue?
Definition: log_builtins.h:1176
LogEvent & string_value(const char *key, const char *val)
Add a ad hoc string value with the given key.
Definition: log_builtins.h:1489
void set_message_by_errcode(longlong errcode, va_list ap)
Set the error message (by MySQL error code).
Definition: log_builtins.h:1498
void set_message(const char *fmt, va_list ap)
Set the error message.
Definition: log_builtins.h:1507
LogEvent & lookup(longlong errcode,...)
Find an error message by its MySQL error code.
Definition: log_builtins.h:1390
LogEvent & host(LEX_CSTRING val)
Whose session did the issue appear in?
Definition: log_builtins.h:1201
Specifies macros to define Components.
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:749
#define log_line_item_types_seen
Definition: log_builtins.h:753
const mysql_service_log_builtins_string_t * log_bs
string built-ins
Definition: keyring_file.cc:137
void log_line_process_hook_set(log_line_processor llp)
Set the log-event processor.
Definition: log_builtins.cc:103
#define log_set_cstring
Definition: log_builtins.h:758
#define log_set_float
Definition: log_builtins.h:756
log_line_processor log_line_process_hook_get(void)
Get current log-event processor.
Definition: log_builtins.cc:117
#define log_malloc
Definition: log_builtins.h:759
#define log_line_exit
Definition: log_builtins.h:750
#define log_line_submit
Definition: log_builtins.h:754
#define log_line_item_set
Definition: log_builtins.h:752
#define log_set_int
Definition: log_builtins.h:755
#define log_msg
Definition: log_builtins.h:761
#define error_msg_by_errcode
Definition: log_builtins.h:762
#define log_free
Definition: log_builtins.h:760
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:751
const mysql_service_log_builtins_t * log_bi
accessor built-ins
Definition: keyring_file.cc:136
#define log_set_lexstring
Definition: log_builtins.h:757
enum enum_log_service_error log_service_error
Error codes.
#define LOG_BUFF_MAX
advisory.
Definition: log_shared.h:225
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:179
@ LOG_ITEM_FREE_VALUE
Definition: log_shared.h:181
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:216
static int log_type
Definition: mi_log.cc:47
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
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:420
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:33
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:196
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
unsigned int uint
Definition: uca9-dump.cc:75
Definition: log_shared.h:185
int n
Definition: xcom_base.cc:509