Skip to content

Commit 453b0bb

Browse files
authored
Merge pull request #164 from arangodb-helper/feature/logging-overhaul
Improve logging
2 parents 5577cf0 + d8fbb71 commit 453b0bb

File tree

890 files changed

+148265
-37550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

890 files changed

+148265
-37550
lines changed

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ifndef BUILDDIR
2323
endif
2424
GOBUILDDIR := $(BUILDDIR)/.gobuild
2525
SRCDIR := $(SCRIPTDIR)
26+
CACHEVOL := $(PROJECT)-gocache
2627
BINDIR := $(BUILDDIR)/bin
2728

2829
ORGPATH := github.com/arangodb-helper
@@ -32,7 +33,7 @@ REPODIR := $(ORGDIR)/$(REPONAME)
3233
REPOPATH := $(ORGPATH)/$(REPONAME)
3334

3435
GOPATH := $(GOBUILDDIR)
35-
GOVERSION := 1.10.1-alpine
36+
GOVERSION := 1.10.3-alpine
3637

3738
ifndef GOOS
3839
GOOS := linux
@@ -96,20 +97,29 @@ deps:
9697

9798
$(GOBUILDDIR):
9899
@mkdir -p $(ORGDIR)
100+
@mkdir -p $(GOBUILDDIR)/src/golang.org
99101
@rm -f $(REPODIR) && ln -s $(GOBUILDLINKTARGET) $(REPODIR)
100102
@rm -f $(GOBUILDDIR)/src/github.com/aktau && ln -s ../../../vendor/github.com/aktau $(GOBUILDDIR)/src/github.com/aktau
101103
@rm -f $(GOBUILDDIR)/src/github.com/arangodb && ln -s ../../../vendor/github.com/arangodb $(GOBUILDDIR)/src/github.com/arangodb
102104
@rm -f $(GOBUILDDIR)/src/github.com/dchest && ln -s ../../../vendor/github.com/dchest $(GOBUILDDIR)/src/github.com/dchest
103105
@rm -f $(GOBUILDDIR)/src/github.com/dustin && ln -s ../../../vendor/github.com/dustin $(GOBUILDDIR)/src/github.com/dustin
104106
@rm -f $(GOBUILDDIR)/src/github.com/kballard && ln -s ../../../vendor/github.com/kballard $(GOBUILDDIR)/src/github.com/kballard
107+
@rm -f $(GOBUILDDIR)/src/github.com/rs && ln -s ../../../vendor/github.com/rs $(GOBUILDDIR)/src/github.com/rs
105108
@rm -f $(GOBUILDDIR)/src/github.com/shavac && ln -s ../../../vendor/github.com/shavac $(GOBUILDDIR)/src/github.com/shavac
106109
@rm -f $(GOBUILDDIR)/src/github.com/voxelbrain && ln -s ../../../vendor/github.com/voxelbrain $(GOBUILDDIR)/src/github.com/voxelbrain
110+
@rm -f $(GOBUILDDIR)/src/golang.org/x && ln -s ../../../vendor/golang.org/x $(GOBUILDDIR)/src/golang.org/x
107111

108-
$(BIN): $(GOBUILDDIR) $(SOURCES)
112+
.PHONY: $(CACHEVOL)
113+
$(CACHEVOL):
114+
@docker volume create $(CACHEVOL)
115+
116+
$(BIN): $(GOBUILDDIR) $(SOURCES) $(CACHEVOL)
109117
@mkdir -p $(BINDIR)
110118
docker run \
111119
--rm \
112120
-v $(SRCDIR):/usr/code \
121+
-v $(CACHEVOL):/usr/gocache \
122+
-e GOCACHE=/usr/gocache \
113123
-e GOPATH=/usr/code/.gobuild \
114124
-e GOOS=$(GOOS) \
115125
-e GOARCH=$(GOARCH) \

certificates.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ import (
2929
func init() {
3030
certificates.AddCommands(cmdMain, func(err error, msg string) {
3131
if err != nil {
32-
log.Fatalf("%s: %s", msg, err)
32+
log.Fatal().Err(err).Msg(msg)
3333
} else {
34-
log.Fatal(msg)
34+
log.Fatal().Msg(msg)
3535
}
3636
}, cmdShowUsage)
3737
}

docs/Manual/Programs/Starter/Options.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,17 +273,35 @@ This indicates whether or not a DB server instance should be started
273273
path to rr executable to use if non-empty (default ""). Expert and
274274
debugging only.
275275

276+
- `--log.color=bool`
277+
278+
If set to `true`, console log output is colorized.
279+
The default is `true` when a terminal is attached to stdin,
280+
`false` otherwise or when running on Windows.
281+
282+
- `--log.console=bool`
283+
284+
If set to `true`, log output is written to the console (default `true`).
285+
286+
- `--log.file=bool`
287+
288+
If set to `true`, log output is written to the file (default `true`).
289+
The log file, called `arangodb.log`, can be found in the directory
290+
specified using `--log.dir` or if that is not set, the directory
291+
specified using `--starter.data-dir`.
292+
276293
- `--log.verbose=bool`
277294

278-
show more information (default false).
295+
show more information (default `false`).
279296

280297
- `--log.dir=path`
281298

282299
set a custom directory to which all log files will be written to.
283300
When using the Starter in docker, make sure that this directory is
284301
mounted as a volume for the Starter.
285302

286-
Note: When using a custom log directory, all files will be named as `arangod-<role>-<port>.log`.
303+
Note: When using a custom log directory, all database server files will be named as `arangod-<role>-<port>.log`.
304+
The log for the starter itself is still called `arangodb.log`.
287305

288306
- `--log.rotate-files-to-keep=int`
289307

examples/systemd/arangodb.service

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ExecStartPre=/usr/bin/sh -c "mkdir -p $(dirname $CLUSTERSECRETPATH)"
1212
ExecStartPre=/usr/bin/sh -c "mkdir -p ${DATADIR}"
1313
ExecStartPre=/usr/bin/sh -c "echo ${CLUSTERSECRET} > ${CLUSTERSECRETPATH}"
1414
ExecStart=/usr/bin/arangodb \
15+
--log.file=false \
1516
--starter.data-dir=${DATADIR} \
1617
--starter.join=${STARTERENDPOINTS} \
1718
--server.storage-engine=rocksdb \

help.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func showSyncMasterJWTSecretMissingHelp() {
204204
// underneeth and the exit with code 1.
205205
// Backticks in the lines are colored yellow.
206206
func showFatalHelp(title string, lines ...string) {
207-
log.Error(highlight(title))
207+
log.Error().Msg(highlight(title))
208208
content := strings.Join(lines, "\n")
209209
fmt.Println(highlight(content))
210210
os.Exit(1)

0 commit comments

Comments
 (0)