getConsoleLog Last updated: 14. Aug 2026
API only function
Returns the lines written to the site's console with console.log, console.warn and console.error.
The console log is kept in memory on the server, as a rolling buffer of the last 1000 lines per site. It is cleared when the application restarts or the app pool recycles, so treat it as a live debugging aid - not as durable storage. Write to a file with docly.saveFile if you need a log that survives a restart.
See also: console.log saveFile
Parameters
This function takes no parameters
Returns
An array of objects with the following properties: Time, Type, Message, User, Site, Source.
Type is "log", "warn" or "error". Message is the logged value serialized the same way JavaScript would write it, so an object is returned as JSON. Source is the file that wrote the line, User is the email of the logged in user (empty for anonymous visitors), and Site is the address of the site.
The lines come in the order they were written, oldest first. An empty array is returned when nothing has been logged, so the result is always safe to iterate without a null check.
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.let log = docly.getConsoleLog();
write(log.length + " lines\n");
for(let line of log)
{
write(line.Time + " [" + line.Type + "] " + line.Source + ": " + line.Message + "\n");
}
// Only the errors:
let errors = log.filter(line => line.Type === "error");
// The log lives in memory and holds the last 1000 lines for this site.
// It is emptied when the application restarts.