Skip to content

Commit

Permalink
fix: logger on Windows (#1947)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzp2010 authored Jun 23, 2021
1 parent e3debe5 commit 1fa139f
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 26 deletions.
3 changes: 2 additions & 1 deletion api/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,6 @@ func printInfo() {
fmt.Fprintf(os.Stdout, "%-8s: %s:%d\n", "HTTPS Listen", conf.SSLHost, conf.SSLPort)
}
fmt.Fprintf(os.Stdout, "%-8s: %s\n", "Loglevel", conf.ErrorLogLevel)
fmt.Fprintf(os.Stdout, "%-8s: %s\n\n", "Logfile", conf.ErrorLogPath)
fmt.Fprintf(os.Stdout, "%-8s: %s\n", "ErrorLogFile", conf.ErrorLogPath)
fmt.Fprintf(os.Stdout, "%-8s: %s\n\n", "AccessLogFile", conf.AccessLogPath)
}
2 changes: 2 additions & 0 deletions api/conf/conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ conf:
file_path:
logs/error.log # supports relative path, absolute path, standard output
# such as: logs/error.log, /tmp/logs/error.log, /dev/stdout, /dev/stderr
# such as absolute path on Windows: winfile:///C:\error.log
access_log:
file_path:
logs/access.log # supports relative path, absolute path, standard output
# such as: logs/access.log, /tmp/logs/access.log, /dev/stdout, /dev/stderr
# such as absolute path on Windows: winfile:///C:\access.log
# log example: 2020-12-09T16:38:09.039+0800 INFO filter/logging.go:46 /apisix/admin/routes/r1 {"status": 401, "host": "127.0.0.1:9000", "query": "asdfsafd=adf&a=a", "requestId": "3d50ecb8-758c-46d1-af5b-cd9d1c820156", "latency": 0, "remoteIP": "127.0.0.1", "method": "PUT", "errs": []}
max_cpu: 0 # supports tweaking with the number of OS threads are going to be used for parallelism. Default value: 0 [will use max number of available cpu cores considering hyperthreading (if any)]. If the value is negative, is will not touch the existing parallelism profile.

Expand Down
8 changes: 5 additions & 3 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/prometheus/client_golang v1.8.0 // indirect
github.com/satori/go.uuid v1.2.0
github.com/shiningrush/droplet v0.2.6-0.20210127040147-53817015cd1b
github.com/shiningrush/droplet/wrapper/gin v0.2.1
github.com/sirupsen/logrus v1.7.0 // indirect
github.com/sony/sonyflake v1.0.0
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
github.com/stretchr/testify v1.6.1
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.7.0
github.com/takama/daemon v1.0.0
github.com/tidwall/gjson v1.6.7
github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966 // indirect
Expand All @@ -43,6 +44,7 @@ require (
go.etcd.io/etcd v3.3.25+incompatible
go.uber.org/zap v1.16.0
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
gopkg.in/yaml.v2 v2.3.0
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
gopkg.in/yaml.v2 v2.4.0
sigs.k8s.io/yaml v1.2.0 // indirect
)
Loading

0 comments on commit 1fa139f

Please sign in to comment.