cookieY/yee

主进程的console日志如何保存到日志文件中,自己配置的日志文件,但是不知道在哪里可以统一捕捉。

oyb001 opened this issue · 1 comments

Creator: Henry Yee
Run_start
2021-01-29 15:58:21.041223 | INFO | handle/general.go:64 | TestSqlInfo_a:work_id:5fb77681a6268f94651067ce:user:root:Host:172.30.7.150:Port:3307:DbName:inc_test:CloudId:5d9c2b02a1822c15b2b3e2c8:SqlFileList:[eip/workflow/93266b8c61fa11eba099525400cdf875/1.txt]
zerolog: could not write event: can't make directories for new logfile: mkdir /opt/appl/golang: permission denied
DefaultDbUser:sql_audit
2021-01-29 15:58:21.187310 | INFO | handle/util/file_convert_string.go:60 | sqlch.TaskGen:5fb77681a6268f94651067ce:contextjob_type:file:downloadurl:eip/workflow/93266b8c61fa11eba099525400cdf875/1.txt
zerolog: could not write event: can't make directories for new logfile: mkdir /opt/appl/golang: permission denied
Hey, I'm going to do some work
SubmitTask:downloadurl:eip/workflow/93266b8c61fa11eba099525400cdf875/1.txt:start2021-01-29 15:58:21.187487 | INFO | handle/util/file_convert_string.go:98 | SubmitTask:downloadurl:eip/workflow/93266b8c61fa11eba099525400cdf875/1.txt:start
zerolog: could not write event: can't make directories for new logfile: mkdir /opt/appl/golang: permission denied
2021-01-29 15:58:21.187635 | INFO | handle/util/file_convert_string.go:134 | SubmitTask:downloadurl:eip/workflow/93266b8c61fa11eba099525400cdf875/1.txt:send
zerolog: could not write event: can't make directories for new logfile: mkdir /opt/appl/golang: permission denied
2021-01-29 15:58:22.110334 | INFO | handle/util/file_convert_string.go:123 | SubmitTask%!(EXTRA string=Http Request is Send)
zerolog: could not write event: can't make directories for new logfile: mkdir /opt/appl/golang: permission denied
body select * from
panic: runtime error: index out of range [3] with length 1

goroutine 38 [running]:
sql-audit/handle/util.FileNameAndDbname(0xc0001b4040, 0x33, 0xc000092e38, 0x2, 0x2, 0x13, 0x0, 0x0)
/Users/ouyangbin/Documents/001_work/01_git/sql-audit/handle/util/file_convert_string.go:194 +0x182
sql-audit/handle/util.(*SqlContextHandle).SubmitTask(0xc0001ba070, 0x19e72e0, 0xc0001023c0, 0xc0002da1d0, 0x18ad50e, 0x4, 0x0, 0x0, 0xc0001b4040, 0x33, ...)
/Users/ouyangbin/Documents/001_work/01_git/sql-audit/handle/util/file_convert_string.go:180 +0xc01
created by sql-audit/handle/util.(*SqlContextHandle).WorkSendM
/Users/ouyangbin/Documents/001_work/01_git/sql-audit/handle/util/file_convert_string.go:87 +0x19c

Process finished with exit code 2

v0.2.8

file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
	
	if err != nil {
	    return
	}
	
	y.SetLogOut(file)