fix: fix non-json logs with log_as_json enabled (#3779)

Signed-off-by: CH3CHO <ch3cho@qq.com>
This commit is contained in:
Kent Dong
2026-04-30 18:03:33 +08:00
committed by GitHub
parent 74c68180c8
commit 4e0d691432
14 changed files with 15 additions and 22 deletions

View File

@@ -18,7 +18,7 @@ import (
"fmt"
"os"
"istio.io/pkg/log"
"istio.io/istio/pkg/log"
"github.com/alibaba/higress/v2/pkg/cmd"
)

View File

@@ -17,14 +17,12 @@ package cert
import (
"context"
"fmt"
"os"
"reflect"
"sync"
"github.com/caddyserver/certmagic"
"github.com/mholt/acmez"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
istiomodel "istio.io/istio/pilot/pkg/model"
"k8s.io/client-go/kubernetes"
)
@@ -60,11 +58,7 @@ func InitCertMgr(opts *Option, clientSet kubernetes.Interface, config *Config, X
var storage certmagic.Storage
storage, _ = NewConfigmapStorage(opts.Namespace, clientSet)
renewalWindowRatio := float64(config.RenewBeforeDays) / float64(RenewMaxDays)
logger := zap.New(zapcore.NewCore(
zapcore.NewConsoleEncoder(zap.NewProductionEncoderConfig()),
os.Stderr,
zap.DebugLevel,
))
logger := zap.L()
magicConfig := certmagic.Config{
RenewalWindowRatio: renewalWindowRatio,
Storage: storage,

View File

@@ -23,7 +23,7 @@ import (
consulapi "github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/api/watch"
"istio.io/api/networking/v1alpha3"
"istio.io/pkg/log"
"istio.io/istio/pkg/log"
apiv1 "github.com/alibaba/higress/v2/api/networking/v1"
"github.com/alibaba/higress/v2/pkg/common"

View File

@@ -22,7 +22,7 @@ import (
"sync"
"istio.io/api/networking/v1alpha3"
"istio.io/pkg/log"
"istio.io/istio/pkg/log"
apiv1 "github.com/alibaba/higress/v2/api/networking/v1"
"github.com/alibaba/higress/v2/pkg/common"
@@ -268,4 +268,3 @@ func (w *watcher) getSni(se *v1alpha3.ServiceEntry) string {
func (w *watcher) GetRegistryType() string {
return w.RegistryConfig.Type
}

View File

@@ -24,7 +24,7 @@ import (
"github.com/avast/retry-go/v4"
"github.com/hudl/fargo"
"istio.io/pkg/log"
"istio.io/istio/pkg/log"
)
var httpClient = http.DefaultClient

View File

@@ -16,7 +16,7 @@ package client
import (
"github.com/hudl/fargo"
"istio.io/pkg/log"
"istio.io/istio/pkg/log"
)
type Handler func(application *fargo.Application) error

View File

@@ -23,7 +23,7 @@ import (
"github.com/hudl/fargo"
"istio.io/api/networking/v1alpha3"
"istio.io/pkg/log"
"istio.io/istio/pkg/log"
apiv1 "github.com/alibaba/higress/v2/api/networking/v1"
"github.com/alibaba/higress/v2/pkg/common"

View File

@@ -28,7 +28,7 @@ import (
"istio.io/api/networking/v1alpha3"
"istio.io/istio/pkg/config"
"istio.io/istio/pkg/config/schema/gvk"
"istio.io/pkg/log"
"istio.io/istio/pkg/log"
"github.com/alibaba/higress/v2/pkg/common"
higressconfig "github.com/alibaba/higress/v2/pkg/config"

View File

@@ -25,7 +25,7 @@ import (
"time"
"go.uber.org/atomic"
"istio.io/pkg/log"
"istio.io/istio/pkg/log"
)
const (

View File

@@ -32,7 +32,7 @@ import (
"github.com/nacos-group/nacos-sdk-go/v2/vo"
"go.uber.org/atomic"
"istio.io/api/networking/v1alpha3"
"istio.io/pkg/log"
"istio.io/istio/pkg/log"
apiv1 "github.com/alibaba/higress/v2/api/networking/v1"
"github.com/alibaba/higress/v2/pkg/common"

View File

@@ -27,7 +27,7 @@ import (
"github.com/nacos-group/nacos-sdk-go/model"
"github.com/nacos-group/nacos-sdk-go/vo"
"istio.io/api/networking/v1alpha3"
"istio.io/pkg/log"
"istio.io/istio/pkg/log"
apiv1 "github.com/alibaba/higress/v2/api/networking/v1"
"github.com/alibaba/higress/v2/pkg/common"

View File

@@ -23,7 +23,7 @@ import (
"sync"
"time"
"istio.io/pkg/log"
"istio.io/istio/pkg/log"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
apiv1 "github.com/alibaba/higress/v2/api/networking/v1"

View File

@@ -21,7 +21,7 @@ import (
apiv1 "github.com/alibaba/higress/v2/api/networking/v1"
"istio.io/api/networking/v1alpha3"
"istio.io/pkg/log"
"istio.io/istio/pkg/log"
)
const (

View File

@@ -30,7 +30,7 @@ import (
"github.com/hashicorp/go-multierror"
"go.uber.org/atomic"
"istio.io/api/networking/v1alpha3"
"istio.io/pkg/log"
"istio.io/istio/pkg/log"
apiv1 "github.com/alibaba/higress/v2/api/networking/v1"
"github.com/alibaba/higress/v2/pkg/common"
@@ -665,7 +665,7 @@ func (w *watcher) Run() {
defer func() {
log.Info("[zookeeper] Run is down")
if r := recover(); r != nil {
log.Info("Recovered in f", "r is", r)
log.Infof("Recovered in Run: %v", r)
}
}()
ticker := time.NewTicker(30 * time.Second)