Skip to content

springboot mvc + slf4j and log4j2 + request trace configuration

Notifications You must be signed in to change notification settings

lgazda/log4j2-fish-tagging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

log4j2-fish-tagging

springboot mvc + slf4j and log4j2 + request trace configuration

Demonstrates how we can use log4j2 filters to change logging level and redirect logs to the different (tracking log) file. You can track a request using a tag specified in the request.

How to

To enable fishing you need to set the following HTTP headers:

  • fishing-level - obligatory, fishing logging level ['debug','trace']
  • fishing-tag - optional, custom tag which will be set in logging ThreadContext and used in logging pattern
curl --header "fishing-level: debug" localhost:8080/fishing

fishing on debug level with autogenerated tag '

curl --header "fishing-level: trace" --header "fishing-tag: my-fishing-tag" localhost:8080/fishing

fishing on trace level with custom tag

Fishing logs will be forwarded to log4jfishing.trace.log for custom setting please reffer to https://logging.apache.org/log4j/2.0/manual/configuration.html and project log4j2.xml file.

About

springboot mvc + slf4j and log4j2 + request trace configuration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages