58 Commits

Author SHA1 Message Date
Markus Mäkelä
77a1417479
Replace TR1 headers with standard headers
Now that the C++11 standard is the default one, we can remove the TR1
headers and classes.
2018-07-11 14:08:46 +03:00
Johan Wikman
cc0299aee6 Update change date of 2.3 2018-06-25 10:07:52 +03:00
Markus Mäkelä
13893cca3d
MXS-1914: Move maxscale_shutdown() into the core
The core library now contains the maxscale_shutdown() command. This makes
it possible to resolve all symbols at link time even for administrative
modules.
2018-06-18 12:58:50 +03:00
Johan Wikman
bed1c60fd4 MXS-421 Allow specifying a facility when logging
In principle a syslog priority consists of a syslog level
bit-or:d with a syslog facility. That's clear from the syslog
man page, but not so clear from the code in syslog.h.

Anyway, to make it possible to log using a specific facility
(instead of the default LOG_USER), we must allow priorities
that include a specified facility.
2018-06-15 12:41:52 +03:00
Johan Wikman
6cc03afdf9 MXS-1908 Reorder the code slightly 2018-06-12 10:49:05 +03:00
Johan Wikman
9a11394f22 MXS-1908 Rename classes
- MessageStats      -> MessageRegistry
- MessageStatsKey   -> MessageRegistryKey
- MessageStatsValue -> MessageRegistryStats
2018-06-12 10:49:05 +03:00
Johan Wikman
690999c4af MXS-1908 Turn LM_MESSAGE_STATS into a class 2018-06-12 10:49:05 +03:00
Johan Wikman
9f64c73bb4 MXS-1908 Turn LM_MESSAGE_KEY into a class 2018-06-12 10:49:05 +03:00
Johan Wikman
9e3b4b46fc MXS-1908 Replace HASHTABLE with std::unordered_map
Just minimal changes, further cleanup and simplification could
be done.
2018-06-12 10:49:05 +03:00
Johan Wikman
57cfb709b8 MXS-1819 Also log info messages to syslog
If info messages are enabled, they will be logged to syslog
just like any other messages.
2018-04-24 10:18:19 +03:00
Johan Wikman
bed0b850b1 Merge branch '2.1' into 2.2 2018-01-05 09:58:10 +02:00
Markus Mäkelä
e9fceff8ce Fix log manager race condition
The log manager could send two messages if a log message was posted soon
before the log manager was stopped. This caused a debug assertion which
then manifested as a deadlock inside the log manager.
2018-01-04 10:27:56 +02:00
Johan Wikman
289ae983df Replace log custom spinlocks with SPINLOCK 2018-01-03 14:54:41 +02:00
Markus Mäkelä
396b81f336 Fix in-source builds
The internal header directory conflicted with in-source builds causing a
build failure. This is fixed by renaming the internal header directory to
something other than maxscale.

The renaming pointed out a few problems in a couple of source files that
appeared to include internal headers when the headers were in fact public
headers.

Fixed maxctrl in-source builds by making the copying of the sources
optional.
2017-11-22 18:40:18 +02:00
Johan Wikman
02b9e0a01d Merge branch '2.1.7' into develop-2.1-merge 2017-09-12 11:08:02 +03:00
Johan Wikman
6794ed907a session_len must be included in assert 2017-09-06 16:41:56 +03:00
Johan Wikman
d0ec6e3762 MXS-1378 Log session id
If the session id is known, it will be logged together with all
messages. If present, the session id appears, enclosed in paranthesis,
right after the message category. E.g.

    2017-08-30 12:20:49   warning: (4711) [masking] The rule ...
2017-09-01 13:22:06 +03:00
Johan Wikman
63257f1b2a MXS-1378 Log session id
If the session id is known, it will be logged together with all
messages. If present, the session id appears, enclosed in paranthesis,
right after the message category. E.g.

    2017-08-30 12:20:49   warning: (4711) [masking] The rule ...
2017-08-30 13:58:42 +03:00
Johan Wikman
de7004cb95 Merge branch '2.1' into develop 2017-08-15 10:31:30 +03:00
geaaru
3485a32731 Fix compilation errors/warning with gcc-5.4.0 (#137)
Warning are like this:
 error: ‘delimiter’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
2017-08-15 09:56:22 +03:00
Markus Mäkelä
854c4a1ed3 Add support for non-glibc systems
MaxScale can now be built on systems that use an alternative libc
implementation e.g. musl.
2017-08-02 11:51:55 +03:00
Johan Wikman
6ba3193d5f MXS-1322 When flushing the log file, it will not be truncated
Earlier when the log file was flushed, it was also truncated,
which meant that the log content was log, unless the file first
was moved. Now it will only be opened. Thus, no data can be lost
due to the operation. If logrotate it used, the end result will
be the same, as the file is moved first.
2017-07-24 11:03:52 +03:00
Markus Mäkelä
84dc0b2d37 MXS-1300: Add enabled log priorities to /maxscale/logs resurce
The logging priorities should be displayed as a part of the resource as
they can be enabled or disabled at runtime.
2017-07-23 08:21:00 +03:00
Markus Mäkelä
310ef3b31e MXS-1300: Add show logging command
The show logging command shows the current log file and the logging
parameters.
2017-07-23 08:21:00 +03:00
Johan Wikman
f546a17e77 Update change date of 2.2 2017-06-01 10:24:20 +03:00
Markus Mäkelä
69be4d263f MXS-1220: Add admin interface parameters to /maxscale/ resource
The admin interface parameters are now a part of the /maxscale/ resource.
2017-05-24 15:05:11 +03:00
Markus Mäkelä
f1c790db52 MXS-1220: Add logging priorities to logs resoure
The logging priorities can now be queried and altered.
2017-05-17 10:14:57 +03:00
Markus Mäkelä
a384665141 MXS-1220: Allow modification of logging options
The logging options can now be modified with a PUT request.
2017-05-09 15:32:42 +03:00
Markus Mäkelä
1cb2783106 MXS-1220: Implement /maxscale/logs resource
The /maxscale/logs resource exposes information about the state of logging
in MaxScale.
2017-05-09 15:32:42 +03:00
Johan Wikman
82247f9143 Add mxs_strerror
Thread-safe version of strerror; thread local buffer used for storing
the message. The performance penalty of a thread local buffer is not
likely to be significant, since this is only called in an error
situation that anyway is likely to interrupt the normal processing.
2017-03-13 10:45:55 +02:00
Markus Mäkelä
e1a1959bc2 Replace strerror_r with mxs_strerror
The mxs_strerror function requires no local buffer, thus making it simpler
and cleaner to use.
2017-03-09 09:36:57 +02:00
Johan Wikman
65457f1724 Remove support for session specific log priorities
No need to maintain information in thread local storage,
which just added complexity and also incurred a slight
performance penalty.
2017-02-27 14:41:01 +02:00
Johan Wikman
71707c8505 Merge branch '2.1' into develop 2017-02-15 08:48:36 +02:00
Johan Wikman
49cc2b52e3 Merge branch '2.1.0' into 2.1 2017-02-15 08:44:55 +02:00
Johan Wikman
5648f708af Update license to BSL 1.1 2017-02-14 21:42:28 +02:00
Johan Wikman
0838401b32 Merge branch '2.1' into develop 2017-02-14 17:54:27 +02:00
Johan Wikman
5f0346f5a9 Remove support for session specific log priorities
No need to maintain information in thread local storage,
which just added complexity and also incurred a slight
performance penalty.
2017-02-14 12:35:24 +02:00
Johan Wikman
20da2c7db8 Add mxs_strerror
Thread-safe version of strerror; thread local buffer used for storing
the message. The performance penalty of a thread local buffer is not
likely to be significant, since this is only called in an error
situation that anyway is likely to interrupt the normal processing.
2017-02-14 09:39:03 +02:00
Markus Mäkelä
d2c3be8728 Fix compiler flag usage
The compiler flags overwrote the default values that CMake generates
instead of appending to them.
2017-02-10 17:19:46 +02:00
Markus Mäkelä
0b6b9c3d81 Format core source code and headers
Formatted core source code and headers with Astyle.
2017-01-17 14:47:50 +02:00
Johan Wikman
1a2e0ba3ee Check log priority before logging
With this change, whether something should be logged or, that is,
whether the used log priority is enabled or not, is checked before
the logging function is called. That should save a few cycles.

Now mxs_log_message() always logs a message, without consideration
for whether the priority is enabled or not. The inline function
mxs_log_is_priority_enabled() returns true if a particular priority
is enabled and the MXS_LOG_MESSAGE() macro (that MXS_ERROR etc. are
expanded into) call that before calling the actual logging function.
2016-10-24 14:00:51 +03:00
Johan Wikman
1333da0712 Remove skygw_utils.h
The general purpose stuff in skygw_utils.h was moved to utils.h
and the corresponding implementation from skygw_utils.cc to utils.c.
Includes updated accordingly.

Skygw_utils.h is now only used by log_manager and by mlist, which
is only used by log_manager. Consequently, skygw_utils.h was moved
to server/maxscale.

Utils.h needs a separate overhaul.
2016-10-14 19:50:54 +03:00
Johan Wikman
68e53567a0 Make mlist.h private
Mlist is only used by log_manager so for the time being it is moved
under server/core/maxscale. Eventually it may be included in log_manager
itself.
2016-10-14 15:55:33 +03:00
Johan Wikman
03dbc6df80 Remove dependency on skygw_utils.h
- STRERROR_BUFLEN moved to cdefs.h and renamed to MXS_STRERROR_BUFLEN.
  Better would be to provide a 'const char* mxs_strerror(int errno)'
  that would have a thread specific buffer for the error message.
- MIN and MAX also moved to defs.h as MXS_MIN and MXS_MAX.
- Now only mlist.h of the headers depend upon skygw_utils.h.
2016-10-14 15:42:02 +03:00
Johan Wikman
bff2cfb7e5 Remove skygw_types.h
Some stuff moved to maxscale/utils.h. Further cleanup still needed.
2016-10-14 14:24:31 +03:00
Johan Wikman
0800bf4a59 Rename skygw_debug.h to debug.h
Also remove unneded includes in debug.h
2016-10-14 13:48:10 +03:00
Johan Wikman
e41589be10 Move headers from server/include to include/maxscale
- Headers now to be included as <maxscale/xyz.h>
- First step, no cleanup of headers has been made. Only moving
  from one place to another + necessary modifications.
2016-10-13 16:19:20 +03:00
Johan Wikman
ef5bbd9353 Remove trailing NULLs from throttling message 2016-10-13 16:04:27 +03:00
Johan Wikman
93b755fc33 Add MXS_ALERT
As errors and warnings are throttled, there is a need for being able
to log severe errors without ever having them throttled (e.g. when
logging the stack in conjunction with a crash).

MXS_ALERT should only be used in a context where the process is known
to be going down, either via crash or explicit exit.
2016-09-30 10:44:59 +03:00
Markus Makela
e484aac6f0 Use CLOCK_MONOTONIC instead of CLOCK_MONOTONIC_RAW
The CLOCK_MONOTONIC_RAW isn't supported on all of the platforms, namely
CentOS 5.
2016-09-22 10:09:25 +03:00