Log file mosquitto server

Hello, I’m using mosquitto as mqtt server.
Can I access logging file to ensure when my esp8266 not connected to the server?

Big Thanks for help

You can or you can monitor the topic.

Yes It is, but I use code from “ItKindaWorks” channel in youtube that create debug when not connected to server.

void reconnect() {

  //attempt to connect to the wifi if connection is lost
  if(WiFi.status() != WL_CONNECTED){
    //debug printing
    Serial.print("Connecting to ");
    Serial.println(ssid);

    //loop while we wait for connection
    while (WiFi.status() != WL_CONNECTED) {
      delay(500);
      Serial.print(".");
    }

    //print out some more debug once connected
    Serial.println("");
    Serial.println("WiFi connected");  
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
  }

  //make sure we are connected to WIFI before attemping to reconnect to MQTT
  if(WiFi.status() == WL_CONNECTED){
  // Loop until we're reconnected to the MQTT server
    while (!client.connected()) {
      Serial.print("Attempting MQTT connection...");

      // Generate client name based on MAC address and last 8 bits of microsecond counter
      String clientName;
      clientName += "esp8266-";
      uint8_t mac[6];
      WiFi.macAddress(mac);
      clientName += macToStr(mac);

      //if connected, subscribe to the topic(s) we want to be notified about
      if (client.connect((char*) clientName.c_str())) {
        Serial.print("\tMTQQ Connected");
        client.subscribe(topikLampu1);
        client.subscribe(topikLampu2);
        client.subscribe(topikLampu3);
      }

      //otherwise print failed for debugging
      else{Serial.println("\tFailed."); abort();}
    }
  }

For my case, I’m putting my esp in a metal box so maybe it causing “faraday cage”.
But I must ensure that my esp didnt get any wifi signal through the logging file, and I stuck where the logging file it is.

Looks like your want to get the debug details from your ESP8622. Those debug messages go to the serial interface. This means that you only get them if you are connected to a host’s serial interface.

Is it means I must connect esp to my laptop and see debug detail through and app(ex. NodeMCU) ?

It solved, I connected esp to laptop and open arduino screen monitor. For the result, I can get status of esp,either it connected to wifi or not
Thanks.