adafruit_logging gives no output

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Elektrix
 
Posts: 19
Joined: Wed Dec 26, 2018 6:11 am

adafruit_logging gives no output

Post by Elektrix »

Hello all,

I have a ItsyBitsy M0 Express with CircuitPython 7.3.1 and I want to use the adafruit_logging library. Now that I have a working file system I don't get errors but I also don't get any output via the serial console.

I tried the following:

I installed the adafruit_logging.mpy file from the latest bundle into the lib folder.
I copied the example from here: https://learn.adafruit.com/a-logger-for ... g-a-logger into a new empty code.py file.

The code runs. There are no errors. But there also is no output. I use a laptop with Debian and screen in the terminal window. The ItsyBitsy restarts after every file write. Everything else shows up nicely and the print command also works.

What am I doing wrong?

Elektrix

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: adafruit_logging gives no output

Post by mikeysklar »

When you run screen are you sure you are connecting to the correct device? Are you able to stop the running program via the REPL console? It should be ^C to interrupt and ^D to resume. There can be several device names that are similar depending on your distribution.

User avatar
neradoc
 
Posts: 542
Joined: Wed Apr 27, 2016 2:38 pm

Re: adafruit_logging gives no output

Post by neradoc »

Hi, there seems to be a bug, or API inconsistency in adafruit_logging.getLogger, where it defaults to no handler.
Try adding a stream handler for now:

Code: Select all

logger_test = logging.getLogger('test')
logger_test.setLevel(logging.ERROR)
logger_test.addHandler(logging.StreamHandler())
logger_test.info('Info message')
logger_test.error('Error message')

User avatar
Elektrix
 
Posts: 19
Joined: Wed Dec 26, 2018 6:11 am

Re: adafruit_logging gives no output

Post by Elektrix »

Thank you for the Info, now it works. When it is a bug where is the right place for me to write a bug report?

Elektrix

User avatar
Elektrix
 
Posts: 19
Joined: Wed Dec 26, 2018 6:11 am

Re: adafruit_logging gives no output

Post by Elektrix »

@neradoc:

I found your bug report here: https://github.com/adafruit/Adafruit_Ci ... /issues/33, together with the missing return character bug. Thanks for your work!

Elektrix

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”