fix logging for backend
This commit is contained in:
parent
bbefe801d3
commit
de7ff1ed98
|
@ -104,7 +104,7 @@ func backendServer() {
|
|||
}
|
||||
|
||||
func runBackendServer() {
|
||||
proc := exec.Command(os.Args[0], "-datadir", dataDir, "backend")
|
||||
proc := exec.Command(os.Args[0], reexecArgs("backend")...)
|
||||
proc.Stdout = os.Stdout
|
||||
proc.Stderr = os.Stderr
|
||||
err := proc.Start()
|
||||
|
|
7
honk.go
7
honk.go
|
@ -259,6 +259,13 @@ func unplugserver(hostname string) {
|
|||
db.Exec("delete from doovers where rcpt like ?", xid)
|
||||
}
|
||||
|
||||
func reexecArgs(cmd string) []string {
|
||||
args := []string{"-datadir", dataDir}
|
||||
args = append(args, loggingArgs()...)
|
||||
args = append(args, cmd)
|
||||
return args
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.StringVar(&dataDir, "datadir", dataDir, "data directory")
|
||||
flag.StringVar(&viewDir, "viewdir", viewDir, "view directory")
|
||||
|
|
4
log.go
4
log.go
|
@ -42,6 +42,10 @@ func init() {
|
|||
|
||||
}
|
||||
|
||||
func loggingArgs() []string {
|
||||
return []string{"-errorlog", elogname, "-infolog", ilogname, "-debuglog", dlogname}
|
||||
}
|
||||
|
||||
func initLogging(elogname, ilogname, dlogname string) {
|
||||
elog = openlog(elogname, syslog.LOG_ERR)
|
||||
ilog = openlog(ilogname, syslog.LOG_INFO)
|
||||
|
|
Loading…
Reference in New Issue