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

Configuring command line options for "View Logs" command #1505

Closed
luka-zitnik opened this issue Dec 24, 2019 · 5 comments
Closed

Configuring command line options for "View Logs" command #1505

luka-zitnik opened this issue Dec 24, 2019 · 5 comments
Milestone

Comments

@luka-zitnik
Copy link

Currently, using "View Logs" command means the whole log will be printed to the terminal. It's too much time to wait. Enough to categorize it as a bug. I'd love to be able to tail the log to e.g. 5 lines.

I imagine something like this in viewContainerLogs.ts: terminal.sendText(`docker logs ${options} ${node.containerId}`); or just terminal.sendText(`docker logs -f --tail=5 ${node.containerId}`);

I'm willing to submit a pr for this.

@philliphoff
Copy link
Member

@luka-zitnik We're always appreciative of PRs! That said, I think we'd want to have some design discussion around how best to allow the user to configure their container log preferences. Adding a configuration setting that's simply appended to the docker logs command line can be the most flexible approach, but it can also complicate changes to how logging is performed down the road (e.g. the possibility of duplicate or conflicting arguments), as well as being more difficult for users to understand (i.e. requires intimate knowledge of how the docker logs command operates and how we use it in combination with the setting).

It may make sense to have more specific configuration settings (e.g. "Docker log mode" = [All|Tail] and "Docker tail lines" = [1...n]) and use that to build an appropriate command line. That makes configuration more approachable for users, as well as making it easier to reconcile those settings with any changes to logging behavior and defaults in the future.

@luka-zitnik
Copy link
Author

Thx @philliphoff I do see that as a more correct approach.

luka-zitnik added a commit to luka-zitnik/vscode-docker that referenced this issue Jan 11, 2020
Adds two configuration options, Follow and Tail, that match -f and --tail
command line arguments of "docker logs" command.

Closes microsoft#1505.
luka-zitnik added a commit to luka-zitnik/vscode-docker that referenced this issue Jan 11, 2020
Adds two configuration options, Follow and Tail, that match -f and --tail
command line arguments of "docker logs" command.

Closes microsoft#1505.
@dbreshears dbreshears added this to the 0.11.0 milestone Jan 17, 2020
@philliphoff
Copy link
Member

@luka-zitnik We've posted our proposal for a broader effort to support customization of Docker (CLI) commands used by the extension. See #1596 and let us know if you have any feedback.

In particular, you'll notice that the team landed on a more direct form of customization that what we had discussed above (which had its own merits and drawbacks), in the interests of ensuring that users with very specific needs could do literally anything they needed to do, but perhaps at the cost of requiring that user to be more familiar with the Docker CLI and with some back-compatibility risk as the extension needs to tweak the commands it makes for whatever purpose.

@luka-zitnik
Copy link
Author

The proposal is awesome @philliphoff . Love the idea of templates and generated/supported tokens. Previously I thought it would be unrealistic to even talk about ability to call docker-compose instead of docker for its output style. But what did I know.

@bwateratmsft
Copy link
Collaborator

@luka-zitnik I'll close this issue for now as a "dupe" of #1596 so that we can track everything related to command customization in one place. "View Logs" is definitely going to be included in that effort.

@bwateratmsft bwateratmsft removed their assignment Feb 20, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants