Hello,
I am using the HTTPCLIENT Library with a Redbear Duo. I would like to activate the logging function available via #ifdef in the library. I have included a #define LOGGING statement in in my code but the compiler never includes the LOGGING feature. I have tried with and without #pragma SPARK_NO_PREPROCESSOR and I have tried on a Photon as well to no avail. The serial LOGGING messages are not forthcoming and the size of my compiled program doesn’t change either. I am using the Web IDE.
Previous forum messages seem to suggest this should be a simple thing to do but obviously I have found a unique way to make this fail. 
My serial is working as I am getting my usual messages. I am using USB serial, not serial1, at 115200 if this makes a difference.
Thanks in advance for your help,
Joerg
@Jseiler, you need to do the #define before the #include of the HTTPClient library. Did you do that?
Just tried that now and still no logging going on. Code size remains the same too. 
This is what I have
#pragma SPARK_NO_PREPROCESSOR
#include "OneWire/OneWire.h"
#define LOGGING
#include "HttpClient/HttpClient.h"
#include "application.h"
Just in case it helps to test what I’m doing wrong I’ve condensed my code to a very basic version of the complete code and am testing this to compile on a photon with no luck. Logging doesn’t seem to activate. Serial works but no logging info.
// This #include statement was automatically added by the Particle IDE.
#define LOGGING
#include "HttpClient/HttpClient.h"
#define VARIABLE_ID "######################" //Temperature
#define TOKEN "##############################"
HttpClient http;
// Headers currently need to be set at init, useful for API keys etc.
http_header_t headers[] = {
{ "Content-Type", "application/json" },
{ NULL, NULL } // NOTE: Always terminate headers will NULL
};
http_request_t request;
http_response_t response;
int Ubi_Timer;
int data_Counter=0;
void setup() {
request.hostname = "things.ubidots.com";
request.port = 80;
Ubi_Timer = 0;
Serial.begin(115200);
}
void loop(void) {
if (millis()-Ubi_Timer>60000) {
data_Counter++;
Serial.print("Data counter = ");
Serial.println(data_Counter);
Ubi_Timer=millis();
request.path = "/api/v1.6/variables/"VARIABLE_ID"/values?token="TOKEN;
request.body = "{\"value\":" + String(data_Counter) + "}";
// Post request
http.post(request, response, headers);
}
}
With or without the #define LOGGING I get the following results,
Output of arm-none-eabi-size:
text data bss dec hex
8924 128 2780 11832 2
In a nutshell:
Flash used 9052 / 110592 8.2 %
RAM used 2908 / 20480 14.2 %
Funny, I just hit this. Every HTTP POST throws an error: [wiring] ERROR: recv error = 128. Turning LOGGING on seems like the next step to get a better understanding of what is going on, but it has no impact on the serial output.
#define LOGGING
#include "Particle.h"
#include <DS18B20.h>
#include <math.h>
#include <HttpClient.h>
// Set up HTTP
HttpClient http;
Not sure which module that #define LOGGING
should effect, but it won’t effect any other .cpp
file than the one you have it in.
Unless the implementation of the code you want to “control” with that define is in the same module (e.g. inside the main code or the actual code in one of the .h
files) it won’t have the effect you intend.
Thanks for confirming. So using the web IDE, when we include a library into our project (HttpClient in this case), do we have the ability to edit our copy of the contributed library files? Maybe this is a good time to consider the Workbench?