in plugin/server_audit/server_audit.cc [1166:1204]
static int write_log(const char *message, size_t len, int take_lock)
{
int result= 0;
if (take_lock)
{
/* Start by taking a read lock */
mysql_prlock_rdlock(&lock_operations);
}
if (output_type == OUTPUT_FILE)
{
if (logfile)
{
my_bool allow_rotate= !take_lock; /* Allow rotate if caller write lock */
if (take_lock && logger_time_to_rotate(logfile))
{
/* We have to rotate the log, change above read lock to write lock */
mysql_prlock_unlock(&lock_operations);
mysql_prlock_wrlock(&lock_operations);
allow_rotate= 1;
}
if (!(is_active= (logger_write_r(logfile, allow_rotate, message, len) ==
(int) len)))
{
++log_write_failures;
result= 1;
}
}
}
else if (output_type == OUTPUT_SYSLOG)
{
syslog(syslog_facility_codes[syslog_facility] |
syslog_priority_codes[syslog_priority],
"%s %.*s", syslog_info, (int) len, message);
}
if (take_lock)
mysql_prlock_unlock(&lock_operations);
return result;
}