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

Avoid double logging #227

Merged
merged 2 commits into from
May 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ BIND_ADDRESS=:4050 DATABASE_TYPE=sqlite3 DATABASE_URL=go-neb.db?_busy_timeout=50
- `DATABASE_URL` is where to find the database file. One will be created if it does not exist. It is a URL so parameters can be passed to it. We recommend setting `_busy_timeout=5000` to prevent sqlite3 "database is locked" errors.
- `BASE_URL` should be the public-facing endpoint that sites like Github can send webhooks to.
- `CONFIG_FILE` is the path to the configuration file to read from. This isn't included in the example above, so Go-NEB will operate in HTTP mode.

- `LOG_DIR` is a directory that log files will be written to, with log rotation enabled. If set, logging to stderr will be disabled.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely logrus would default to logging to stdout, not stderr, right? So setting this should disable both logging to stdout and stderr.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From https://github.com/sirupsen/logrus/blob/master/README.md#example

  // Output to stdout instead of the default stderr
  // Can be any io.Writer, see below for File example
  log.SetOutput(os.Stdout)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird.. but doesn't matter, since we log to "Discard" now.
Good to know though, I'll keep it in mind.

Go-NEB needs to be "configured" with clients and services before it will do anything useful. It can be configured via a configuration file OR by an HTTP API.

## Configuration file
Expand Down
1 change: 1 addition & 0 deletions src/github.com/matrix-org/go-neb/goneb.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ func main() {
DisableSorting: false,
}, &dugong.DailyRotationSchedule{GZip: false},
))
log.SetOutput(ioutil.Discard)
}

log.Infof("Go-NEB (%+v)", e)
Expand Down