Back to Community
How to set the log level to Info

If I do a quick backtest, both info and debug prints. I want only info to print. How do I set the log level ?

4 responses

It seems we are restricted from coding "import logbook" thus we cannot write "log.level = logbook.INFO"

See also:

Currently, there isn't a way to filter which log levels are displayed. All logs are printed all the time. The different log levels simply print differently and are meant as an aid in viewing them. The logging functionality on the Quantopian platform has been modified from the standard logbook methods. This is to limit the data which could potentially be exported and done to be compliant with agreements Quantopian has in place with our data providers.


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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.

Dan, thank you for the explanation. I respect the Quantopian policy and understand the need to prevent the exportation of data (via the logging mechanism).

Since the log level is NOTSET, which allows every level, then any restriction, such as INFO, would be consistent with the Quantopian policy.

I would be grateful if Quantopian would consider allowing the log level to be more restrictive than the default.

Use Case Scenario: existing log statements, particularly, need to be disabled when not needed. This is due to the size constraint and slowness of scrolling. It is preferable to keep log statements 'live' in the code rather than comment them out. Once commented, the log statements are too easy to delete and too difficult to maintain (such as renaming variables). Changing from to log.debug() or log.trace(), with the threshold set to INFO, would achieve this.

Note: in other logging systems there are better ways to filter log content, such as the logger 'category' (to use the classic Log4J terminology). This would also be acceptable practise (on the Quantopian platform), but would involve an API change.

too many warn logs displayed, hard to find my own logs. It's a bug, not a policy.