Logging a message¶
This API sends a message string to a log file.
Method:¶
PUT
Endpoint URL¶
The xxxx.backendless.app
is a subdomain assigned to your application. For more information see the Client-side Setup section of this documentation.
https://xxxx.backendless.app/api/log
Request headers¶
Content-Type: application/json
user-token: optional value obtained as a result of the login operation.
where:
Argument | Description |
---|---|
Content-Type |
Must be set to application/json . This header is mandatory. |
user-token |
Optional header. Contains a value returned by Backendless in a preceding user Login API call. If user-token is set in the request, the currently logged in user will be assigned to the ownerId property of the user object which is being saved. Additionally, the operation will be executed with the security policy associated currently logged in user. This means all permissions associated with the user and the roles assigned to the user will be enforced by Backendless. |
Request body¶
A JSON array of objects. Each object represents a log message.
[
{
"log-level": DEBUG | INFO | TRACE | WARN | ERROR | FATAL,
"logger":value,
"timestamp":value,
"message": message-text-value,
"exception":error-text-value
}
]
Response body¶
none or error
Example¶
Make sure to replace xxxx in the domain name in the sample request below to the one assigned to your application.
curl -H Content-Type:application/json -X PUT \
-v https://xxxx.backendless.app/api/log \
-d '[{"log-level":"INFO","logger":"com.mbaas.Logger","timestamp":123456789, "message":"Starting application.." }]'
Once the example runs, the Manage > Log Management screen in the Backendless Console will show the following: