Appium Log Reader is a simple viewer that works with the Appium logs. It supports filtering, searching, highlighting and many other useful features.
Appium has a built-in mechanism in order to post messages to an external Webhook. They make use of normal HTTP requests with a JSON payload that includes a log message and the log level. This service listens these messages.
You can also use Appium Log Reader as an API.
- A great Appium log HTTP API.
- View, filter, searching and and export logs in different formats such as: XLS, CSV, TXT, JSON, SQL, etc.
- Localized log levels.
- Shortcut to search errors messages on DuckDuckGo
You will need:
- Download the latest version of Appium Log Reader (requires JDK 1.8 or newer) and install Appium
- Start Appium Log Reader:
java - jar appium-log-reader-service-X.X.X.jar -p 5000
- Start Appium using --webhook flag. This flag enable the log output to HTTP listener:
appium --webhook 127.0.0.1:5000
- Navigate to http://127.0.0.1:5000/dashboard to view the dashboard.
An alternative way to run the Appium Log Reader is via Docker: TODO
Appium Log Reader’s HTTP API serves two primary purposes:
-
The Appium Log Reader API gives you a way to embed Appium logs into another webpage or a third-party application.
-
Programmatic search for logs. Most common tasks you might want to do outside the Appium console output or Appium Log Reader Dashboard, like searching programmatically for logs and retrieving logs during a certain time period, etc.
The Appium Log Reader API lives at http://127.0.0.1:5000/api/v1/, with particular endpoints following that prefix.
Responses are in JSON (except for some endpoint that are used on the Dashboard)
Failed requests return 400 Bad Request, and a JSON hash is provided containing a key called message with further information about the issue. For example:
{
"code": "ERROR_CODE",
"message": "Error description"
}
- If the resource is not found, 404 Not Found is returned.
API examples use httpie, a command-line HTTP client.
Retrieve a collection of all log messages:
http http://127.0.0.1:5000/api/v1/logs
Response
{
"data": {
"items": [
{
"time": "2018.05.17.11.09.39",
"message": "[Appium] Appium REST http interface listener started on 0.0.0.0:4723",
"level": "info"
},
{
"time": "2018.05.17.11.09.39",
"message": "[Appium] Appium support for versions of node < 8 has been deprecated and will be removed in a future version. Please upgrade!",
"level": "warn"
},
{
"time": "2018.05.17.11.09.39",
"message": "[Appium] webhook: 127.0.0.1:5000",
"level": "info"
},
{
"time": "2018.05.17.11.09.39",
"message": "[Appium] Welcome to Appium v1.8.0",
"level": "info"
},
{
"time": "2018.05.17.11.09.39",
"message": "[Appium] Non-default server args:",
"level": "info"
}
],
"size": 5
}
}
Retrieve the last log message:
http http://127.0.0.1:5000/api/v1/logs/last
Response
{
"data": {
"time": "2018.05.17.11.09.39",
"message": "[Appium] Appium REST http interface listener started on 0.0.0.0:4723",
"level": "info"
}
}
Retrieve N lines of log (from the top):
http http://127.0.0.1:5000/api/v1/logs/1
Response
{
"data": {
"items": [
{
"time": "2018.05.17.11.09.39",
"message": "[Appium] Received SIGINT - shutting down",
"level": "info"
}
],
"size": 1
}
}
Post your own log message:
http http://127.0.0.1:5000/ params:='{"message": "My message", "level": "info" }'
We use apiDoc in order to generate the documentation for Appium Log Reader’s HTTP API.
apiDoc creates a documentation from API annotations in your source code. Please check the documentation here
The proyect come with a Maven task in order to generate the documentation from Maven without any pain, but FIRST you need install apiDoc of course:
npm install apidoc -g
And now we need execute the following command:
mvn exec:exec
The documentation is generated on the doc directory.
Any ideas are welcome. Feel free to submit any issues or pull requests.
Appium Log Reader is developed and maintained by Mobilebox team.