[gdal-dev] Suppressing GDAL error output globally/by default in a Java application

Even Rouault even.rouault at mines-paris.org
Mon Feb 25 09:48:45 PST 2013


Le lundi 25 février 2013 17:11:41, Stefan Moebius a écrit :
> Hi,
> 
> I'm using GDAL (1.7.3) from within JBoss. Having GDAL report errors to
> stderr obviously isn't that helpful in such an environment.
> 
> Now I found that in native code, I could just call CPLSetErrorHandler() to
> get rid of this issue. However, in Java, there only seems to be
> PushErrorHandler(), which is documented as being thread-local.
> 
> How can I suppress error output globally (or by default) from Java?
> Is there an option I could set after initializing GDAL?

I've just added gdal.SetErrorHandler(java.lang.String) for GDAL 1.10 ( see 
http://gdal.org/java/org/gdal/gdal/gdal.html#SetErrorHandler%28java.lang.String%29 
)

Otherwise on Unix systems, you can define the CPL_LOG environment variable to 
/dev/null (on Windows to NUL) (should also be doable with 
gdal.SetConfigOption("CPL_LOG", "/dev/null") provided you call it very early, 
i.e. before the first GDAL error emitted )

> 
> Regards,
> Stefan
> Actix is the trading name of Actix Limited, with registered offices at:
> 200 Hammersmith Road, London, W6 7DL, United Kingdom.
> Actix Limited is registered in England and Wales with company no.
> 02660615 and VAT no. GB 858742087. Managing Director of Actix Limited: Bill
> McHale.
> 
> Actix GmbH is registered in (Sitz der Gesellschaft): Dresden, Germany with
> company no. Handelsregister Amtsgericht Dresden HR B 19204 and VAT no.
> (Ust-IDNr.) DE 813 115 475. Managing
> Director of Actix GmbH (Geschaeftsfuehrer): Bill McHale.
> 
> Information in this message is confidential and may be legally
> privileged. If you are not the intended recipient, please notify the
> sender, and please delete the message from your system
> immediately.  The statements and opinions expressed in this
> message are those of the author and do not necessarily reflect
> those of Actix.
> 
> Whilst Actix takes every effort to ensure this message is virus
> free it cannot guarantee that this is the case. It is the
> recipient's responsibility to carry out such virus checks as
> it deems necessary
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list