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

相关文章

SpringBoot日志级别与日志分组详解

《SpringBoot日志级别与日志分组详解》文章介绍了日志级别(ALL至OFF)及其作用,说明SpringBoot默认日志级别为INFO,可通过application.properties调整全局或... 目录日志级别1、级别内容2、调整日志级别调整默认日志级别调整指定类的日志级别项目开发过程中,利用日志

深度剖析SpringBoot日志性能提升的原因与解决

《深度剖析SpringBoot日志性能提升的原因与解决》日志记录本该是辅助工具,却为何成了性能瓶颈,SpringBoot如何用代码彻底破解日志导致的高延迟问题,感兴趣的小伙伴可以跟随小编一起学习一下... 目录前言第一章:日志性能陷阱的底层原理1.1 日志级别的“双刃剑”效应1.2 同步日志的“吞吐量杀手”

从基础到进阶详解Python条件判断的实用指南

《从基础到进阶详解Python条件判断的实用指南》本文将通过15个实战案例,带你大家掌握条件判断的核心技巧,并从基础语法到高级应用一网打尽,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一... 目录​引言:条件判断为何如此重要一、基础语法:三行代码构建决策系统二、多条件分支:elif的魔法三、

Linux实现查看某一端口是否开放

《Linux实现查看某一端口是否开放》文章介绍了三种检查端口6379是否开放的方法:通过lsof查看进程占用,用netstat区分TCP/UDP监听状态,以及用telnet测试远程连接可达性... 目录1、使用lsof 命令来查看端口是否开放2、使用netstat 命令来查看端口是否开放3、使用telnet

Python进阶之列表推导式的10个核心技巧

《Python进阶之列表推导式的10个核心技巧》在Python编程中,列表推导式(ListComprehension)是提升代码效率的瑞士军刀,本文将通过真实场景案例,揭示列表推导式的进阶用法,希望对... 目录一、基础语法重构:理解推导式的底层逻辑二、嵌套循环:破解多维数据处理难题三、条件表达式:实现分支

基于Python编写自动化邮件发送程序(进阶版)

《基于Python编写自动化邮件发送程序(进阶版)》在数字化时代,自动化邮件发送功能已成为企业和个人提升工作效率的重要工具,本文将使用Python编写一个简单的自动化邮件发送程序,希望对大家有所帮助... 目录理解SMTP协议基础配置开发环境构建邮件发送函数核心逻辑实现完整发送流程添加附件支持功能实现htm

java -jar example.jar 产生的日志输出到指定文件的方法

《java-jarexample.jar产生的日志输出到指定文件的方法》这篇文章给大家介绍java-jarexample.jar产生的日志输出到指定文件的方法,本文给大家介绍的非常详细,对大家的... 目录怎么让 Java -jar example.jar 产生的日志输出到指定文件一、方法1:使用重定向1、

c++日志库log4cplus快速入门小结

《c++日志库log4cplus快速入门小结》文章浏览阅读1.1w次,点赞9次,收藏44次。本文介绍Log4cplus,一种适用于C++的线程安全日志记录API,提供灵活的日志管理和配置控制。文章涵盖... 目录简介日志等级配置文件使用关于初始化使用示例总结参考资料简介log4j 用于Java,log4c

MySQL的触发器全解析(创建、查看触发器)

《MySQL的触发器全解析(创建、查看触发器)》MySQL触发器是与表关联的存储程序,当INSERT/UPDATE/DELETE事件发生时自动执行,用于维护数据一致性、日志记录和校验,优点包括自动执行... 目录触发器的概念:创建触www.chinasem.cn发器:查看触发器:查看当前数据库的所有触发器的定

Android 缓存日志Logcat导出与分析最佳实践

《Android缓存日志Logcat导出与分析最佳实践》本文全面介绍AndroidLogcat缓存日志的导出与分析方法,涵盖按进程、缓冲区类型及日志级别过滤,自动化工具使用,常见问题解决方案和最佳实... 目录android 缓存日志(Logcat)导出与分析全攻略为什么要导出缓存日志?按需过滤导出1. 按