Logging

800 views
Skip to first unread message

Deane Yang

unread,
Mar 16, 2016, 3:57:13 PM3/16/16
to ceres-...@googlegroups.com
When I use the solver in a command-line program, it seems to send at least some error/warning messages to STDERR/STDOUT, even if I have set logging_type to SILENT. Is this to be expected? Is there any way to turn *all* messages off?

Sameer Agarwal

unread,
Mar 16, 2016, 5:20:00 PM3/16/16
to ceres-...@googlegroups.com
that only applies to the trust region solver.
you are likely using miniglog.
I recommend using the real glog, or there is a compiler define inside miniglog to silence it completely.

On Wed, Mar 16, 2016 at 12:57 PM Deane Yang <dean...@gmail.com> wrote:
When I use the solver in a command-line program, it seems to send at least some error/warning messages to STDERR/STDOUT, even if I have set logging_type to SILENT. Is this to be expected? Is there any way to turn *all* messages off?

--
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/CAN3bFHMajFoXY3tQ8PnC3CqgSyeKFd7r%3DqGMZ5jJn%2BQg8bcriw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Deane Yang

unread,
Mar 17, 2016, 10:30:42 AM3/17/16
to Ceres Solver
Thanks. I thought I had built the OSX static library using glog. Is there any way to check which logging software I'm using? When I check the symbols using nm I see:

U __ZN6google10LogMessage6streamEv

                 U __ZN6google15LogMessageFatalC1EPKci

                 U __ZN6google15LogMessageFatalC1EPKciRKNS_13CheckOpStringE

                 U __ZN6google15LogMessageFatalD1Ev

0000000000002f40 S __ZN6google17MakeCheckOpStringIiiEEPNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_RKT0_PKc

                 U __ZN6google4base21CheckOpMessageBuilder7ForVar2Ev

                 U __ZN6google4base21CheckOpMessageBuilder9NewStringEv

                 U __ZN6google4base21CheckOpMessageBuilderC1EPKc

                 U __ZN6google4base21CheckOpMessageBuilderD1Ev

Sameer Agarwal

unread,
Mar 17, 2016, 10:32:49 AM3/17/16
to Ceres Solver
that looks about right.
what messages are you seeing? if you do not have -logtostderr enabled, you should not see anything from the solver on stdout or stderr.

Deane Yang

unread,
Mar 17, 2016, 10:52:06 AM3/17/16
to Ceres Solver
Just tried some examples and am not seeing the messages. I'll post again, if I see it again and paste the messages produced. Thanks for the quick responses.

Deane Yang

unread,
Mar 17, 2016, 12:30:05 PM3/17/16
to ceres-...@googlegroups.com
Here is the kind of message I get:

WARNING: Logging before InitGoogleLogging() is written to STDERR
W0317 12:22:28.431686 1985463040 residual_block.cc:130] 

Error in evaluating the ResidualBlock.

There are two possible reasons. Either the CostFunction did not evaluate and fill all    
residual and jacobians that were requested or there was a non-finite value (nan/infinite)
generated during the or jacobian computation. 

Residual Block size: 1 parameter blocks x 1 residuals

For each parameter block, the value of the parameters are printed in the first column   
and the value of the jacobian under the corresponding residual. If a ParameterBlock was 
held constant then the corresponding jacobian is printed as 'Not Computed'. If an entry 
of the Jacobian/residual array was requested but was not written to by user code, it is 
indicated by 'Uninitialized'. This is an error. Residuals or Jacobian values evaluating 
to Inf or NaN is also an error.  

Residuals:              nan 

Parameter Block 0, size: 5

           0 |          nan 
           0 |          nan 
           0 |          nan 
           0 |          nan 
           0 |          nan 

I do want to see these messages when working on the code, but not when it gets released.


--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/6e91gKP8DC8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/dea4c790-b2df-48b5-8f82-d029660fc4ff%40googlegroups.com.

Sameer Agarwal

unread,
Mar 17, 2016, 12:58:36 PM3/17/16
to ceres-...@googlegroups.com
two things.
1. the first message has do with calling initialization code which you should in your main program before using glog for the first time. you can find example code in ceres examples.

That should give you fine scale control over your errors.

two, the error you are seeing is serious and should likely be visible to you and others using your software, though it can be confusing.
Sameer


Deane Yang

unread,
Mar 18, 2016, 12:56:36 PM3/18/16
to ceres-...@googlegroups.com
Many thanks for the answers, especially the initialization of the logging. Somehow I missed that.

Keir Mierle

unread,
Apr 11, 2016, 11:36:11 PM4/11/16
to ceres-...@googlegroups.com
Sorry to resurrect this thread. Deane, were you able to figure out the issues with your cost function? If the error message above was not clear to you, I'd like to update it. The message is supposed to speak directly to the Ceres user and tell they made a bug :)

Deane Yang

unread,
Apr 12, 2016, 8:11:12 AM4/12/16
to ceres-...@googlegroups.com
Keir,

The error message about evaluating the Residual Block is essentially fine, and I was able to resolve the issue. It was the warning about initializing glog that I did not understand. Here, the message doesn't tell me much, and there is nothing in the documentation about the need to do the initialization. It's easy to overlook in the sample code. I think just putting a comment just before the "google::InitGoogleLogging(argv[0]);", explaining the need for it, would suffice.

Best,
Deane


Deane Yang

unread,
Apr 12, 2016, 8:15:24 AM4/12/16
to ceres-...@googlegroups.com
Also, perhaps there could be a little more explanation of what can be controlled by the logging options and what will still be sent to std::cout/std::cerr, even if logging is set to SILENT.

I also would still prefer an option to not send anything at all to std::cout/std::cerr. If I pass a library using ceres to someone else, who builds an executable using it, they will see this output, even if they don't want to. The error I posted was a serious one, but there are others that are essentially warnings and can be ignored.


Deane Yang

unread,
May 20, 2016, 1:46:07 PM5/20/16
to Ceres Solver
I'd still like to suppress logging to std::cout and std::cerr. Is there any way to redirect the logging output to something besides std::cerr without redirecting std::cerr itself?

Sameer Agarwal

unread,
May 20, 2016, 2:43:56 PM5/20/16
to Ceres Solver
Deane, there may be a way of telling glog not to log. I recommend looking at the google-glog documentation/api.

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.
Reply all
Reply to author
Forward
0 new messages