|
@@ -118,6 +118,8 @@ static char *format_buffer=NULL;
|
|
|
|
|
|
|
|
static int logsys_thread_started = 0;
|
|
static int logsys_thread_started = 0;
|
|
|
|
|
|
|
|
|
|
+static int logsys_blackbox_enabled = 1;
|
|
|
|
|
+
|
|
|
static int _logsys_config_subsys_get_unlocked (const char *subsys)
|
|
static int _logsys_config_subsys_get_unlocked (const char *subsys)
|
|
|
{
|
|
{
|
|
|
unsigned int i;
|
|
unsigned int i;
|
|
@@ -308,7 +310,6 @@ int _logsys_system_setup(
|
|
|
int i;
|
|
int i;
|
|
|
int32_t fidx;
|
|
int32_t fidx;
|
|
|
char tempsubsys[LOGSYS_MAX_SUBSYS_NAMELEN];
|
|
char tempsubsys[LOGSYS_MAX_SUBSYS_NAMELEN];
|
|
|
- int blackbox_enable_res;
|
|
|
|
|
|
|
|
|
|
if ((mainsystem == NULL) ||
|
|
if ((mainsystem == NULL) ||
|
|
|
(strlen(mainsystem) >= LOGSYS_MAX_SUBSYS_NAMELEN)) {
|
|
(strlen(mainsystem) >= LOGSYS_MAX_SUBSYS_NAMELEN)) {
|
|
@@ -370,7 +371,12 @@ int _logsys_system_setup(
|
|
|
QB_LOG_FILTER_FILE, "*", LOG_TRACE);
|
|
QB_LOG_FILTER_FILE, "*", LOG_TRACE);
|
|
|
qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_SIZE, IPC_LOGSYS_SIZE);
|
|
qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_SIZE, IPC_LOGSYS_SIZE);
|
|
|
qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_THREADED, QB_FALSE);
|
|
qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_THREADED, QB_FALSE);
|
|
|
- blackbox_enable_res = qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_TRUE);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Blackbox is disabled at the init and enabled later based
|
|
|
|
|
+ * on config (logging.blackbox) value.
|
|
|
|
|
+ */
|
|
|
|
|
+ qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_FALSE);
|
|
|
|
|
|
|
|
if (logsys_format_set(NULL) == -1) {
|
|
if (logsys_format_set(NULL) == -1) {
|
|
|
return -1;
|
|
return -1;
|
|
@@ -396,14 +402,6 @@ int _logsys_system_setup(
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (blackbox_enable_res < 0) {
|
|
|
|
|
- LOGSYS_PERROR (-blackbox_enable_res, LOGSYS_LEVEL_WARNING,
|
|
|
|
|
- "Unable to initialize log flight recorder. "\
|
|
|
|
|
- "The most common cause of this error is " \
|
|
|
|
|
- "not enough space on /dev/shm. Corosync will continue work, " \
|
|
|
|
|
- "but blackbox will not be available");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
pthread_mutex_unlock (&logsys_config_mutex);
|
|
pthread_mutex_unlock (&logsys_config_mutex);
|
|
|
|
|
|
|
|
return (0);
|
|
return (0);
|
|
@@ -766,10 +764,26 @@ static void _logsys_config_apply_per_subsys(int32_t s)
|
|
|
logsys_loggers[s].dirty = QB_FALSE;
|
|
logsys_loggers[s].dirty = QB_FALSE;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static void _logsys_config_apply_blackbox(void) {
|
|
|
|
|
+ int blackbox_enable_res;
|
|
|
|
|
+
|
|
|
|
|
+ blackbox_enable_res = qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, logsys_blackbox_enabled);
|
|
|
|
|
+
|
|
|
|
|
+ if (blackbox_enable_res < 0) {
|
|
|
|
|
+ LOGSYS_PERROR (-blackbox_enable_res, LOGSYS_LEVEL_WARNING,
|
|
|
|
|
+ "Unable to initialize log flight recorder. "\
|
|
|
|
|
+ "The most common cause of this error is " \
|
|
|
|
|
+ "not enough space on /dev/shm. Corosync will continue work, " \
|
|
|
|
|
+ "but blackbox will not be available");
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void logsys_config_apply(void)
|
|
void logsys_config_apply(void)
|
|
|
{
|
|
{
|
|
|
int32_t s;
|
|
int32_t s;
|
|
|
|
|
|
|
|
|
|
+ _logsys_config_apply_blackbox();
|
|
|
|
|
+
|
|
|
for (s = 0; s <= LOGSYS_MAX_SUBSYS_COUNT; s++) {
|
|
for (s = 0; s <= LOGSYS_MAX_SUBSYS_COUNT; s++) {
|
|
|
if (strcmp(logsys_loggers[s].subsys, "") == 0) {
|
|
if (strcmp(logsys_loggers[s].subsys, "") == 0) {
|
|
|
continue;
|
|
continue;
|
|
@@ -837,3 +851,13 @@ int logsys_thread_start (void)
|
|
|
|
|
|
|
|
return (0);
|
|
return (0);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+void logsys_blackbox_set(int enable)
|
|
|
|
|
+{
|
|
|
|
|
+
|
|
|
|
|
+ pthread_mutex_lock (&logsys_config_mutex);
|
|
|
|
|
+
|
|
|
|
|
+ logsys_blackbox_enabled = enable;
|
|
|
|
|
+
|
|
|
|
|
+ pthread_mutex_unlock (&logsys_config_mutex);
|
|
|
|
|
+}
|