Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

[feature request] output logs to stdout #651

Open
yeya24 opened this issue Jul 3, 2019 · 6 comments · Fixed by #783
Open

[feature request] output logs to stdout #651

yeya24 opened this issue Jul 3, 2019 · 6 comments · Fixed by #783
Labels
areas/log kind/feature kind/feature-request This is a feature request from community for project

Comments

@yeya24
Copy link
Collaborator

yeya24 commented Jul 3, 2019

Why you need it?

Dragonfly is used in cloud native situations and its components like dfdaemon and supernode maybe run as containers.

But currently the detailed logs are stored in logs file inside the container instead of outputing to stdout. If I want to see the logs file, I have to exec into the container first. It is better to have an option to configure logs output to stdout so I can use docker logs or kubectl logs to see the logs.

How it could be?

Add an option or make it default to output logs to stdout

Other related information

@pouchrobot pouchrobot added areas/log kind/feature kind/feature-request This is a feature request from community for project labels Jul 3, 2019
@inoc603
Copy link
Member

inoc603 commented Jul 4, 2019

I agree on this. Logs for dfdaemon and supernode should be output to stdout by default. It's easier for debugging and developing, and we can utilize existing tools like journalctl, docker logs and kubectl logs to view the logs. Console hook is alraedy implemented in dflog, and used in dfget. It would be easy to enable them in dfdaemon and supernode.

Also I did some refactoring on logging a while back here which aims to make initializing the logger easier and more consistent across the whole project.

@yeya24
Copy link
Collaborator Author

yeya24 commented Aug 1, 2019

Hi @inoc603, can you open a pr for this feature?

@inoc603
Copy link
Member

inoc603 commented Aug 1, 2019

@yeya24 Sure. I'll open one this weekend.

@yeya24
Copy link
Collaborator Author

yeya24 commented Nov 26, 2019

I am sorry that I reopen this issue. I found that there is still no option to configure outputting logs to console in both dfdaemon and supernode. Did I miss something? @starnop @lowzj @inoc603

@lowzj
Copy link
Member

lowzj commented Apr 28, 2020

@yeya24 please see pkg/dflog/log.go#WithConsole

@stanxing
Copy link

please see pkg/dflog/log.go#WithConsole

I also want to ask about the status of the issue. I deployed dragonfly(version 1.0.4) in k8s, where dfclient is deployed as daemonset and supernode as deployment. I hope to see the log from kubectl logs -f.

  • dfclient generates three logs files, which are dfdaemon.log, dfclient.log and dfserver.log.

The config logConfig.path:/dev/stdout in /etc/dragonfly/dfdaemon.yml is only effective for dfdaemon.log. But the config logConfig.path:/dev/stdout in /etc/dragonfly/dfget.yml is invalid for dfclient.log and dfserver.log.

  • supernode generates app.log file.

base.logConfig.path:/dev/stdout config in /etc/dragonfly/supernode.yml is also invalid. Log will continue to wirte to app.log.

please correct me if it is wrong.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
areas/log kind/feature kind/feature-request This is a feature request from community for project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants