mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 14:10:54 +00:00
fix: AppPath is wrong. Move BeeLogger to config.go init.
This commit is contained in:
parent
de0113ae6a
commit
68d4c2c0d8
13
config.go
13
config.go
@ -3,12 +3,13 @@ package beego
|
|||||||
import (
|
import (
|
||||||
"html/template"
|
"html/template"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/astaxie/beego/config"
|
"github.com/astaxie/beego/config"
|
||||||
|
"github.com/astaxie/beego/logs"
|
||||||
"github.com/astaxie/beego/session"
|
"github.com/astaxie/beego/session"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -64,8 +65,8 @@ func init() {
|
|||||||
BeeApp = NewApp()
|
BeeApp = NewApp()
|
||||||
|
|
||||||
// initialize default configurations
|
// initialize default configurations
|
||||||
os.Chdir(path.Dir(os.Args[0]))
|
AppPath, _ = filepath.Abs(filepath.Dir(os.Args[0]))
|
||||||
AppPath = path.Dir(os.Args[0])
|
os.Chdir(AppPath)
|
||||||
|
|
||||||
StaticDir = make(map[string]string)
|
StaticDir = make(map[string]string)
|
||||||
StaticDir["/static"] = "static"
|
StaticDir["/static"] = "static"
|
||||||
@ -103,7 +104,7 @@ func init() {
|
|||||||
|
|
||||||
EnableGzip = false
|
EnableGzip = false
|
||||||
|
|
||||||
AppConfigPath = path.Join(AppPath, "conf", "app.conf")
|
AppConfigPath = filepath.Join(AppPath, "conf", "app.conf")
|
||||||
|
|
||||||
HttpServerTimeOut = 0
|
HttpServerTimeOut = 0
|
||||||
|
|
||||||
@ -123,6 +124,10 @@ func init() {
|
|||||||
|
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
||||||
|
// init BeeLogger
|
||||||
|
BeeLogger = logs.NewLogger(10000)
|
||||||
|
BeeLogger.SetLogger("console", "")
|
||||||
|
|
||||||
err := ParseConfig()
|
err := ParseConfig()
|
||||||
if err != nil && !os.IsNotExist(err) {
|
if err != nil && !os.IsNotExist(err) {
|
||||||
// for init if doesn't have app.conf will not panic
|
// for init if doesn't have app.conf will not panic
|
||||||
|
5
log.go
5
log.go
@ -25,11 +25,6 @@ func SetLevel(l int) {
|
|||||||
// logger references the used application logger.
|
// logger references the used application logger.
|
||||||
var BeeLogger *logs.BeeLogger
|
var BeeLogger *logs.BeeLogger
|
||||||
|
|
||||||
func init() {
|
|
||||||
BeeLogger = logs.NewLogger(10000)
|
|
||||||
BeeLogger.SetLogger("console", "")
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetLogger sets a new logger.
|
// SetLogger sets a new logger.
|
||||||
func SetLogger(adaptername string, config string) {
|
func SetLogger(adaptername string, config string) {
|
||||||
BeeLogger.SetLogger(adaptername, config)
|
BeeLogger.SetLogger(adaptername, config)
|
||||||
|
Loading…
Reference in New Issue
Block a user