panlei
2019-12-09 2503b16872c17460471d69b565f0ff027340d1c0
main.go
@@ -3,13 +3,16 @@
import (
   "flag"
   "fmt"
   "github.com/spf13/viper"
   "sync"
   "net/http"
   _ "net/http/pprof"
   "plugin"
   //"github.com/spf13/viper"
   logger "github.com/alecthomas/log4go"
   //"basic.com/valib/logger.git"
   "basic.com/valib/logger.git"
   "github.com/panjf2000/ants/v2"
   "basic.com/pubsub/protomsg.git"
@@ -32,18 +35,18 @@
   flag.Parse()
   // 日志初始化
   insertdata.Init(*env)
   //var logFile = "./logger/"
   //if viper.GetString("LogBasePath") != "" {
   //   logFile = viper.GetString("LogBasePath")
   //}
   //logFile = logFile + "ruleprocess.log"
   //fmt.Println("日志地址:",logFile)
   //logger.Config(logFile, logger.DebugLevel)
   //logger.SetSaveDays(7)
   structure.Init(*env)
   var logFile = "./logger/"
   if viper.GetString("LogBasePath") != "" {
      logFile = viper.GetString("LogBasePath")
   }
   logFile = logFile + "ruleprocess.log"
   fmt.Println("日志地址:",logFile)
   logger.Config(logFile, logger.DebugLevel)
   logger.SetSaveDays(7)
   // log4go
   logger.LoadConfiguration("./logger/log.xml")
   logger.Info("日志初始化成功!")
   //logger.LoadConfiguration("./logger/log.xml")
   logger.Info("日志初始化成功!",logFile)
}
func main() {
@@ -89,6 +92,8 @@
         wg1.Add(1)
         _ = p.Submit(syncCalculateSum)
         //go Task(msg)
      } else {
         fmt.Println(err)
      }
   }
}