Logging to the console?

Very newbie / basic question, but when using Log.info(), Log.warn(), Log.error(), where does it actually get written to?

I've found the Logging reference page docs.particle.io, but my fundamental question is where are messages being written, because I would have expected the web console (Particle Console | Build your connected product, which get redirected to from /logs), but I only see messages from Particle.publish() there (along with messages about when a device is flashed, online, etc.).

I am familiar with Log4J -- which is what the Log.level() functions look like -- but then there is usually a log4j.properties (or .xml or .jsn) file somewhere that defines the logging level and which messages get logged where and in what format, usually to a file on a filesystem somewhere. Perhaps the default logging is to the serial port, but I don't have anything connected to the serial port, and one of the reasons for wanting to use Particle devices instead of more generic Arduino devices is the on-line web connectivity (i.e., give it power and configure / code / flash it online without any cables).

So is it possible to get Log.level() functions to write to the web console or a web page or a network server or ??? And if so, how do I do that?

Sorry for asking, because I assume this is a very basic question, but I have spent a fair amount of time Google'ing around and haven't found the answer on how to configure where messages get logged.

Can someone please point me to an FAQ or documentation page that explains how to do this?

Thanks,

Dave Filip

It depends which LogHandler you have instantiated.
Most commonly it would be SerialLogHandler which logs to the USB Serial port and in order to see the log you'd need some serial terminal to catch and display the output.

There are other LogHandlers but I'd not try to use the console as sink as you can only have one publish per second.

This seems to be a good one to look at

3 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.