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

CODENVY-1407: Log agent output on fail #3961

Merged
merged 5 commits into from
Feb 2, 2017
Merged

CODENVY-1407: Log agent output on fail #3961

merged 5 commits into from
Feb 2, 2017

Conversation

mmorhun
Copy link
Contributor

@mmorhun mmorhun commented Jan 31, 2017

What does this PR do?

Logs agent output if it fails to start.

What issues does this PR fix or reference?

codenvy/codenvy#1407

Changelog

Add output of failed agent into tomcat logs.

Release Notes

N/A

Docs PR

N/A

Mykola Morhun added 2 commits January 30, 2017 16:38
Signed-off-by: Mykola Morhun <mmorhun@codenvy.com>
Signed-off-by: Mykola Morhun <mmorhun@codenvy.com>
@Override
public void launch(Instance machine, Agent agent) throws ServerException {
if (isNullOrEmpty(agent.getScript())) {
return;
}
ListLineConsumer agentLogger = new ListLineConsumer();
LineConsumer lineConsumer = new AbstractLineConsumer() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CompositeLineConsumer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible, but in that case we shouldn't close CompositeLineConsumer, only agentLogger (which is part of composite consumer).

@garagatyi
Copy link

Can you show an example of output if ssh connection fails?

@codenvy-ci
Copy link

* the agent to start
* @throws ServerException
* if script execution failed
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc should be moved to interface.

/**
* Launches agent script in machine and waits until agent starts.
* The machine should be started.
* Retrieves agent's logs if its start fails.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see it logs agent logs if it fails, but stores it in any case. Is it needed to add logging related logic into javadocs?

Signed-off-by: Mykola Morhun <mmorhun@codenvy.com>
Copy link

@garagatyi garagatyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not big fan of putting agents logs into memory and into logs, but ok with that if we need it.
@tolusha Please take a look

@codenvy-ci
Copy link

@vkuznyetsov vkuznyetsov added this to the 5.3.0 milestone Feb 2, 2017
@mmorhun mmorhun merged commit c0f75d3 into master Feb 2, 2017
@mmorhun mmorhun deleted the CODENVY-1407 branch February 2, 2017 11:31
@JamesDrummond JamesDrummond modified the milestones: 5.2.1, 5.3.0 Feb 2, 2017
@JamesDrummond JamesDrummond mentioned this pull request Feb 17, 2017
9 tasks
JPinkney pushed a commit to JPinkney/che that referenced this pull request Aug 17, 2017
CODENVY-1407: Log agent output on fail
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

Successfully merging this pull request may close these issues.

6 participants