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

create the log file along with its parent directory if not present #12675

Merged
merged 27 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
dfd8bcf
Remove Feature Flag From Prater (#12082)
nisdas Mar 6, 2023
e2fa7d4
Use Epoch boundary cache to retrieve balances (#12083)
potuz Mar 6, 2023
16f9f7d
Merge tag 'v4.0.2'
prestonvanloon Apr 19, 2023
2674e20
Merge tag 'v4.0.3'
prestonvanloon Apr 20, 2023
967d7d3
create the log file along with its parent directory if not present
bharath-123 Jul 31, 2023
e3a5e73
only give ReadWritePermissions to the log file
bharath-123 Jul 31, 2023
110e81c
Merge branch 'develop' of https://github.com/prysmaticlabs/prysm into…
bharath-123 Aug 5, 2023
386c186
use io/file package to create the parent directories
bharath-123 Aug 5, 2023
0d787bf
Merge branch 'develop' of https://github.com/prysmaticlabs/prysm into…
bharath-123 Aug 6, 2023
f31cea4
fix ci related issues
bharath-123 Aug 6, 2023
0c05a53
Merge branch 'develop' of https://github.com/prysmaticlabs/prysm into…
bharath-123 Aug 21, 2023
c52cd9e
add regression tests
bharath-123 Aug 22, 2023
4d1c3d6
Merge branch 'master' of https://github.com/prysmaticlabs/prysm into …
bharath-123 Aug 22, 2023
bcfbc8d
Merge branch 'develop' of https://github.com/prysmaticlabs/prysm into…
bharath-123 Aug 22, 2023
52c279f
Merge branch 'develop' of https://github.com/prysmaticlabs/prysm into…
bharath-123 Aug 22, 2023
f6d0da3
run gazelle
bharath-123 Aug 22, 2023
b42f576
Merge branch 'develop' of https://github.com/prysmaticlabs/prysm into…
bharath-123 Aug 23, 2023
35ca363
Merge branch 'develop' of https://github.com/prysmaticlabs/prysm into…
bharath-123 Aug 23, 2023
1cd7df8
fix tests
bharath-123 Aug 23, 2023
e4c691b
Merge branch 'develop' into create-log-file
bharath-123 Aug 24, 2023
ef0e7f0
remove print statements
bharath-123 Aug 25, 2023
eaba83c
Merge branch 'develop' of https://github.com/prysmaticlabs/prysm into…
bharath-123 Aug 25, 2023
7991d9c
Merge branch 'create-log-file' of https://github.com/bharath-123/prys…
bharath-123 Aug 25, 2023
be2ee88
Merge branch 'develop' into create-log-file
bharath-123 Aug 28, 2023
5266bcc
Merge branch 'develop' into create-log-file
prestonvanloon Mar 22, 2024
5636470
gazelle
prestonvanloon Mar 22, 2024
6c8719a
Remove failing test for MkdirAll, this failure is not expected
prestonvanloon Mar 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions io/logs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ go_library(
"//cache/lru:go_default_library",
"//config/params:go_default_library",
"//crypto/rand:go_default_library",
"//io/file:go_default_library",
"@com_github_hashicorp_golang_lru//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
],
Expand Down
5 changes: 5 additions & 0 deletions io/logs/logutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import (
"io"
"net/url"
"os"
"path/filepath"
"strings"

"github.com/prysmaticlabs/prysm/v4/config/params"
"github.com/prysmaticlabs/prysm/v4/io/file"
"github.com/sirupsen/logrus"
)

Expand All @@ -20,6 +22,9 @@ func addLogWriter(w io.Writer) {
// ConfigurePersistentLogging adds a log-to-file writer. File content is identical to stdout.
func ConfigurePersistentLogging(logFileName string) error {
logrus.WithField("logFileName", logFileName).Info("Logs will be made persistent")
if err := file.MkdirAll(filepath.Dir(logFileName)); err != nil {
return err
}
f, err := os.OpenFile(logFileName, os.O_CREATE|os.O_WRONLY|os.O_APPEND, params.BeaconIoConfig().ReadWritePermissions) // #nosec G304
if err != nil {
return err
Expand Down