Skip to content

Instantly share code, notes, and snippets.

@rajeevshukla
Created January 17, 2023 19:28
Show Gist options
  • Save rajeevshukla/6aadfca1b1ca2670c9f09839eb1b91a8 to your computer and use it in GitHub Desktop.
Save rajeevshukla/6aadfca1b1ca2670c9f09839eb1b91a8 to your computer and use it in GitHub Desktop.
Log4j appender to log IP and user Id via log4j MDC
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %X{ip} %X{userId} - %m%n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment