-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Xorm log configurable #174
Conversation
Current coverage is 3.04% (diff: 0.00%)@@ master #174 diff @@
========================================
Files 33 33
Lines 8075 8091 +16
Methods 0 0
Messages 0 0
Branches 0 0
========================================
Hits 246 246
- Misses 7809 7825 +16
Partials 20 20
|
validLevels := []string{"Trace", "Debug", "Info", "Warn", "Error", "Critical"} | ||
// Log level. | ||
levelName := Cfg.Section("log."+mode).Key("LEVEL").In( | ||
Cfg.Section("log").Key("LEVEL").In("Trace", validLevels), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trace is also part of the slice above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is the default log level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled this PR locally and tried to create a repository, got:
2016/11/15 08:29:30 [...routers/repo/repo.go:101 handleCreateError()] [E] CreatePost: initRepository: initRepoCommit: git push: remote: panic: runtime error: invalid memory address or nil pointer dereference
remote: [signal 0xb code=0x1 addr=0x0 pc=0x63f930]
remote:
remote: goroutine 1 [running]:
remote: panic(0xfd7e20, 0xc8200121e0)
remote: /usr/lib/go-1.6/src/runtime/panic.go:481 +0x3e6
remote: code.gitea.io/gitea/modules/log.(*XORMLogBridge).ShowSQL(0x0, 0xc82031ac68, 0x1, 0x1)
remote: /home/strk/go/src/code.gitea.io/gitea/modules/log/xorm.go:104 +0x40
remote: code.gitea.io/gitea/vendor/github.com/go-xorm/xorm.(*Engine).ShowSQL(0xc8203052c0, 0xc82031ac68, 0x1, 0x1)
remote: /home/strk/go/src/code.gitea.io/gitea/vendor/github.com/go-xorm/xorm/engine.go:51 +0x60
remote: code.gitea.io/gitea/models.SetEngine(0x0, 0x0)
remote: /home/strk/go/src/code.gitea.io/gitea/models/models.go:184 +0x2f2
remote: code.gitea.io/gitea/cmd.setup(0x1154320, 0xa)
remote: /home/strk/go/src/code.gitea.io/gitea/cmd/serve.go:57 +0x103
remote: code.gitea.io/gitea/cmd.runUpdate(0xc8202cf2c0, 0x0, 0x0)
remote: /home/strk/go/src/code.gitea.io/gitea/cmd/update.go:37 +0xcc
remote: code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0xe57260, 0x13233b0, 0xc8202cf2c0, 0x0, 0x0)
remote: /home/strk/go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0x5e
remote: code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(0x1128300, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1256c80, 0x2e, 0x0, ...)
remote: /home/strk/go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0x10b7
remote: code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc8201b7860, 0xc82000a180, 0x6, 0x6, 0x0, 0x0)
remote: /home/strk/go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0xb65
remote: main.main()
remote: /home/strk/go/src/code.gitea.io/gitea/main.go:40 +0x3a1
remote: error: hook declined to update refs/heads/master
To /home/strk/gitea-repositories/strk/repo1.git
! [remote rejected] master -> master (hook declined)
error: failed to push some refs to '/home/strk/gitea-repositories/strk/repo1.git'
Reverting application of this PR made the new repository creation work.
Yes, a bug, I'm fixing. |
Do we really want to delay that for 1.1.0? |
Personally I think the soon we can get to 1.0.0 the better, so anything not fundamental can wait if it takes time away from that focus. |
I will fix this. Maybe we need change a new log system |
What about a single logrus logger? |
And additionally separate log levels for the different types of logs, so that you can enable general debug log, but disable debug output of xorm |
@lunny please fix the conflicts. |
@lunny Could you resolve the conflicts? |
I will update this later. |
6f044ec
to
787481c
Compare
787481c
to
6db1acc
Compare
@lunny Any update/status on this? |
It's ready to review. I have posted some messages on gitter. |
Well, LGTM :) |
modules/setting/setting.go
Outdated
logModes := strings.Split(Cfg.Section("log").Key("MODE").MustString("console"), ",") | ||
var logConfigs string | ||
for _, mode := range logModes { | ||
if disableConsole && mode == "console" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this check take place after calling strings.TrimSpace()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@@ -0,0 +1,132 @@ | |||
package log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
c134761
to
2daebbc
Compare
resolved conflicts. |
starts for me, and logs lots of things on stdout. what/how to test more of it ? is documentation ready somewhere ? |
It's controlled by the |
Ok, LGTM -- I'm still seeing Macaron logs on console but I guess that's a different thing |
…gitea#174) * Restores the HashTag code in Issue comments * Has travis test with 1.7 and 1.8 of Go
Before xorm's log will be stored
xorm.log
, now it will use the same configuration asgogs.log
, except the file name fromgogs.log
toxorm.log
. So that, user could set it to be rotated to avoid disk usage.