I'm using the Google glog logging system in my project. Specifically, I'm using the following types of statements at various places in my code:

```
#include <glog/logging.h>
CHECK_EQ(foo,bar) << "Generic error message";
LOG(ERROR) << "Generic error message";
LOG(FATAL) << "Generic error message";

```

This logging system is important in helping me to stage and verify my code. However, sometimes I farm out production runs of my code to a larger server. This large production server doesn't have the logging system. (I've tried to build the logging system on this production server, but have run into problems.)

So, working on the assumption that I *cannot* use the logging system on the production server, how can I configure things so that the logging commands are inactive on the server?

---

Attempting to solve this problem myself before asking on SO, I tried the following...

In an existing header file named "globals.h" I defined:

```
#ifdef NOGLOG
    #define MYLOG(i,m) std::cerr << #i << ": " << m
#else
    #include <glog/logging.h>
    #define MYLOG(i,m) LOG(i) << m
#endif

```

Then, I can replace code like `LOG(ERROR) << "ab" << x << "cd"` with `MYLOG(ERROR,"ab" << x << "cd")`. Then, when I build with a command like `make all CUSTOM="-DNOGLOG"`, where my gcc compile statements are set up with a variable named `$(CUSTOM)`, the glog statements will not get compiled, but instead simple `std::cerr` statements will get compiled.

I ran into two problems with this approach: (1) I could not figure out how to get the Eclipse IDE to insert `$(CUSTOM)` into the gcc compile statements in the makefile that Eclipse generates; and (2) putting the `#include <glog/logging.h>` statement inside the `#else` body caused lots of error messages like the one below.

```
In file included from /usr/include/errno.h:36,
                 from /usr/local/include/glog/logging.h:39,
                 from ../globals.h:23,
                 from ../COMPASS.h:11,
                 from ../COMPASS.cpp:13:
/usr/include/bits/errno.h: In function 'int* __errno_location()':
/usr/include/bits/errno.h:43: error: expected primary-expression before ',' token

```

**Note:** For the time being, I just commented-out the `CHECK_EQ` calls, with the thinking that once I figure out how to fix this problem with respect to the `LOG` calls, I should be able to easily extend the solution to the `CHECK_EQ` calls.