DLT logging is now configurable at runtime with log_dest dlt
.
Closes #1735. Thanks to Brian Orpin.
This commit is contained in:
parent
8d54aaef89
commit
2e32634a95
@ -10,6 +10,8 @@ Broker:
|
||||
being false.
|
||||
- Allow MQTT v5.0 outgoing bridges to fall back to MQTT v3.1.1 if connecting
|
||||
to a v3.x only broker.
|
||||
- DLT logging is now configurable at runtime with `log_dest dlt`.
|
||||
Closes #1735.
|
||||
|
||||
Client library:
|
||||
- Client no longer generates random client ids for v3.1.1 clients, these are
|
||||
|
@ -458,7 +458,8 @@ D.conf
|
||||
<para>Send log messages to a particular destination.
|
||||
Possible destinations are: <option>stdout</option>
|
||||
<option>stderr</option> <option>syslog</option>
|
||||
<option>topic</option>.</para>
|
||||
<option>topic</option> <option>file</option>
|
||||
<option>dlt</option>.</para>
|
||||
<para><option>stdout</option> and
|
||||
<option>stderr</option> log to the console on the
|
||||
named output.</para>
|
||||
@ -478,6 +479,10 @@ D.conf
|
||||
will be closed and reopened when the broker receives a
|
||||
HUP signal. Only a single file destination may be
|
||||
configured.</para>
|
||||
<para>The <option>dlt</option> destination is for the
|
||||
automotive `Diagnostic Log and Trace` tool. This
|
||||
requires that Mosquitto has been compiled with DLT
|
||||
support.</para>
|
||||
<para>Use "log_dest none" if you wish to disable logging.
|
||||
Defaults to stderr. This option may be specified
|
||||
multiple times.</para>
|
||||
|
@ -586,7 +586,7 @@
|
||||
|
||||
# Places to log to. Use multiple log_dest lines for multiple
|
||||
# logging destinations.
|
||||
# Possible destinations are: stdout stderr syslog topic file
|
||||
# Possible destinations are: stdout stderr syslog topic file dlt
|
||||
#
|
||||
# stdout and stderr log to the console on the named output.
|
||||
#
|
||||
@ -604,6 +604,9 @@
|
||||
# closed and reopened when the broker receives a HUP signal. Only a single file
|
||||
# destination may be configured.
|
||||
#
|
||||
# The dlt destination is for the automotive `Diagnostic Log and Trace` tool.
|
||||
# This requires that Mosquitto has been compiled with DLT support.
|
||||
#
|
||||
# Note that if the broker is running as a Windows service it will default to
|
||||
# "log_dest none" and neither stdout nor stderr logging is available.
|
||||
# Use "log_dest none" if you wish to disable logging.
|
||||
|
@ -177,7 +177,7 @@ static void config__init_reload(struct mosquitto_db *db, struct mosquitto__confi
|
||||
}
|
||||
#else
|
||||
config->log_facility = LOG_DAEMON;
|
||||
config->log_dest = MQTT3_LOG_STDERR;
|
||||
config->log_dest = MQTT3_LOG_STDERR | MQTT3_LOG_DLT;
|
||||
if(db->verbose){
|
||||
config->log_type = UINT_MAX;
|
||||
}else{
|
||||
@ -1511,6 +1511,8 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
||||
cr->log_dest |= MQTT3_LOG_STDERR;
|
||||
}else if(!strcmp(token, "topic")){
|
||||
cr->log_dest |= MQTT3_LOG_TOPIC;
|
||||
}else if(!strcmp(token, "dlt")){
|
||||
cr->log_dest |= MQTT3_LOG_DLT;
|
||||
}else if(!strcmp(token, "file")){
|
||||
cr->log_dest |= MQTT3_LOG_FILE;
|
||||
if(config->log_fptr || config->log_file){
|
||||
|
@ -119,8 +119,10 @@ int log__init(struct mosquitto__config *config)
|
||||
restore_privileges();
|
||||
}
|
||||
#ifdef WITH_DLT
|
||||
DLT_REGISTER_APP("MQTT","mosquitto log");
|
||||
dlt_register_context(&dltContext, "MQTT", "mosquitto DLT context");
|
||||
if(log_destinations & MQTT3_LOG_DLT){
|
||||
DLT_REGISTER_APP("MQTT","mosquitto log");
|
||||
dlt_register_context(&dltContext, "MQTT", "mosquitto DLT context");
|
||||
}
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
@ -142,8 +144,10 @@ int log__close(struct mosquitto__config *config)
|
||||
}
|
||||
|
||||
#ifdef WITH_DLT
|
||||
dlt_unregister_context(&dltContext);
|
||||
DLT_UNREGISTER_APP();
|
||||
if(log_destinations & MQTT3_LOG_DLT){
|
||||
dlt_unregister_context(&dltContext);
|
||||
DLT_UNREGISTER_APP();
|
||||
}
|
||||
#endif
|
||||
/* FIXME - do something for all destinations! */
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
@ -347,7 +351,7 @@ int log__vprintf(int priority, const char *fmt, va_list va)
|
||||
}
|
||||
}
|
||||
#ifdef WITH_DLT
|
||||
if(priority != MOSQ_LOG_INTERNAL){
|
||||
if(log_destinations & MQTT3_LOG_DLT && priority != MOSQ_LOG_INTERNAL){
|
||||
DLT_LOG_STRING(dltContext, get_dlt_level(priority), s);
|
||||
}
|
||||
#endif
|
||||
|
@ -70,6 +70,7 @@ Contributors:
|
||||
#define MQTT3_LOG_STDOUT 0x04
|
||||
#define MQTT3_LOG_STDERR 0x08
|
||||
#define MQTT3_LOG_TOPIC 0x10
|
||||
#define MQTT3_LOG_DLT 0x20
|
||||
#define MQTT3_LOG_ALL 0xFF
|
||||
|
||||
#define WEBSOCKET_CLIENT -2
|
||||
|
Loading…
Reference in New Issue
Block a user