New library - Papertrail

I’m pretty sure they broke the log handler in 0.6.1, so I had to fix it. You can you 0.6.0 with older version of the library.

I suggest to open a issue in the FW’s GitHub repo. I intend to do this once I find the time.

I extremely appreciate the investigation!! Many thanks!!

@barakwei, great job on the library.

If you want a syslog client without using Papertrail, I just uploaded some sample code. I use the Kiwi syslog server and capture log messages from various programs. I have only tried compiling it on a Photon but I also have a Core and an Electron if anybody wants any additional versions.

Hello @thrmttnw @syrinxtech @barakwei @rickkas7 Firmware 0.8.0-rc.3 Pre-release is out on the Web IDE for Core/Photon/P1/Electron. This release fixes the issue seen above where recursive logging would lock up the application thread on the Electron. It’s still not advisable to log too much over UDP on the Electron. I’ll suggest two that work well below. Please see the release notes on the Particle Firmware Updates Thread

// app level over papertrail
PapertrailLogHandler papertrailLogHandler1(PAPERTRAIL_HOSTNAME, PAPERTRAIL_PORT, "MyAppName", System.deviceID(),
    { "app", LOG_LEVEL_ALL }
    // TOO MUCH!!! { "system", LOG_LEVEL_ALL },
    // TOO MUCH!!! { "comm", LOG_LEVEL_ALL }

// system info and app level over papertrail
PapertrailLogHandler papertrailLogHandler2(PAPERTRAIL_HOSTNAME, PAPERTRAIL_PORT, "MyAppName", System.deviceID(),
    { "app", LOG_LEVEL_ALL },
    { "system", LOG_LEVEL_INFO }
    // MAYBE { "comm", LOG_LEVEL_INFO }
1 Like

Thanks @BDub those log levels are fair enough.

When logging is too much (ex. in combo with app functionality), how does it fail now and how can the device (be) recover(ed)?

To be honest I haven’t seen it fail with the changes. I’ve also been using USB (LOG_LEVEL_ALL) and Cloud logging (see above) at the same time. I only caution against LOG_LEVEL_ALL because you can eat up your SIM data fast, especially if you forget to turn it off (or don’t add some kind of a timer to it :slight_smile: ). If you are not bothered by SIM data, give LOG_LEVEL_ALL a try and see how it does. Obviously the modem is going to be busy a lot so I wouldn’t be surprised if it appears to slow the ability to process the system thread (pub/sub/funcs/vars).