-
Notifications
You must be signed in to change notification settings - Fork 773
Configure dfclient/dfdaemon/dfget log file path via 'logConfig.path' property #1145
Conversation
We found this is your first time to contribute to Dragonfly, @YanzheL |
b214098
to
bc6f296
Compare
bc6f296
to
618ba1d
Compare
Codecov Report
@@ Coverage Diff @@
## master #1145 +/- ##
==========================================
- Coverage 47.65% 47.63% -0.02%
==========================================
Files 115 115
Lines 7225 7228 +3
==========================================
Hits 3443 3443
- Misses 3508 3511 +3
Partials 274 274
Continue to review full report at Codecov.
|
pkg/dflog/log.go
Outdated
@@ -72,7 +77,7 @@ func getLumberjack(l *logrus.Logger) *lumberjack.Logger { | |||
func WithLogFile(f string, maxSize, maxBackups int) Option { | |||
return func(l *logrus.Logger) error { | |||
if f == "" { | |||
return nil | |||
f = filepath.Join("logs", "dfdaemon.log") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, not only dfdaemon will use this function, so do with dfget
and supenrode
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I rollbacked the change of this line, and set the default log path for dfget/dfdaemon in caller (See my new commits).
As for supernode, I didn't touch its code. Because it writes to two different log files, a single logConfig.path
property is not enough to configure the location of these files.
For now, this PR configures the log path of dfget/dfdaemon, not for supernode.
@YanzheL thanks for your contributing very much! Could you please rebase the code and fix the conflict and reviewed comment, then I will merge this pr. |
Signed-off-by: YanzheL <[email protected]>
Signed-off-by: YanzheL <[email protected]>
Signed-off-by: YanzheL <[email protected]>
693b47b
to
54b4918
Compare
Signed-off-by: YanzheL <[email protected]>
Signed-off-by: YanzheL <[email protected]>
I updated and rebased the PR, thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: YanzheL [email protected]
Ⅰ. Describe what this PR did
Currently, there is no option for user to customize the log file path, which causes inconvenience while using
dfclient
in container.For a typical use case, it is expected that the dfclient container logs to stdout so we can inspect the logs via
docker logs -f <dfclient>
instead of checking the log file in default location~/.small-dragonfly/logs/dfdaemon.log
This PR enables user to configure the log file path via configuration property
logConfig.path
.For example
Ⅱ. Does this pull request fix one issue?
NONE
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
Already tested in container.
Ⅳ. Describe how to verify it
Build the dockerfile
Add this property in dfclient configuration file
You will see the log in
stdout
instead of the default location~/.small-dragonfly/logs/dfdaemon.log
Ⅴ. Special notes for reviews