Verbose control

54 views
Skip to first unread message

Mateus Pelicer

unread,
Dec 7, 2023, 2:54:56 PM12/7/23
to Ceres Solver
Hi, 

I am trying to control the output Ceres shows when there are errors. 

I am starting glog with google::InitGoogleLogging(argv[0]); 

and then I define, where I'm testing the output.

class custom_solver_verbose : public google::LogSink {
public:

custom_solver_verbose() : debug(false) {};

virtual void send(google::LogSeverity severity, const char* full_filename,
const char* base_filename, int line,
const struct ::tm* tm_time,
const char* message, size_t message_len) override {
(void )full_filename;
(void )base_filename;
(void )line;
(void )tm_time;

std::string msg(message, message_len);
if (msg.find("Error in evaluating the ResidualBlock") != std::string::npos && !debug) {
return; // Ignore this specific message.
}

if (msg.find("Residual and Jacobian evaluation failed") != std::string::npos && !debug) {
return; // Ignore this specific message.
}
//
// // Log other messages as normal (example: to stderr).
std::cerr << "Custom Log: [" << severity << "] " << msg << std::endl;
}

void setup_verbose(bool debug){
this->debug=debug;
}

private:
bool debug;
};

This has worked until now, but when I have the output:
"E1207 14:42:26.501088 151361 trust_region_minimizer.cc:73] Terminating: Residual and Jacobian evaluation failed." I was unable to 'mute' it.

Is there any way to silence this output? Or to output it into a log file instead of the terminal?

Thanks.

Sameer Agarwal

unread,
Dec 7, 2023, 8:57:45 PM12/7/23
to ceres-...@googlegroups.com
Hi Mateus,

"E1207 14:42:26.501088 151361 trust_region_minimizer.cc:73] Terminating: Residual and Jacobian evaluation failed."

is generated by a 

LOG(ERROR) << "Terminating: Residual and Jacobian evaluation failed."

statement. So if your sink can grab messages at the error level you should be able to silence it.
Sameer



--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/97c9ff50-c211-4daf-8876-9452e1156ad3n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages