I have set up my Raspberry Pi connected serially to the Arduino to do some digital and analogue capturing (using Nanpy)
However, it randomly stops every few hours.
I have tried putting in some logging features to try figure out when/why it bombs out, but I'm not winning doing it this way.
I have it set up headless in a panel, and unfortunately I can't connect a screen to it to see what the reason is for it bombing out (well, I can, but it is mounted in a box, and I would have to unmount it to get my screen cable plugged in, and the environment is not the best)
I have read that errors are automatically logged into /var/log/errors.log. However, I don't seem to have that particular file on my Raspberry.
Is this the file I should be looking at? Will it give me the error message that would be displayed on the screen when the application bombs out? It is written in Python. I know the exact time that it stops working, so if I know where it is logged to, I can hopefully try find the cause of it.
Thank you for any advice.
Re: Logging of application errors
Hi there try this, it will give you the last 2000 lines of the syslog.
Code: Select all
tail -n 2000 /var/log/syslog
Re: Logging of application errors
Thanks, I came across that file, it didn't show me the info I was after.
However, what it did show is that I still had network connectivity after the program stopped, so I could safely say than loss of connectivity wasn't the cause.
Subsequently I came across a bug in my software which I've corrected, and I'm hoping it runs throughout the night
Any idea why I don't have that file though?
However, what it did show is that I still had network connectivity after the program stopped, so I could safely say than loss of connectivity wasn't the cause.
Subsequently I came across a bug in my software which I've corrected, and I'm hoping it runs throughout the night

Any idea why I don't have that file though?
Re: Logging of application errors
Which file?
Re: Logging of application errors
errors.log under /var/log/
- DougieLawson
- Posts: 42328
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: Logging of application errors
I had to add my pi userid to group adm
sudo usermod -a -G adm pi
so I could read syslog
Then this python snippet (which I found with Google) wrote some nice pretty messages to /var/log/syslog
sudo usermod -a -G adm pi
so I could read syslog
Then this python snippet (which I found with Google)
Code: Select all
import logging
import logging.handlers
my_logger = logging.getLogger('MyLogger')
my_logger.setLevel(logging.DEBUG)
handler = logging.handlers.SysLogHandler(address = '/dev/log')
my_logger.addHandler(handler)
my_logger.debug('this is debug')
my_logger.critical('this is critical')
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.