fix 5129: must set formatter after init the logger
This commit is contained in:
parent
599b441f44
commit
85473bc898
@ -1,5 +1,8 @@
|
|||||||
# developing
|
# developing
|
||||||
- [Fix 5117: support write though cache](https://github.com/beego/beego/pull/5117)
|
- [Fix 5117: support write though cache](https://github.com/beego/beego/pull/5117)
|
||||||
|
- [add read through for cache module](https://github.com/beego/beego/pull/5116)
|
||||||
|
- [add singleflight cache for cache module](https://github.com/beego/beego/pull/5119)
|
||||||
|
- [Fix 5129: must set formatter after init the logger](https://github.com/beego/beego/pull/5130)
|
||||||
|
|
||||||
# v2.0.7
|
# v2.0.7
|
||||||
- [Upgrade github.com/go-kit/kit, CVE-2022-24450](https://github.com/beego/beego/pull/5121)
|
- [Upgrade github.com/go-kit/kit, CVE-2022-24450](https://github.com/beego/beego/pull/5121)
|
||||||
@ -16,9 +19,6 @@ Note: now we force the web admin service serving HTTP only.
|
|||||||
- [Fix 5012: fix some bug, pass []any as any in variadic function](https://github.com/beego/beego/pull/5012)
|
- [Fix 5012: fix some bug, pass []any as any in variadic function](https://github.com/beego/beego/pull/5012)
|
||||||
- [Fix 5022: Miss assigning listener to graceful Server](https://github.com/beego/beego/pull/5028)
|
- [Fix 5022: Miss assigning listener to graceful Server](https://github.com/beego/beego/pull/5028)
|
||||||
- [Fix 4955: Make commands and Docker compose for ORM unit tests](https://github.com/beego/beego/pull/5031)
|
- [Fix 4955: Make commands and Docker compose for ORM unit tests](https://github.com/beego/beego/pull/5031)
|
||||||
- [add read through for cache module](https://github.com/beego/beego/pull/5116)
|
|
||||||
- [add singleflight cache for cache module](https://github.com/beego/beego/pull/5119)
|
|
||||||
|
|
||||||
|
|
||||||
# v2.0.4
|
# v2.0.4
|
||||||
|
|
||||||
|
|||||||
@ -41,8 +41,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// RFC5424 log message levels.
|
// RFC5424 log message levels.
|
||||||
@ -193,20 +191,20 @@ func (bl *BeeLogger) setLogger(adapterName string, configs ...string) error {
|
|||||||
|
|
||||||
lg := logAdapter()
|
lg := logAdapter()
|
||||||
|
|
||||||
|
err := lg.Init(config)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// Global formatter overrides the default set formatter
|
// Global formatter overrides the default set formatter
|
||||||
if len(bl.globalFormatter) > 0 {
|
if len(bl.globalFormatter) > 0 {
|
||||||
fmtr, ok := GetFormatter(bl.globalFormatter)
|
fmtr, ok := GetFormatter(bl.globalFormatter)
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New(fmt.Sprintf("the formatter with name: %s not found", bl.globalFormatter))
|
return fmt.Errorf("the formatter with name: %s not found", bl.globalFormatter)
|
||||||
}
|
}
|
||||||
lg.SetFormatter(fmtr)
|
lg.SetFormatter(fmtr)
|
||||||
}
|
}
|
||||||
|
|
||||||
err := lg.Init(config)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintln(os.Stderr, "logs.BeeLogger.SetLogger: "+err.Error())
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
bl.outputs = append(bl.outputs, &nameLogger{name: adapterName, Logger: lg})
|
bl.outputs = append(bl.outputs, &nameLogger{name: adapterName, Logger: lg})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user