Application Logging
Introduction
Otto has a REST endpoint that you can use to log application events. The Application Log Token is available on the Configuration screen. This feature requires full License.
How It Works
It takes the following parameters:
level
- The log level. Should be one ofdebug
,verbose
,http
,info
,warn
,error
.message
- The message to log.token
- The string you retrieved from the configuration page as noted above.
A timestamp is automatically added to the log prior to it being written to the log file.
Example
POST /api/app-log
//body
{
"level": "info",
"message": "This is a log message",
"token": "my-token-secret"
}
Log File
The files are currently written to Otto/logs/
. They are also immediately viewable and searchable through Otto's Log Viewer, which is available through Otto's web console.
OttoDeveloperAPI Utility File
Proof+Geist provides a FileMaker utility file that includes example scripts to show you how to create log entries. This file also provides the ability to create an API key for use with Otto's proxy to the FileMaker Server data API, as described here.
Downloading the OttoDeveloperAPI Utility File
Click Download to save the utility file to your preferred downloads directory.
App Log Token
To protect access to the logs, the Application Logger requires a token. Click Get An App Log Token to open the Otto web console and copy the token.
Paste the token in the App Log Token field.
View the Otto Log Viewer
Click Go to Otto Log Viewer in the Otto Developer API Module to open the Otto web console so that you'll be ready to view the log entries we will create in the next step using the example scripts.
Create a Log Entry
We've provided two example scripts to demonstrate how to create a log entry.
- Info log entry - this writes a log entry to Otto's app-info.log.
- Error log entry - this writes a log entry to Otto's app-error.log
Working With Log Entries
Refresh, Download and Clear
As with the other logs available from the Log Viewer, you can Refresh, Download and Clear each log. You'll receive a helpful warning if you select Clear.
Search a Log
Quickly filter the log by any text value by entering search criteria.
Adding logging to your solution
The OttoDeveloperAPI.fm12 file referenced above, includes all the code you will need to add logging to your solution. Here is how to add it.
- Copy the folder
Otto App Log
into your solution. - Open the Config script in that folder and follow the instructions to configure the module for your server.
- Use the example scripts in
Otto App Log Examples
folder in OttoDeveloperAPI.fm12 as a guide to creating log entries.