Golang's echo framework log is located in the file. Default is stdio

golang"s echo framework log is located in the file. By default, stdio, is found to be unavailable after modification

I don"t know what the problem is, file design 0777


fd, _ := os.OpenFile(
        LogPath,
        os.O_RDWR|os.O_APPEND,
        0666,
    )

e.Use(middleware.LoggerWithConfig(
        middleware.LoggerConfig{
            Format: "method=${method}, uri=${uri}, status=${status}\n",
            Output: fd,
        }))

    e.Logger.SetOutput(fd)
The

problem has been resolved, not a code problem. It"s a log file deadlock.

Mar.22,2021

it is recommended that you specify the write file with log, and use

in middleware.
Menu