Sending to dashboard logs

I’ve been trying to send messages to the logs in the dashboard page but unsuccessful. :frowning:
I’ve tried from python using sys.stdout.write and sys.stderr.write.
i’ve tried echo “hello” > /dev/stdout
i’ve tried echo “hello” > /dev/stderr
i’ve tried echo “hello” > /proc/1/fd/1

Help please! :slight_smile: thanks!

is there a chance your container is not running or your application has exited?
Please take a look here for more info on container runtime:

You will probably have to enable init system.


@maoie just writing to the standard output/standard error should work. Here’s a very simple example:

It just echos “Idling…” into the dashboard/logs…

If after checking this, your project still does not work, can you share the Dockerfile, or a link to your code so we can take a look?

init is enabled. and application is still running. i can see output in the terminal. except i want the output to be sent to dahsboard logs. i will paste the dockerfile here

FROM resin/raspberrypi3-buildpack-deps

# Enable systemd, as Resin requires this

# Make the hardware type available as a runtime env var

# Copy the build and run environment
COPY . /opt/ttn-gateway/
WORKDIR /opt/ttn-gateway/

# Build the gateway (or comment this out if debugging on-device)
RUN ./dev/ && rm -rf ./dev

# Start it up
CMD ["sh", "-c", "./"]
CMD while : ; do echo "idling ..."; sleep ${INTERVAL=600}; done

here’s the dockerfile

Can you replace the CMD line command that executes the python script with
CMD ["python","./"] ?

Alternatively, you can checkout this simple python project

and see if it successfully logs the output to the dashboard. If yes, then I assume that there must be something going on the code you use.


ok. ill try that tonight. i dont have access to the gateway right now. thanks…

i’m sorry if i wasn’t clear. i’m running my script from the app container. i installed cron and want the output of the cron job to display in the dashboard.

I just found out that python scripts run from CMD can print to the dashboard logs in but if run from terminal, it can’t.

Ah, yes. Resin’s logging only receives output from the command that’s run by the container, it can’t capture the output from every running process on the machine. If you separately open a terminal to the device and run commands, that’s totally independent. If you want to manually run commands and have those messages appear in the logs for the device, you’ll need to find a way to communicate with the command being run by your container, to have that command output them instead.

You mean the one in the CMD command? TIA.

Yes the one in the CMD command in the Dockerfile.