B4J Question MQTT Broker DebugLog

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I am using the MQTT broker in my B4J app.

I tried version 1 of the broker and then moved to version 2 (v2.02) but I am getting the same result as per below.

I am running the code:

B4X:
broker.Initialize("", 51041) 'first parameter is the event name. It is currently not used.
   broker.DebugLog = False
   broker.SetUserAndPassword("mqtt","password")
   broker.Start

I then got my Android app to connect to my B4J broker and it connected etc. However I am seeing the debug log in the logs in my B4J app.

Is there a way in stopping the MQTT logs from displaying ?

I have tried running my B4J app in the IDE in debug mode and release mode but with the same result.

If I set the DebugLog as True then I am seeing the same events in the log, so it seems that the DebugLog value is being ignored from what I can tell, unless I am doing something wrong somewhere ?

2024-02-26 15:58:53.805:INFO :imb.Server:main: Configuring message interceptors...
2024-02-26 15:58:53.806:INFO :imi.BrokerInterceptor:main: Initializing broker interceptor. InterceptorIds=[]
2024-02-26 15:58:53.808:INFO :imb.Server:main: Using default SSL context creator
2024-02-26 15:58:53.809:INFO :imb.Server:main: Invoking constructor with io.moquette.broker.config.IConfig argument. ClassName=anywheresoftware.b4j.objects.MqttBroker$B4XAuthenticator, interfaceName=io.moquette.broker.security.IAuthenticator
2024-02-26 15:58:53.809:INFO :imb.Server:main: Authorizator policy io.moquette.broker.security.PermitAllAuthorizatorPolicy instance will be used
2024-02-26 15:58:53.810:INFO :imbs.CTrieSubscriptionDirectory:main: Initializing CTrie
2024-02-26 15:58:53.811:INFO :imbs.CTrieSubscriptionDirectory:main: Initializing subscriptions store...
2024-02-26 15:58:53.830:INFO :imb.NewNettyAcceptor:main: Netty is using NIO
2024-02-26 15:58:53.926:INFO :imb.NewNettyAcceptor:main: Server bound to host=0.0.0.0, port=1883, protocol=TCP MQTT
2024-02-26 15:58:53.931:INFO :imb.NewNettyAcceptor:main: Property websocket_port has been setted to disabled. Websocket MQTT will be disabled
2024-02-26 15:58:53.931:INFO :imb.Server:main: Moquette integration has been started successfully in 126 ms
2024-02-26 15:58:58.288:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C->B CONNECT <null>
2024-02-26 15:58:58.324:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708923538257_2.083763E8> packetID <1>
2024-02-26 15:59:03.441:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708923538257_2.083763E8> packetID <2>
2024-02-26 15:59:08.467:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708923538257_2.083763E8> packetID <3>
2024-02-26 15:59:13.475:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708923538257_2.083763E8> packetID <4>
2024-02-26 15:59:18.449:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708923538257_2.083763E8> packetID <5>
2024-02-26 15:59:23.510:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708923538257_2.083763E8> packetID <6>
2024-02-26 15:59:28.516:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708923538257_2.083763E8> packetID <7>
2024-02-26 15:59:33.551:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708923538257_2.083763E8> packetID <8>
2024-02-26 15:59:38.614:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708923538257_2.083763E8> packetID <9>
2024-02-26 15:59:43.630:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708923538257_2.083763E8> packetID <10>
2024-02-26 15:59:48.695:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708923538257_2.083763E8> packetID <11>
2024-02-26 15:59:53.677:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708923538257_2.083763E8> packetID <12>
 

teddybear

Well-Known Member
Licensed User
DebugLog works, try to clean project . redo that.
 
Last edited:
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
If I do 'tools > clean project' it still happens. The text is in red font.

I then created a brand new project, and added the broker etc and it hasn't happened.

I then rebooted the PC (as Windows kept prompting me to do an update) and I then ran the project again afterwards but it still shows the MQTT log, but my test project it didn't.

I have just re-created my project from the ground up (as it didn't have much code yet) and it seems to be OK after adding all the code again.
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
Now I am seeing the DebugLog again even knowing it's set to False. (this is the new project that was working last night)

I have cleaned the project etc, but still keeps displaying.

1708997353765.png


Waiting for debugger to connect...
Program started.
2024-02-27 12:28:22.866:INFO :imb.Server:main: Configuring message interceptors...
2024-02-27 12:28:22.871:INFO :imi.BrokerInterceptor:main: Initializing broker interceptor. InterceptorIds=[]
2024-02-27 12:28:22.873:INFO :imb.Server:main: Using default SSL context creator
2024-02-27 12:28:22.874:INFO :imb.Server:main: Invoking constructor with io.moquette.broker.config.IConfig argument. ClassName=anywheresoftware.b4j.objects.MqttBroker$B4XAuthenticator, interfaceName=io.moquette.broker.security.IAuthenticator
2024-02-27 12:28:22.875:INFO :imb.Server:main: Authorizator policy io.moquette.broker.security.PermitAllAuthorizatorPolicy instance will be used
2024-02-27 12:28:22.876:INFO :imbs.CTrieSubscriptionDirectory:main: Initializing CTrie
2024-02-27 12:28:22.878:INFO :imbs.CTrieSubscriptionDirectory:main: Initializing subscriptions store...
2024-02-27 12:28:22.926:INFO :imb.NewNettyAcceptor:main: Netty is using NIO
2024-02-27 12:28:23.066:INFO :imb.NewNettyAcceptor:main: Server bound to host=0.0.0.0, port=1883, protocol=TCP MQTT
2024-02-27 12:28:23.074:INFO :imb.NewNettyAcceptor:main: Property websocket_port has been setted to disabled. Websocket MQTT will be disabled
2024-02-27 12:28:23.074:INFO :imb.Server:main: Moquette integration has been started successfully in 211 ms
2024-02-27 12:28:25.824:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C->B CONNECT <null>
2024-02-27 12:28:25.857:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708997304820_7.13587306E8> packetID <1>
2024-02-27 12:28:30.978:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708997304820_7.13587306E8> packetID <2>
2024-02-27 12:28:35.995:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708997304820_7.13587306E8> packetID <3>
2024-02-27 12:28:41.012:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708997304820_7.13587306E8> packetID <4>
2024-02-27 12:28:46.030:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708997304820_7.13587306E8> packetID <5>
2024-02-27 12:28:51.045:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708997304820_7.13587306E8> packetID <6>
2024-02-27 12:28:56.053:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708997304820_7.13587306E8> packetID <7>
2024-02-27 12:29:01.184:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708997304820_7.13587306E8> packetID <8>
2024-02-27 12:29:06.203:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708997304820_7.13587306E8> packetID <9>
2024-02-27 12:29:11.222:INFO :imbm.MQTTMessageLogger:nioEventLoopGroup-3-1: C<-B PUBACK <mqtt_android_1708997304820_7.13587306E8> packetID <10>
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Try to run java -jar your.jar on cmd mode, see whether the log appears
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
Just tried in cmd and it still logs those events even knowing debuglog is set to false.
 
Upvote 0
Top