Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

fix logger again #991

Merged
merged 2 commits into from
Aug 15, 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
15 changes: 5 additions & 10 deletions cmd/metrictank/metrictank.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,6 @@ func init() {
func main() {
startupTime = time.Now()

/***********************************
Initialize Logger
***********************************/
log.NewLogger(0, "console", fmt.Sprintf(`{"level": %d, "formatting":false}`, logLevel))

/***********************************
Initialize Configuration
***********************************/
flag.Parse()

// if the user just wants the version, give it and exit
Expand All @@ -111,7 +103,7 @@ func main() {
EnvPrefix: "MT_",
})
if err != nil {
log.Fatal(4, "error with configuration file: %s", err)
fmt.Fprintf(os.Stderr, "FATAL: configuration file error: %s", err)
os.Exit(1)
}
// load config for metric ingestors
Expand Down Expand Up @@ -144,8 +136,11 @@ func main() {
config.ParseAll()

/***********************************
Set logging levels
Set up Logger
***********************************/

log.NewLogger(0, "console", fmt.Sprintf(`{"level": %d, "formatting":false}`, logLevel))

mdata.LogLevel = logLevel
memory.LogLevel = logLevel
inKafkaMdm.LogLevel = logLevel
Expand Down
4 changes: 2 additions & 2 deletions idx/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (m *MemoryIdx) Update(point schema.MetricPoint, partition int32) (idx.Archi
if ok {
oldPart := existing.Partition
if LogLevel < 2 {
log.Debug("metricDef with id %v already in index", point.MKey)
log.Debug("memory-idx: metricDef with id %v already in index", point.MKey)
}

if existing.LastUpdate < int64(point.Time) {
Expand All @@ -246,7 +246,7 @@ func (m *MemoryIdx) AddOrUpdate(mkey schema.MKey, data *schema.MetricData, parti
existing, ok := m.defById[mkey]
if ok {
oldPart := existing.Partition
log.Debug("metricDef with id %s already in index.", mkey)
log.Debug("memory-idx: metricDef with id %s already in index.", mkey)
if existing.LastUpdate < int64(data.Time) {
existing.LastUpdate = int64(data.Time)
}
Expand Down