logmanager_write_log did three different things - logged a message,
flushed a file and rotated a file - none of which were performed
in one go. Hence there's no reason to do all those things in that
function.
Another step on the road of log manager modifications.
- All messages are now logged to error.log. The other files are
still created but not used anymore.
- A severity prefix is added, to distinguish between messages logged
to "different" files:
LOGFILE_ERROR => "[Error]: "
LOGFILE_MESSAGE => "[Notice]: "
LOGFILE_TRACE => "[Info]: "
LOGFILE_DEBUG => "[Debug] "
That prefix is not written to syslog.
- When maxscale is built in debug mode, trace and debug messages
are no longer enabled by default.
Next step is to remove the other files entirelly.
There were many combinations of tab-width used so making the
indentation look right in the editor wasn't really possible.
The changes made:
- All tabs replaced with spaces.
- Indentation depth 4.
- , followed by space.
- Most binary operators (*, =, -) surrounded by one space.
- No space following ( or before ).
- Keywords follwed by 1 space.
Added *'s for consistency
Added monitor_interval to prevent warning in error log
Reworded default cnf location to make it a little easier to read
Typo in log location
Valist is handled before logmanager_write_log is called. So it
is quite unnecessary to always having to pass a valist whether
it is used or not (and not it is never used).
Augmentation moved to skygw_log_write_context. The severity prefix
will be added there as well. If all is done on that level, the
amount of memory needed can be figured out in one go. No need to
allocate and copy the message several times.
This commit is only to introduce new logging macros.
The current implementation is such that a statement like:
MAXSCALE_NOTICE("Refreshing configuration following SIGHUP\n");
is equivalent with
LOGIF(LM, (skygw_log_write(
LOGFILE_MESSAGE,
"Refreshing configuration following SIGHUP\n")));
The actual implementation will later be changed as the logging
mechanism itself is changed.
The names of the macros are now according to the levels of syslog
and currently the mapping is like:
MAXSCALE_ERROR (Syslog LOG_ERR) -> LOGFILE_ERROR
MAXSCALE_WARNING (Syslog LOG_WARNING) -> LOGFILE_ERROR
MAXSCALE_NOTICE (Syslof LOG_NOTICE) -> LOGFILE_MESSAGE
MAXSCALE_INFO (Syslog LOG_INFO) -> LOGFILE_TRACE
MAXSCALE_DEBUG (Syslog LOG_DEBUG) -> LOGFILE_DEBUG
When log manager is changed to deal "natively" with syslog levels
this mapping will disappear of course.
Template config file is copied as maxscale.cnf if no configuration file is found.
If /etc/maxscale.cnf is not found, the /etc/maxscale.cnf.template will be copied as /etc/maxscale.cnf.
This allows MaxScale to start right after installation if combined with a running and properly configured server.