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.
Some log manager refactoring to make it easier to later remove
all files but the error log.
Basically all that was done was to move everything inside the
for-loop of thr_filewriter_fun into a separate function called
thr_flush_file. Otherwise no changes in functionality was made.
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.