Developer log
It can be hard to know what's happening on your server once it's deployed. The developer log helps developers debug their code while it's running in the Root cloud.
What is the developer log?
The developer log is a persistent, developer-visible log. It appears inside the Root Developer Portal and helps you track your code's execution once it's deployed. Each instance of your server has its own log; that is, if your server is installed in five communities, you'll have five logs.
- You view your logs in the Developer Portal. Open the Logs tab to see the most recent messages.
- Messages are visible to you, the developer. They're not shown to community members.
- Only the latest few thousand lines of output are available
- Older messages are automatically trimmed as new ones arrive.
The community controls whether the log is available
For data-privacy reasons, the community is in control of the developer log. It's disabled by default. Community administrators can enable it in the settings.
When to use it
Use the developer log to track how your server code is working once it's deployed to the Root cloud.
- Use logging freely during development to track values, watch for errors, and understand what your server is doing
- Avoid writing large or frequent logs in production since you’ll only see the most recent ones
- Don’t log sensitive data (e.g. user passwords or secrets). Logs are visible in the Developer Portal and aren’t encrypted.
How to write to the developer log
There’s no special logging API needed. Everything your server code writes to stdout or stderr is automatically captured. This includes:
console.log(),console.error(),console.warn(), etc.- Any output from a logging library that writes to standard output or error
Root collects this output and shows it to you live in the Developer Portal.
Example
console.log("Starting vote tally...");
console.warn("No votes found for this round");
console.error("Poll not found in database:", err);
These messages will show up instantly in the Root Developer Portal when your server runs.
Developer logging is your window into your server. If something’s not working, start by looking at the logs.