alptugay commented on issue #9756:
URL: https://github.com/apache/apisix/issues/9756#issuecomment-1621210986
We have a patch created for this problem. It may help:
```
--- a/grpc-engine/main.go 2023-06-15 02:22:56
+++ b/grpc-engine/main.go 2023-06-15 02:53:39
@@ -63,16 +63,38 @@
"github.com/api7/grpc-client-nginx-module/task"
)
+var (
+ logdir string = "/usr/local/apisix/logs/"
+ logfile string = "grpc-engine-debug.log"
+)
+
func main() {
}
func init() {
+ var f *os.File
+ var err error
+
+ if _, err := os.Stat(logdir); err != nil {
+ err := os.MkdirAll(logdir, 0755)
+ if err != nil {
+ log.Printf(err.Error())
+ return
+ }
+ }
+
// only keep the latest debug log
- f, err := os.OpenFile("/tmp/grpc-engine-debug.log",
os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
+ if _, err := os.Stat(logdir + logfile); err == nil {
+ f, err = os.OpenFile(logdir+logfile, os.O_WRONLY|os.O_TRUNC,
0666)
+ } else {
+ f, err = os.OpenFile(logdir+logfile, os.O_WRONLY|os.O_CREATE,
0666)
+ }
+
if err != nil {
log.Printf(err.Error())
return
}
+
log.Default().SetOutput(f)
log.Default().SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds |
log.Lshortfile)
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]