Skip to content

Instantly share code, notes, and snippets.

@YaSuenag
Last active November 7, 2020 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YaSuenag/dacb6d94d8684915422232c7a08d5b5d to your computer and use it in GitHub Desktop.
Save YaSuenag/dacb6d94d8684915422232c7a08d5b5d to your computer and use it in GitHub Desktop.
Unified Logging for network

outline

Abstract

-Xlog:all=info:host=127.0.0.1,port=9999

Log message is sent to the consumer in plain text each time it is issued. The user can configure it with -Xlog option.

  1. Log message is issued from the code in HotSpot
  2. Log message is stored in message buffer
    • Capacity of message buffer can be configured by -XX:NumOfULMessageBuffer (default: 100)
  3. UL shipper thread pulls log message, and then sends to log consumer via TCP socket
    • UL shipper thread is started when -Xlog is configured
    • UL shipper connects socket to the consumer - We can set connection timeout with -XX:ULSocketConnectionTimeout

Abnormal case

  • Message buffer is full
    • Issuer is blocked until the slot is available in message buffer
    • We can set timeout with -XX:ULMessageBufferTimeout
  • UL shipper is down
    • Disable log output, and shutdown socket to the consumer
  • TCP connection is lost (includes send syscall returns error)
    • Disable log output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment