Remote logging - equivalent of `particle serial monitor` for the cloud

Hi there,

I found this support page for logging (How Do I Collect Trace Logs From My Device? – Particle Support), but I wonder if there’s a way to log and receive those logs without a USB connection.

I’m currently using Serial.printlnf(...) to log/debug my application and want to continue doing so when the device is not connected to my computer (when it’s deployed). It’d be great if I could use a command line tool like particle-cli (similar to the command particle serial monitor --follow which is what I am using to receive the Serial.printlnf() messages with the photon connected through USB).

I had a look around in the docs, but couldn’t find anything suitable (except for the cloud event system, but I find that’s too “high-level”).

Many thanks

Serial.print() will always only ever go to the USB Serial interface.
However, you can use the logging feature with alternative log-handlers targeting other means of communication like the papertrail log-handler

1 Like

Thanks @ScruffR I’ll try to implement a log handler instead and will use the papertrail code as example. Since, I’d like to receive log message within the same network, I might start with a Tcpclient/server.

Do you have any suggestion on how to discover the log server within the WIFI network (i.e. without hardcoding the IP address in the firmware)? Sorry, slightly off-topic…

I’d look at something like mDNS

BTW, there are also some other log-handler libraries you may want to look at

1 Like

The RemoteLogRK library that ScruffR linked to has several examples that may be helpful.

The one that logs to a TCP server is one way, but then you need to store the IP address somewhere.

I prefer to use the UDP multicast, which allows anyone on the network to receive the logs if they know the multicast address and port, which is handy because you don’t have to hardcode the server IP address. It also makes it possible to have multiple receivers. Obviously you want to make sure you don’t log anything sensitive.


Excellent - that’s exactly what I was looking for (and I learned something new about mDNS). Thanks so much for your help. I’ll try the UDP multicast as it promises to match my use case very well.