Skip to content

Instantly share code, notes, and snippets.

@YaSuenag
Last active Nov 7, 2020
Embed
What would you like to do?
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