[gdal-dev] Redirect CPLDebug output?

Jim Pendleton jimp at ittvis.com
Thu Sep 8 14:37:31 EDT 2011


Frank Warmerdam <warmerdam <at> pobox.com> writes:

> On 11-09-08 07:48 AM, Jim Pendleton wrote:
> > Is there any model for redirecting CPLDebug output from stdout to an
> > alternative path?
> 
> There is no need to overwrite the high level CPLError and CPLDebug
functions.
> Instead install a handler for the messages with CPLSetErrorHandler().

That was the information I needed.

For the sake of expediency, I've ifdef'ed __android_log_print() calls
adjacent to the printf() statements in the existing
CPLDefaultErrorHandler rather than duplicating the code and adding
another source file to the build.

If I eventually proceed the approved GDAL development way is there a
standard place to call CPLSetErrorHandler() when loading GDAL as a
library?  Since I'm running in Java, I wouldn't necessarily have a
pointer to my C++ function at runtime without some extra hackery (and
there's no SWIG binding presently for that routine, regardless.)

I would like to perturb as little of the original GDAL source as
possible.

If only there existed a gdal.SetConfigOption interface for
CPLSetErrorHandler() that would allow me to pass an entry point name
instead of a function pointer...

Thanks for your help,
Jim P.


More information about the gdal-dev mailing list