Skip to content

Commit 09f7f72

Browse files
authored
fix: missing logs in log file (#3028)
* fix: missing logs in log file * fix: use logger instead of log
1 parent 1edb63f commit 09f7f72

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

cns/service.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/Azure/azure-container-networking/cns/logger"
1818
acn "github.com/Azure/azure-container-networking/common"
1919
"github.com/Azure/azure-container-networking/keyvault"
20-
"github.com/Azure/azure-container-networking/log"
2120
localtls "github.com/Azure/azure-container-networking/server/tls"
2221
"github.com/Azure/azure-container-networking/store"
2322
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
@@ -112,7 +111,7 @@ func (service *Service) AddListener(config *common.ServiceConfig) error {
112111
// Start the listener and HTTP and HTTPS server.
113112
tlsConfig, err := getTLSConfig(config.TLSSettings, config.ErrChan) //nolint
114113
if err != nil {
115-
log.Printf("Failed to compose Tls Configuration with error: %+v", err)
114+
logger.Printf("Failed to compose Tls Configuration with error: %+v", err)
116115
return errors.Wrap(err, "could not get tls config")
117116
}
118117

@@ -122,14 +121,14 @@ func (service *Service) AddListener(config *common.ServiceConfig) error {
122121
}
123122

124123
service.Listener = nodeListener
125-
log.Debugf("[Azure CNS] Successfully initialized a service with config: %+v", config)
124+
logger.Debugf("[Azure CNS] Successfully initialized a service with config: %+v", config)
126125

127126
return nil
128127
}
129128

130129
// Initialize initializes the service and starts the listener.
131130
func (service *Service) Initialize(config *common.ServiceConfig) error {
132-
log.Debugf("[Azure CNS] Going to initialize a service with config: %+v", config)
131+
logger.Debugf("[Azure CNS] Going to initialize a service with config: %+v", config)
133132

134133
// Initialize the base service.
135134
if err := service.Service.Initialize(config); err != nil {
@@ -281,11 +280,11 @@ func mtlsRootCAsFromCertificate(tlsCert *tls.Certificate) (*x509.CertPool, error
281280
}
282281

283282
func (service *Service) StartListener(config *common.ServiceConfig) error {
284-
log.Debugf("[Azure CNS] Going to start listener: %+v", config)
283+
logger.Debugf("[Azure CNS] Going to start listener: %+v", config)
285284

286285
// Initialize the listener.
287286
if service.Listener != nil {
288-
log.Debugf("[Azure CNS] Starting listener: %+v", config)
287+
logger.Debugf("[Azure CNS] Starting listener: %+v", config)
289288
// Start the listener.
290289
// continue to listen on the normal endpoint for http traffic, this will be supported
291290
// for sometime until partners migrate fully to https
@@ -315,5 +314,5 @@ func (service *Service) ParseOptions(options OptionMap) OptionMap {
315314
func (service *Service) SendErrorResponse(w http.ResponseWriter, errMsg error) {
316315
resp := errorResponse{errMsg.Error()}
317316
err := acn.Encode(w, &resp)
318-
log.Errorf("[%s] %+v %s.", service.Name, &resp, err.Error())
317+
logger.Errorf("[%s] %+v %s.", service.Name, &resp, err.Error())
319318
}

cns/service/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ func main() {
672672
}
673673

674674
if telemetryDaemonEnabled {
675-
log.Printf("CNI Telemtry is enabled")
675+
logger.Printf("CNI Telemtry is enabled")
676676
go startTelemetryService(rootCtx)
677677
}
678678

@@ -687,7 +687,7 @@ func main() {
687687

688688
lockclient, err := processlock.NewFileLock(platform.CNILockPath + name + store.LockExtension)
689689
if err != nil {
690-
log.Printf("Error initializing file lock:%v", err)
690+
logger.Printf("Error initializing file lock:%v", err)
691691
return
692692
}
693693

@@ -701,10 +701,10 @@ func main() {
701701

702702
// Initialize endpoint state store if cns is managing endpoint state.
703703
if cnsconfig.ManageEndpointState {
704-
log.Printf("[Azure CNS] Configured to manage endpoints state")
704+
logger.Printf("[Azure CNS] Configured to manage endpoints state")
705705
endpointStoreLock, err := processlock.NewFileLock(platform.CNILockPath + endpointStoreName + store.LockExtension) // nolint
706706
if err != nil {
707-
log.Printf("Error initializing endpoint state file lock:%v", err)
707+
logger.Printf("Error initializing endpoint state file lock:%v", err)
708708
return
709709
}
710710
defer endpointStoreLock.Unlock() // nolint
@@ -1039,7 +1039,7 @@ func main() {
10391039
}
10401040

10411041
if err = lockclient.Unlock(); err != nil {
1042-
log.Errorf("lockclient cns unlock error:%v", err)
1042+
logger.Errorf("lockclient cns unlock error:%v", err)
10431043
}
10441044

10451045
logger.Printf("CNS exited")

0 commit comments

Comments
 (0)