Hi all;
Because the logs only display if a backtest completes, I am trying to write some debugging information to the console. I understand that the console does throttle output to avoid overwhelming the browser.
I have the following code:
public class LanikaiQCAlgorithm : QCAlgorithm
{
// ...
public override void Initialize()
{
this.Debug("hello\n");
Console.WriteLine("hi");
// ...
Neither hello or hi is written to the Console. As this is the very first output when running the program, it can't be throttled. So why is it not showing in the console?
Note: This back test is not completing (don't know if the server is just slow or I have an infinite loop - that's why I need this output).
thanks - dave
David Thielen
Ok, once the algo completes then the output to the console is written. Unfortunately if the algo dies part way through or is killed in the debugger, or is stuck in an infinite loop - then you don't get that console output.
So you might as well use Log() as console output faces the same limitation on when it is written.
Fred Painchaud
Hi David,
Yes, currently, the data is written as the algo runs and once it stops normally, data is gathered and sent to the browser. It might be different with the new VSCode integration.
self.Debug() does not print the same message twice.
self.Log() does.
FYI
Fred
David Thielen
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!