The change to the mysql.user table in MySQL 5.7 caused MaxScale to stop
working with it. This commit adds functionality that checks which version of
the user data query should be made. It also moves common code related to
server version strings to server.c
With only one log-file no arguments are needed. The maxadmin command
'flush log' still accepts all the previous arguments, but warns about
them being deprecated.
The native way for logging is now by syslog priority and not by
logfile id. In practice that means that there's a function -
mxs_log_message - that takes a syslog priority. The new logging
macros (MXS_ERROR and friends) call that directly and the old
ones as well after having the logfile id translated into the
equivalent priority.
What is enabled or not is still by logfile id and hence the
priority is internally translated into a logfile id when checking
whether something really should be logged or not.
Maxinfo now supports the shutdown command which shuts down a service, monitor
or MaxScale itself and the restart command which restarts a stopped monitor
or service.
The value of global variables that can change copied before being
accessed to ensure that the used value is the same for the duration
of a function call. No locks are needed, because even if the copying
would not be atomic, it doesn't matter since all that matters is that
the used value does not change for the duration.
The string given to logmanager_write_log cannot be NULL.
The id given to logmanager_write_log cannot be invalid.
Consequently we need not handle those possibilities.
Earlier, the global setting for the syslog decided whether syslog
was enabled when skygw_logmanager_init was called, but not whether
logging to syslog actually was made.
Now syslog logging is enabled by default and the global setting
decides whether or not syslog logging actually is made. That is,
this opens up the possiblity for making it possible to turn on
and off sysloging at runtime.
Further, although the API led you to believe otherwise, it was
hardwired that LOGFILE_ERROR and LOGFILE_MESSAGE messages were
written to syslog.
The changed removed the need for passing an argv array explicitly.
The syslog ident must be provided explicitly when calling
skygw_logmanager_init (and not provided via the argv array).
It can be NULL, in which case it automatically will be the program
name.
The openlog() call is now always made, irrespective of what the
value of the global syslog flag is. That way it will be possible
to turn syslog logging on or off after the fact.
Whether the log-file should be written to the filesystem or to
shared memory must now be explicitly defined when calling
skygw_logmanager_init() (instead of passing that via the argc/argv
construct).
Also, the meaning of '-l' when invoking maxscale has been changed.
Earlier -l [file|shm] specified whether the trace and debug logs
should be written to shared memory (while the error and message
logs always were written to the filesystem) and the _default_
was to write them to shared memory.
Now, with only one file, '-l' has still the same meaning, but it
decides whether the one and only logfile should be written to shared
memory, or the filesystem and the _default_ is to write it to the
filesystem.
If the log manager has not been inited, then messages are written
to stdout. In practice this can happen if something is directly or
indirectly logged during the startup of maxscale, before
skygw_logmanager_init() has been called. Some refactoring is needed
to allow skygw_logmanager_init() to be called very early at program
startup.
The previous interface of skygw_logmanager_init was conceptually
broken. With -o you could specify that logging should be done to
stdout. However, even if you did that, the log manager still checked
that the logging directory could be accessed. Unless it had been
specified using -j <path> the default was /var/log/maxscale.
That is, unless the program calling skygw_logmanager_init was invoked
by a user that had write access to /var/log/maxscale, there would be
a complaint even if nothing was ever written to that directory.
In practice this meant that even if -o was used you had to provide
a -j with a path that surely is writeable (e.g. "/tmp").
This has now been changed so that you explicitly must provide the
log directory and the flags -j and -o are removed.
bool skygw_logmanager_init(const char* logdir, int argc, char* argv[]);
If /logdir/ is provided then logged messages are written to a log file
in that directory. If /logdir/ is NULL then messages are logged to stdout
and no checks for access to any directory is not made.
- Tabs replaced with spaces.
- Indentation level 4 spaces.
- Allman braces (except for part of commands)
- Space after ,
- Spaces around binary operators.
No other changes.
The log manager variables lm_enabled_log_files_bitmask, log_ses_count
and tls_log_info that earlier were declared separately in every
c-file are now declared in the log_manager.h header.
The log manager possibility for explicitly specifying the names
of the log files has never been used. In the name of simplicity
that functionality is removed.