Dapr进阶-02-查看Dapr日志

2023-12-09 21:39
文章标签 进阶 日志 查看 02 dapr

本文主要是介绍Dapr进阶-02-查看Dapr日志,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1. 查看控制面日志

1.1. 查看控制面pod

kubectl get pod -n dapr-system
NAME                                    READY   STATUS    RESTARTS   AGE
dapr-dashboard-5b7dd7b657-2zkkh         1/1     Running   0          3h41m
dapr-operator-5654bb56b5-296wz          1/1     Running   0          3h41m
dapr-placement-server-0                 1/1     Running   0          3h41m
dapr-sentry-787dd7d995-kfxc9            1/1     Running   0          3h41m
dapr-sidecar-injector-c9498dbfb-q8lql   1/1     Running   0          3h41m

1.2. 查看dashboard日志

kubectl logs -l app=dapr-dashboard -n dapr-system
Dapr Dashboard running on http://localhost:8080

1.3. 查看operator日志 

kubectl logs -l app=dapr-operator -n dapr-system
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"getting tls certificates","scope":"dapr.operator","time":"2022-02-19T03:40:24.651194191Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"starting watch for certs on filesystem: /var/run/dapr/credentials","scope":"dapr.operator","time":"2022-02-19T03:40:24.65123001Z","type":"log","ver":"1.6.0"}
I0219 03:40:24.649795       1 leaderelection.go:243] attempting to acquire leader lease dapr-system/webhooks.dapr.io...
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"Successfully patched webhook in CRD \"subscriptions.dapr.io\"","scope":"dapr.operator","time":"2022-02-19T03:40:24.665018551Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"certificates detected","scope":"dapr.operator","time":"2022-02-19T03:40:26.542818142Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"tls certificates loaded successfully","scope":"dapr.operator","time":"2022-02-19T03:40:26.542934089Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"starting gRPC server","scope":"dapr.operator.api","time":"2022-02-19T03:40:26.543163223Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-operator-5654bb56b5-296wz","level":"info","msg":"Healthz server is listening on :8080","scope":"dapr.operator","time":"2022-02-19T03:40:26.54321365Z","type":"log","ver":"1.6.0"}
I0219 03:40:40.238847       1 leaderelection.go:253] successfully acquired lease dapr-system/operator.dapr.io
I0219 03:40:40.515280       1 leaderelection.go:253] successfully acquired lease dapr-system/webhooks.dapr.io

1.4. 查看placement日志  

kubectl logs -l app=dapr-placement-server -n dapr-system

{"instance":"dapr-placement-server-0","level":"info","msg":"metrics server started on :9090/","scope":"dapr.metrics","time":"2022-02-19T03:40:25.032029995Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"Raft server is starting on 127.0.0.1:8201...","scope":"dapr.placement.raft","time":"2022-02-19T03:40:25.032202627Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"mTLS enabled, getting tls certificates","scope":"dapr.placement","time":"2022-02-19T03:40:25.032217652Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"starting watch for certs on filesystem: /var/run/dapr/credentials","scope":"dapr.placement","time":"2022-02-19T03:40:25.032241757Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"certificates detected","scope":"dapr.placement","time":"2022-02-19T03:40:26.543695359Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"tls certificates loaded successfully","scope":"dapr.placement","time":"2022-02-19T03:40:26.543776867Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"placement service started on port 50005","scope":"dapr.placement","time":"2022-02-19T03:40:26.543793794Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"cluster leadership acquired","scope":"dapr.placement","time":"2022-02-19T03:40:26.544124116Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"Healthz server is listening on :8080","scope":"dapr.placement","time":"2022-02-19T03:40:26.544172756Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-placement-server-0","level":"info","msg":"leader is established.","scope":"dapr.placement","time":"2022-02-19T03:40:26.544193223Z","type":"log","ver":"1.6.0"}

 1.5. 查看sentry日志  

kubectl logs -l app=dapr-sentry -n dapr-system
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"info","msg":"Healthz server is listening on :8080","scope":"dapr.sentry","time":"2022-02-19T03:40:24.754579249Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"warning","msg":"issuer credentials changed. reloading","scope":"dapr.sentry","time":"2022-02-19T03:40:26.542959438Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"info","msg":"certificate authority loaded","scope":"dapr.sentry","time":"2022-02-19T03:40:26.543041398Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"warning","msg":"issuer credentials changed. reloading","scope":"dapr.sentry","time":"2022-02-19T03:40:27.543136292Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"info","msg":"trust root bundle loaded. issuer cert expiry: 2023-02-19 03:40:24 +0000 UTC","scope":"dapr.sentry","time":"2022-02-19T03:40:27.55143922Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"info","msg":"validator created","scope":"dapr.sentry","time":"2022-02-19T03:40:27.55217503Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"info","msg":"sentry certificate authority is running, protecting ya'll","scope":"dapr.sentry","time":"2022-02-19T03:40:27.552211046Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"warning","msg":"issuer credentials changed. reloading","scope":"dapr.sentry","time":"2022-02-19T03:40:28.543219987Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"warning","msg":"issuer credentials changed. reloading","scope":"dapr.sentry","time":"2022-02-19T03:40:29.543350066Z","type":"log","ver":"1.6.0"}
{"instance":"dapr-sentry-787dd7d995-kfxc9","level":"warning","msg":"issuer credentials changed. reloading","scope":"dapr.sentry","time":"2022-02-19T03:40:30.543436621Z","type":"log","ver":"1.6.0"}

  1.6. 查看injector日志

kubectl logs -l app=dapr-sidecar-injector -n dapr-system
{"instance":"node-slave","level":"info","msg":"Sidecar injector is listening on :4000, patching Dapr-enabled pods","scope":"dapr.injector","time":"2022-02-19T03:40:23.681036027Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"AdmissionReview for Kind=/v1, Kind=Pod, Namespace=dapr-demo Name= () UID=0a42eb04-1906-400b-8439-28cfeb23d420 patchOperation=CREATE UserInfo={system:serviceaccount:kube-system:replicaset-controller fe3cd86c-80ed-407f-b9a5-83ab709863b9 [system:serviceaccounts system:serviceaccounts:kube-system system:authenticated] map[]}","scope":"dapr.injector","time":"2022-02-19T05:37:05.591106282Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"AdmissionReview for Kind=/v1, Kind=Pod, Namespace=dapr-demo Name= () UID=55c8225b-ea68-42c2-baa5-e4cba3be3937 patchOperation=CREATE UserInfo={system:serviceaccount:kube-system:replicaset-controller fe3cd86c-80ed-407f-b9a5-83ab709863b9 [system:serviceaccounts system:serviceaccounts:kube-system system:authenticated] map[]}","scope":"dapr.injector","time":"2022-02-19T05:37:05.591419373Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"ready to write response ...","scope":"dapr.injector","time":"2022-02-19T05:37:05.604812267Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"ready to write response ...","scope":"dapr.injector","time":"2022-02-19T05:37:05.604844148Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"Sidecar injector succeeded injection for app 'service01'","scope":"dapr.injector","time":"2022-02-19T05:37:05.60532952Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"Sidecar injector succeeded injection for app 'service02'","scope":"dapr.injector","time":"2022-02-19T05:37:05.606280729Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"AdmissionReview for Kind=/v1, Kind=Pod, Namespace=dapr-demo Name= () UID=354a2436-3702-4af3-83c0-73383a16ce4b patchOperation=CREATE UserInfo={system:serviceaccount:kube-system:replicaset-controller fe3cd86c-80ed-407f-b9a5-83ab709863b9 [system:serviceaccounts system:serviceaccounts:kube-system system:authenticated] map[]}","scope":"dapr.injector","time":"2022-02-19T05:37:05.617482582Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"ready to write response ...","scope":"dapr.injector","time":"2022-02-19T05:37:05.6371212Z","type":"log","ver":"1.6.0"}
{"instance":"node-slave","level":"info","msg":"Sidecar injector succeeded injection for app 'service01'","scope":"dapr.injector","time":"2022-02-19T05:37:05.637204881Z","type":"log","ver":"1.6.0"}

2. 查看service pod日志

2.1. 查看service pod

kubectl get pods -n dapr-demo
NAME                         READY   STATUS             RESTARTS         AGE
service01-7cc7c54c65-g4jzw   1/2     CrashLoopBackOff   26 (2m22s ago)   111m
service01-7cc7c54c65-gsf8c   1/2     CrashLoopBackOff   26 (85s ago)     111m
service02-6d849d9f97-mk286   1/2     CrashLoopBackOff   26 (2m14s ago)   111m

2.2. 描述pod的整体信息

kubectl describe pod service01-7cc7c54c65-g4jzw -n dapr-demo
Name:         service01-7cc7c54c65-g4jzw
Namespace:    dapr-demo
Priority:     0
Node:         node-slave/192.168.0.204
Start Time:   Sat, 19 Feb 2022 13:37:05 +0800
Labels:       app=service01pod-template-hash=7cc7c54c65
Annotations:  dapr.io/app-id: service01dapr.io/app-port: 80dapr.io/enable-debug: truedapr.io/enabled: truedapr.io/log-as-json: truedapr.io/sidecar-liveness-probe-delay-seconds: 10dapr.io/sidecar-readiness-probe-delay-seconds: 10
Status:       Running
IP:           10.44.0.5
IPs:IP:           10.44.0.5
Controlled By:  ReplicaSet/service01-7cc7c54c65
Containers:service01:Container ID:   docker://e875b665df3b0ce52e07635ac587ae1406ff9e208d197083b5ad921eb3edde46Image:          docker.io/k8schina/service01:v1Image ID:       docker-pullable://k8schina/service01@sha256:8ead4a7aa2eac005badfbac0c615b2be930aada2a17994e7891b720c62da2abbPort:           80/TCPHost Port:      0/TCPState:          RunningStarted:      Sat, 19 Feb 2022 13:37:25 +0800Ready:          TrueRestart Count:  0Environment:DAPR_HTTP_PORT:  3500DAPR_GRPC_PORT:  50001Mounts:/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-s2f8g (ro)daprd:Container ID:  docker://4cf1fac4f809945132bcb28f00b62bd974c1036c32f56b56781fa3cd958f8dd1Image:         docker.io/daprio/daprd:1.6.0Image ID:      docker-pullable://daprio/daprd@sha256:db7ce4723d61566a2e6be24bd7d136e317023cf11ee78b9c6f55c00ec0c6223fPorts:         3500/TCP, 50001/TCP, 50002/TCP, 9090/TCP, 40000/TCPHost Ports:    0/TCP, 0/TCP, 0/TCP, 0/TCP, 0/TCPCommand:/dlvArgs:--listen=:40000--accept-multiclient--headless=true--log--api-version=2exec/daprd----modekubernetes--dapr-http-port3500--dapr-grpc-port50001--dapr-internal-grpc-port50002--dapr-listen-addresses[::1],127.0.0.1--dapr-public-port3501--app-port80--app-idservice01--control-plane-addressdapr-api.dapr-system.svc.cluster.local:80--app-protocolhttp--placement-host-addressdapr-placement-server.dapr-system.svc.cluster.local:50005--config--log-levelinfo--app-max-concurrency-1--sentry-addressdapr-sentry.dapr-system.svc.cluster.local:80--enable-metrics=true--metrics-port9090--dapr-http-max-request-size-1--dapr-http-read-buffer-size-1--dapr-graceful-shutdown-seconds-1--log-as-json--enable-mtlsState:          WaitingReason:       CrashLoopBackOffLast State:     TerminatedReason:       ContainerCannotRunMessage:      OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/dlv": stat /dlv: no such file or directory: unknownExit Code:    127Started:      Sat, 19 Feb 2022 16:01:45 +0800Finished:     Sat, 19 Feb 2022 16:01:45 +0800Ready:          FalseRestart Count:  33Liveness:       http-get http://:3501/v1.0/healthz delay=10s timeout=3s period=6s #success=1 #failure=3Readiness:      http-get http://:3501/v1.0/healthz delay=10s timeout=3s period=6s #success=1 #failure=3Environment:NAMESPACE:              dapr-demoDAPR_TRUST_ANCHORS:     -----BEGIN CERTIFICATE-----MIIB2zCCAYKgAwIBAgIRAMWpJtBC5uk9Folb7dBap/0wCgYIKoZIzj0EAwIwMTEXMBUGA1UEChMOZGFwci5pby9zZW50cnkxFjAUBgNVBAMTDWNsdXN0ZXIubG9jYWwwHhcNMjIwMjE5MDMyNTI0WhcNMjMwMjE5MDM0MDI0WjAxMRcwFQYDVQQKEw5kYXByLmlvL3NlbnRyeTEWMBQGA1UEAxMNY2x1c3Rlci5sb2NhbDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABFe0HFo8WfhDK3UzH84uh3ra9veCh4YBUH3eLD7XaaDR/gnGK28DDP+P6YMVzhV0/sWe2/Ztr2ggQmWensD09K2jezB5MA4GA1UdDwEB/wQEAwICBDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUCMQ2YWm8hnbar1tunG0+zkyehn0wGAYDVR0RBBEwD4INY2x1c3Rlci5sb2NhbDAKBggqhkjOPQQDAgNHADBEAiB+v/xvuHpKwkyTvdLDjFLEStRPGcqVXqp5WbMlFs2JTwIgVR3ehcuItyV872tFUYFCISbiARGxbJzgPs9OQnvHjPM=-----END CERTIFICATE-----DAPR_CERT_CHAIN:        -----BEGIN CERTIFICATE-----MIIBxjCCAWugAwIBAgIRAIXuoUC5KTyCXjVOdmbhI1UwCgYIKoZIzj0EAwIwMTEXMBUGA1UEChMOZGFwci5pby9zZW50cnkxFjAUBgNVBAMTDWNsdXN0ZXIubG9jYWwwHhcNMjIwMjE5MDMyNTI0WhcNMjMwMjE5MDM0MDI0WjAYMRYwFAYDVQQDEw1jbHVzdGVyLmxvY2FsMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeGahgXjsvOXPIkAWopUtFHvvBUNFWkmDyxdllNVJKvH6X0JYmW7y88VeVIeHIr0qHefaQxSw0xBJgaK0EdQG7qN9MHswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFIAvF908laB8Y4eSZCq+3lBWHIJNMB8GA1UdIwQYMBaAFAjENmFpvIZ22q9bbpxtPs5MnoZ9MBgGA1UdEQQRMA+CDWNsdXN0ZXIubG9jYWwwCgYIKoZIzj0EAwIDSQAwRgIhANvDUJA1fE3Vu0NlrDVIua2Zq/ooaDbiFqnYHYSRJ298AiEA8KTqLv2Rf39t2rMQc1UEQEMMGY8GAhX6k0a169kbz8Y=-----END CERTIFICATE-----DAPR_CERT_KEY:          -----BEGIN EC PRIVATE KEY-----MHcCAQEEIIYFyiu9kkn89a5lfBBgmiPIH7UGDet1FxlmLqdKZnhPoAoGCCqGSM49AwEHoUQDQgAEeGahgXjsvOXPIkAWopUtFHvvBUNFWkmDyxdllNVJKvH6X0JYmW7y88VeVIeHIr0qHefaQxSw0xBJgaK0EdQG7g==-----END EC PRIVATE KEY-----SENTRY_LOCAL_IDENTITY:  dapr-demo:defaultMounts:/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-s2f8g (ro)
Conditions:Type              StatusInitialized       TrueReady             FalseContainersReady   FalsePodScheduled      True
Volumes:kube-api-access-s2f8g:Type:                    Projected (a volume that contains injected data from multiple sources)TokenExpirationSeconds:  3607ConfigMapName:           kube-root-ca.crtConfigMapOptional:       <nil>DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300snode.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:Type     Reason   Age                     From     Message----     ------   ----                    ----     -------Warning  BackOff  2m23s (x712 over 147m)  kubelet  Back-off restarting failed container

2.3. 查看pod中所有container的日志

kubectl logs service01-7cc7c54c65-g4jzw --all-containers=true -n dapr-demo
{"EventId":14,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://[::]:80","State":{"Message":"Now listening on: http://[::]:80","address":"http://[::]:80","{OriginalFormat}":"Now listening on: {address}"}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Application started. Press Ctrl\u002BC to shut down.","State":{"Message":"Application started. Press Ctrl\u002BC to shut down.","{OriginalFormat}":"Application started. Press Ctrl\u002BC to shut down."}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Hosting environment: Production","State":{"Message":"Hosting environment: Production","envName":"Production","{OriginalFormat}":"Hosting environment: {envName}"}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Content root path: /app/","State":{"Message":"Content root path: /app/","contentRoot":"/app/","{OriginalFormat}":"Content root path: {contentRoot}"}}

2.4. 查看pod中dapr container的日志

kubectl logs service01-7cc7c54c65-g4jzw -c daprd -n dapr-demo

2.5. 查看pod中dapr container最近几行日志

  • --tail=-1 查看所有行日志
kubectl logs --tail=10 service01-7cc7c54c65-g4jzw -c daprd -n dapr-demo

2.6. 持续查看pod中dapr container的日志

kubectl logs -f service01-7cc7c54c65-g4jzw -c daprd -n dapr-demo

2.7. 按label查看日志

kubectl logs --selector=app=service01 --all-containers -n dapr-demo

3. 查看系统日志

3.1. 使用 tail 工具

tail /var/log/messages -f
Feb 19 16:32:58 localhost kubelet[1077]: E0219 16:32:58.466307    1077 pod_workers.go:918] "Error syncing pod, skipping" err="failed to \"StartContainer\" for \"daprd\" with CrashLoopBackOff: \"back-off 5m0s restarting failed container=daprd pod=service01-7cc7c54c65-gsf8c_dapr-demo(efa871c5-0f1d-41e1-b66f-95fff64c9d37)\"" pod="dapr-demo/service01-7cc7c54c65-gsf8c" podUID=efa871c5-0f1d-41e1-b66f-95fff

3.2. 使用 journalctl 工具

3.2.1. 查看最近的所有日志的前10行

journalctl -r -n 10
-- Logs begin at Tue 2021-12-28 23:05:04 CST, end at Sat 2022-02-19 16:41:01 CST. --
Feb 19 16:40:09 node-master systemd[1]: sysstat-collect.service: Succeeded.
Feb 19 16:40:09 node-master systemd[1]: Starting system activity accounting tool...
Feb 19 16:36:04 node-master systemd-logind[802]: Removed session 4.
Feb 19 16:36:04 node-master systemd-logind[802]: Session 4 logged out. Waiting for processes to exit.
Feb 19 16:36:04 node-master systemd[1]: session-4.scope: Succeeded.
Feb 19 16:36:04 node-master sshd[39571]: pam_unix(sshd:session): session closed for user root
Feb 19 16:36:01 node-master systemd-logind[802]: Removed session 1.
Feb 19 16:36:01 node-master systemd[1]: session-1.scope: Succeeded.
Feb 19 16:36:01 node-master systemd-logind[802]: Session 1 logged out. Waiting for processes to exit.
Feb 19 16:36:01 node-master sshd[3605]: pam_unix(sshd:session): session closed for user root

3.2.2. 查看指定应用的日志

journalctl -ru kubelet
journalctl -ru kube-scheduler
journalctl -ru kube-apiserver

3.2.3. 结合使用

journalctl -ru kubelet | grep cni | tail -n 5
 network plugin is not ready: cni config uninitialized"
Feb 17 17:18:56 node-master kubelet[42457]: I0217 17:18:56.564503   42457 cni.go:240] "Unable to update cni config" err="no networks found in /etc/cni/net.d"
Feb 17 17:18:56 node-master kubelet[42457]: I0217 17:18:56.564436   42457 docker_service.go:258] "Docker cri networking managed by the network plugin" networkPluginName="cni"
Feb 17 17:18:56 node-master kubelet[42457]: I0217 17:18:56.564377   42457 cni.go:240] "Unable to update cni config" err="no networks found in /etc/cni/net.d"
Feb 17 17:18:56 node-master kubelet[42457]: I0217 17:18:56.560754   42457 cni.go:240] "Unable to update cni config" err="no networks found in /etc/cni/net.d"

4. 用docker查看日志

4.1. 查看docker container

docker ps | grep k8schina/service02
690594264b75   k8schina/service02                                  "dotnet Service02.dll"   3 hours ago    Up 3 hours              k8s_service02_service02-6d849d9f97-mk286_dapr-demo_f3274fb9-9ce3-4a58-9872-bfccf4f473b6_0

4.2. 查看指定container日志

docker logs 690594264b75
{"EventId":14,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://[::]:80","State":{"Message":"Now listening on: http://[::]:80","address":"http://[::]:80","{OriginalFormat}":"Now listening on: {address}"}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Application started. Press Ctrl\u002BC to shut down.","State":{"Message":"Application started. Press Ctrl\u002BC to shut down.","{OriginalFormat}":"Application started. Press Ctrl\u002BC to shut down."}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Hosting environment: Production","State":{"Message":"Hosting environment: Production","envName":"Production","{OriginalFormat}":"Hosting environment: {envName}"}}
{"EventId":0,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Content root path: /app/","State":{"Message":"Content root path: /app/","contentRoot":"/app/","{OriginalFormat}":"Content root path: {contentRoot}"}}
{"EventId":13,"LogLevel":"Error","Category":"Microsoft.AspNetCore.Server.Kestrel","Message":"Connection id \u00220HMFJDGT5UAFQ\u0022, Request id \u00220HMFJDGT5UAFQ:00000002\u0022: An unhandled exception was thrown by the application.","Exception":"Dapr.Client.InvocationException: An exception occurred while invoking method: \u0027api/hello\u0027 on app-id: \u0027service01\u0027  ---\u003E System.Net.Http.HttpRequestException: Connection refused (127.0.0.1:3500)  ---\u003E System.Net.Sockets.SocketException (111): Connection refused    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)    at System.Net.Sockets.Socket.\u003CConnectAsync\u003Eg__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)    --- End of inner exception stack trace ---    at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)    at System.Threading.Tasks.TaskCompletionSourceWithCancellation\u00601.WaitWithCancellationAsync(CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)    at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpClient.\u003CSendAsync\u003Eg__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)    at Dapr.Client.DaprClientGrpc.InvokeMethodWithResponseAsync(HttpRequestMessage request, CancellationToken cancellationToken)    --- End of inner exception stack trace ---    at Dapr.Client.DaprClientGrpc.InvokeMethodWithResponseAsync(HttpRequestMessage request, CancellationToken cancellationToken)    at Dapr.Client.DaprClientGrpc.InvokeMethodAsync[TResponse](HttpRequestMessage request, CancellationToken cancellationToken)    at Service02.Controllers.HelloController.Hello() in /src/Service02/Controller/HelloController.cs:line 20    at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeActionMethodAsync\u003Eg__Awaited|12_0(ControllerActionInvoker invoker, ValueTask\u00601 actionResultValueTask)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeNextActionFilterAsync\u003Eg__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State\u0026 next, Scope\u0026 scope, Object\u0026 state, Boolean\u0026 isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeInnerFilterAsync\u003Eg__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeFilterPipelineAsync\u003Eg__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeAsync\u003Eg__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeAsync\u003Eg__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)    at Microsoft.AspNetCore.Routing.EndpointMiddleware.\u003CInvoke\u003Eg__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)    at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication\u00601 application)","State":{"Message":"Connection id \u00220HMFJDGT5UAFQ\u0022, Request id \u00220HMFJDGT5UAFQ:00000002\u0022: An unhandled exception was thrown by the application.","ConnectionId":"0HMFJDGT5UAFQ","TraceIdentifier":"0HMFJDGT5UAFQ:00000002","{OriginalFormat}":"Connection id \u0022{ConnectionId}\u0022, Request id \u0022{TraceIdentifier}\u0022: An unhandled exception was thrown by the application."}}
{"EventId":13,"LogLevel":"Error","Category":"Microsoft.AspNetCore.Server.Kestrel","Message":"Connection id \u00220HMFJDGT5UAFR\u0022, Request id \u00220HMFJDGT5UAFR:00000002\u0022: An unhandled exception was thrown by the application.","Exception":"Dapr.Client.InvocationException: An exception occurred while invoking method: \u0027api/hello\u0027 on app-id: \u0027service01\u0027  ---\u003E System.Net.Http.HttpRequestException: Connection refused (127.0.0.1:3500)  ---\u003E System.Net.Sockets.SocketException (111): Connection refused    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)    at System.Net.Sockets.Socket.\u003CConnectAsync\u003Eg__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)    --- End of inner exception stack trace ---    at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)    at System.Threading.Tasks.TaskCompletionSourceWithCancellation\u00601.WaitWithCancellationAsync(CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)    at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)    at System.Net.Http.HttpClient.\u003CSendAsync\u003Eg__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)    at Dapr.Client.DaprClientGrpc.InvokeMethodWithResponseAsync(HttpRequestMessage request, CancellationToken cancellationToken)    --- End of inner exception stack trace ---    at Dapr.Client.DaprClientGrpc.InvokeMethodWithResponseAsync(HttpRequestMessage request, CancellationToken cancellationToken)    at Dapr.Client.DaprClientGrpc.InvokeMethodAsync[TResponse](HttpRequestMessage request, CancellationToken cancellationToken)    at Service02.Controllers.HelloController.Hello() in /src/Service02/Controller/HelloController.cs:line 20    at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeActionMethodAsync\u003Eg__Awaited|12_0(ControllerActionInvoker invoker, ValueTask\u00601 actionResultValueTask)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeNextActionFilterAsync\u003Eg__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State\u0026 next, Scope\u0026 scope, Object\u0026 state, Boolean\u0026 isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeInnerFilterAsync\u003Eg__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeFilterPipelineAsync\u003Eg__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeAsync\u003Eg__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeAsync\u003Eg__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)    at Microsoft.AspNetCore.Routing.EndpointMiddleware.\u003CInvoke\u003Eg__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)    at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication\u00601 application)","State":{"Message":"Connection id \u00220HMFJDGT5UAFR\u0022, Request id \u00220HMFJDGT5UAFR:00000002\u0022: An unhandled exception was thrown by the application.","ConnectionId":"0HMFJDGT5UAFR","TraceIdentifier":"0HMFJDGT5UAFR:00000002","{OriginalFormat}":"Connection id \u0022{ConnectionId}\u0022, Request id \u0022{TraceIdentifier}\u0022: An unhandled exception was thrown by the application."}}

这篇关于Dapr进阶-02-查看Dapr日志的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/475154

相关文章

python logging模块详解及其日志定时清理方式

《pythonlogging模块详解及其日志定时清理方式》:本文主要介绍pythonlogging模块详解及其日志定时清理方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地... 目录python logging模块及日志定时清理1.创建logger对象2.logging.basicCo

Qt spdlog日志模块的使用详解

《Qtspdlog日志模块的使用详解》在Qt应用程序开发中,良好的日志系统至关重要,本文将介绍如何使用spdlog1.5.0创建满足以下要求的日志系统,感兴趣的朋友一起看看吧... 目录版本摘要例子logmanager.cpp文件main.cpp文件版本spdlog版本:1.5.0采用1.5.0版本主要

Spring Boot + MyBatis Plus 高效开发实战从入门到进阶优化(推荐)

《SpringBoot+MyBatisPlus高效开发实战从入门到进阶优化(推荐)》本文将详细介绍SpringBoot+MyBatisPlus的完整开发流程,并深入剖析分页查询、批量操作、动... 目录Spring Boot + MyBATis Plus 高效开发实战:从入门到进阶优化1. MyBatis

SpringBoot日志配置SLF4J和Logback的方法实现

《SpringBoot日志配置SLF4J和Logback的方法实现》日志记录是不可或缺的一部分,本文主要介绍了SpringBoot日志配置SLF4J和Logback的方法实现,文中通过示例代码介绍的非... 目录一、前言二、案例一:初识日志三、案例二:使用Lombok输出日志四、案例三:配置Logback一

golang 日志log与logrus示例详解

《golang日志log与logrus示例详解》log是Go语言标准库中一个简单的日志库,本文给大家介绍golang日志log与logrus示例详解,感兴趣的朋友一起看看吧... 目录一、Go 标准库 log 详解1. 功能特点2. 常用函数3. 示例代码4. 优势和局限二、第三方库 logrus 详解1.

mysql如何查看当前连接数

《mysql如何查看当前连接数》:本文主要介绍mysql如何查看当前连接数问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录mysql查看当前连接数查看mysql数据库允许最大连接数总结mysql查看当前连接数查看当前连接数SHOW STATUS LIKE

如何自定义Nginx JSON日志格式配置

《如何自定义NginxJSON日志格式配置》Nginx作为最流行的Web服务器之一,其灵活的日志配置能力允许我们根据需求定制日志格式,本文将详细介绍如何配置Nginx以JSON格式记录访问日志,这种... 目录前言为什么选择jsON格式日志?配置步骤详解1. 安装Nginx服务2. 自定义JSON日志格式各

SpringBoot项目使用MDC给日志增加唯一标识的实现步骤

《SpringBoot项目使用MDC给日志增加唯一标识的实现步骤》本文介绍了如何在SpringBoot项目中使用MDC(MappedDiagnosticContext)为日志增加唯一标识,以便于日... 目录【Java】SpringBoot项目使用MDC给日志增加唯一标识,方便日志追踪1.日志效果2.实现步

SQL Server清除日志文件ERRORLOG和删除tempdb.mdf

《SQLServer清除日志文件ERRORLOG和删除tempdb.mdf》数据库再使用一段时间后,日志文件会增大,特别是在磁盘容量不足的情况下,更是需要缩减,以下为缩减方法:如果可以停止SQLSe... 目录缩减 ERRORLOG 文件(停止服务后)停止 SQL Server 服务:找到错误日志文件:删除

查看Oracle数据库中UNDO表空间的使用情况(最新推荐)

《查看Oracle数据库中UNDO表空间的使用情况(最新推荐)》Oracle数据库中查看UNDO表空间使用情况的4种方法:DBA_TABLESPACES和DBA_DATA_FILES提供基本信息,V$... 目录1. 通过 DBjavascriptA_TABLESPACES 和 DBA_DATA_FILES