forked from richyen/walker
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlog.go
More file actions
35 lines (30 loc) · 619 Bytes
/
log.go
File metadata and controls
35 lines (30 loc) · 619 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package walker
import (
"os"
"os/signal"
"syscall"
"code.google.com/p/log4go"
)
const logname = "log4go.xml"
// init sets the default log4go configuration and attempts to read a log4go.xml
// file if available
func init() {
log4go.AddFilter("stdout", log4go.INFO, log4go.NewConsoleLogWriter())
loadLog4goConfig()
sig := make(chan os.Signal)
signal.Notify(sig, syscall.SIGHUP)
go func() {
for {
<-sig
loadLog4goConfig()
}
}()
}
func loadLog4goConfig() {
log4go.Debug("Loading configuration")
_, err := os.Stat(logname)
if os.IsNotExist(err) {
return
}
log4go.LoadConfiguration(logname)
}