Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maven goal to show logs #49

Closed
jgangemi opened this issue Nov 20, 2014 · 7 comments
Closed

maven goal to show logs #49

jgangemi opened this issue Nov 20, 2014 · 7 comments

Comments

@jgangemi
Copy link
Collaborator

i feel this is a bit different then issue #8, which is why i created a new one...

how do you feel about a docker:logs command that mimics docker logs? to start, it could perform the same default behavior as docker logs <container_id> and additional features could be added later.

i'm finding myself typing mvn docker:logs after running a mvn docker:start only to realize that won't work which is rather annoying. :)

@rhuss
Copy link
Collaborator

rhuss commented Nov 20, 2014

Both are valid features (having the logs during a run and a dedicated dockers:logs goals for showing the logs on demand and both should of course use the same mechanism.

For the logging mentioned in #8 one would need some extra threads stream out the log as it happenns asynchronously, for docker:logs a single call to the Docker remote API for getting the current log would be enough (but of course something like tail -f would be fine, to)

Also I would like to have all logs from all containers mixed together, with lines coming from different containers higlight somehow (with color and/or prefix). This is also how fig it does.

I already have some ideas how to implement that and this will come quite soon.

@jgangemi
Copy link
Collaborator Author

oh and here i was ready to take this on...

my logs already contain ansi coloring, so you would need to take that into account (for everyone, not just me) as part of whatever you're thinking of.

@rhuss
Copy link
Collaborator

rhuss commented Nov 20, 2014

Coloring would be optional, so if you already have colouring one could switch that off (and colouring is switched on only when a TTY is attached). Alternatively a prefix could be configured (a coloured prefix is that what fig uses to print out the tty output).

The tricky part is to parse the chunked response and when printing to the console from multiple threads than some synchronisation is required (i.e. a dedicated thread printing out the log lines coming in from multiple containers line by line).

Also when using as a maven goal, then it should be possible to specify image via -Dimage for which to print out the logs.

I already have some prototype which I polish and add tomorrow. Sorry, I didn't want to take this off from you, but as I said I already have some very concrete ideas. But as soon as it is in, I really would like to get your opinion on this.

@jgangemi
Copy link
Collaborator Author

lol - i'm not that sad. :)

looking forward to seeing what you've come up with.

@rhuss
Copy link
Collaborator

rhuss commented Nov 20, 2014

;-)

@jgangemi
Copy link
Collaborator Author

jgangemi commented Dec 5, 2014

commenting here b/c this is the correct place ;)

i tried this out a little today and so far so good. the one big piece of feedback do i have is if we (you) want to have some parity w/ docker, the goal should be called logs and not log.

also my first instinct is to type mvn docker:logs given all the other goal names directly match a docker command.

@rhuss
Copy link
Collaborator

rhuss commented Dec 5, 2014

Good catch. Will change this for the upcoming release 0.10.5

There are still some issues with ordering of log entries from multiple containers, but these will be tackled later on.

@rhuss rhuss closed this as completed in 89206fd Dec 5, 2014
leusonmario pushed a commit to leusonmario/docker-maven-plugin that referenced this issue Aug 18, 2018
Set mtime of copied files to 0 to enable Docker cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants