我有一个以前的问题,为了更接近解决方案,我想在 Windows 7 上启用 Mosquitto 代理登录。
最初我手动启动了代理,如下所示:
mosquitto -p 1883 -v
-v
表示详细的控制台日志记录。但这并没有提供足够的信息,只有在遇到我的问题时才提供以下行:
1486293976: Socket error on client <unknown>, disconnecting.
我已尝试执行此答案中描述的操作。这是配置文件的日志记录部分:
# 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.
log_dest stdout
# If using syslog logging (not on Windows), messages will be logged to the
# "daemon" facility by default. Use the log_facility option to choose which of
# local0 to local7 to log to instead. The option value should be an integer
# value, e.g. "log_facility 5" to use local5.
#log_facility
# Types of messages to log. Use multiple log_type lines for logging
# multiple types of messages.
# Possible types are: debug, error, warning, notice, information,
# none, subscribe, unsubscribe, websockets, all.
# Note that debug type messages are for decoding the incoming/outgoing
# network packets. They are not logged in "topics".
log_type error
log_type warning
log_type notice
log_type information
# Change the websockets logging level. This is a global option, it is not
# possible to set per listener. This is an integer that is interpreted by
# libwebsockets as a bit mask for its lws_log_levels enum. See the
# libwebsockets documentation for more details. "log_type websockets" must also
# be enabled.
#websockets_log_level 0
# If set to true, client connection and disconnection messages will be included
# in the log.
connection_messages true
# If set to true, add a timestamp value to each log message.
log_timestamp true
在这种情况下,我按如下方式启动了代理:
mosquitto -p 1883
-v
选项将使用默认配置覆盖配置文件,所以我忽略了它。但是我在控制台上看不到日志记录。
而不是stdout
我尝试登录到一个文件,并更改配置如下:
log_dest file d:\mosquitto.txt
我手动创建了该文件并以相同的方式启动了代理,但无济于事。
如果我不使用该-v
选项,则不会收到任何日志消息。应该如何正确操作?