typesafehub / sbt-conductr

Typesafe ConductR plugin for sbt
Other
29 stars 22 forks source link

Implementation of events and logs commands #104

Closed markusjura closed 9 years ago

markusjura commented 9 years ago

Implementation of the commands events and logs. Syntax:

conduct logs visualizer
conduct logs conductr-kibana --scale 50
conduct events visualizer
conduct events conductr-kibana --scale 50

The last parameter 50 is optional and tells how many lines should be displayed.

The logs and events are getting retrieved. However, the PR isn't finished yet. Missing pieces are:

Also refactored the src/main/scala/com/typesafe/conductr/client/ConductRController.scala by encapsulating duplicated code into methods.

huntc commented 9 years ago

Looking good.

markusjura commented 9 years ago

Alrighty, the format has been optimized for the logs and events command. In case the log or event message length is less than the column width it will look like this:

screen shot 2015-09-22 at 15 23 05

If the length of the text is longer than the column width we will wrap the text and add at the end of the message an additional new line for readability reasons:

screen shot 2015-09-22 at 15 24 12

Note: The last character of the log messages of conduct logs is currently a new line. This will be fixed in another PR.

markusjura commented 9 years ago

@huntc: The travis test is failing because it runs the tests with Java 7, but I've used the java.time.* objects introduced in Java 8.

Should we support Java 7 for sbt-conductr as well? I guess if conductr has Java 8 as a prerequisite itself we should we fine to use Java 8 objects in sbt-conductr. WDYT?

huntc commented 9 years ago

The plugins themselves require Java 7 to support Play 2.3 and Akka 2.3 users. It would have been Java 6 but the native packager brought us to 7.

markusjura commented 9 years ago

Used joda-time 2.8.2 instead of java.time.* to be Java 7 compatible.

typesafe-tools commented 9 years ago

sbt-conductr needs to enable the logs and events command

markusjura commented 9 years ago

Log messages will look now like this:

screen shot 2015-09-28 at 11 55 44

Downside Copy & Paste this wrapped text into a text editor leads to spaces in the text between the new lines.

huntc commented 9 years ago

Looking good!

How come the msg isn't being parsed for those columns being wrapped though?

markusjura commented 9 years ago

With parsing you mean that we should, e.g. apply json parsing if the log message has a json format? So far no parsing is applied. Only formatting, so that the wrapping only happens within the same column.

huntc commented 9 years ago

Sorry for any confusion. I'm curious as to why the multiline logs are showing as JSON, but the others don't. Is this the same output as the python CLI?

markusjura commented 9 years ago

Kibana always produces JSON as log messages. The first 3 lines are part of the Kibana start script.

It is the same output as on the python CLI.

markusjura commented 9 years ago

Removed the ex from the Status.Failure. Ready to get merged?

huntc commented 9 years ago

Thanks for the explanations. Lgtm.