c++loggingceres-solver

Suppress ceres logging on console


Below is a dummy snippet for computing covariance in ceres-solver

    ceres::Covariance::Options covarianceOptions;
    covarianceOptions.algorithm_type = ceres::SPARSE_QR;
    ceres::Covariance covarianceComputation(covarianceOptions);
    
    if( not covarianceComputation.Compute(paramBlocks, ceresProblem) ) {
        // do stuff
    }
    else {
        // return
    }

When the ceresProblem is not proper, covariance calculation may fail based on algorithm_type. For example, the following error maybe displayed on console.

E0629 13:44:55.121646  9832 covariance_impl.cc:669] Jacobian matrix is rank deficient. Number of columns: 1204 rank: 1118

How can this console output / logging be suppressed? How to modify logging levels in ceres?


Related question: Ceres Solver: unable to disable logging (google glog), but does not address the above.


Solution

  • Setting the following environment variables would suppress logging in ceres:

    GLOG_logtostderr=1
    GLOG_stderrthreshold=3
    GLOG_minloglevel=3
    GLOG_v=-3
    

    Reference: http://rpg.ifi.uzh.ch/docs/glog.html