Giter Club home page Giter Club logo

appium-log-reader's Introduction

charly


Build Status Codacy Badge

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.


Dashboard

Features

  • 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

Error

Prerequisites

You will need:

Getting Started

  • 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 

Docker

An alternative way to run the Appium Log Reader is via Docker: TODO

HTTP API

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.

URL structure

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)

Errors

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.

Example calls

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" }'

API Documentation

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.

Contribution

Any ideas are welcome. Feel free to submit any issues or pull requests.

PRs Welcome


Appium Log Reader is developed and maintained by Mobilebox team.

appium-log-reader's People

Contributors

dev-mobileboxlab avatar htejera avatar ohtejera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

appium-log-reader's Issues

ERROR spark.http.matching.GeneralError

java 12.0.1 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)

1] Started web hook using java -jar /Users/admin/Downloads/appium-log-reader-service-1.1.0.jar -p 5000

2]
Admins-Mac:~ admin$ appium --webhook 0.0.0.0:5000
[Appium] Welcome to Appium v1.13.0
[Appium] Non-default server args:
[Appium] webhook: 0.0.0.0:5000
[Appium] Appium REST http interface listener started on 0.0.0.0:4723

NPE for every log entry submission attempt

Hi, I"m seeing this same error, over and over, when running this server. I'm using Appium server 1.11.1.

Tried the older release of your server and the same error is occurring. Perhaps Appium changed their logging format?

[qtp1643141084-38] ERROR spark.http.matching.GeneralError -
java.lang.NullPointerException
at com.mobilebox.reader.service.Service.lambda$main$9(Service.java:337)
at spark.RouteImpl$1.handle(RouteImpl.java:72)
at spark.http.matching.Routes.execute(Routes.java:61)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130)
at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1568)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:530)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
at java.lang.Thread.run(Thread.java:748)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.