Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to implement Custom Logger Wrapper in log4j2

I need to have an Custom Wrapper around Log4j2. The basic requirement is that. My application should only use My CustomLogger everywhere. instead of Log4j2 logger so in future if needed i can remove 3rd party library like log4j2 etc dependency easily.

How can i do this ??

like image 402
Satyam Soni Avatar asked Nov 28 '14 05:11

Satyam Soni


1 Answers

Log4j2 comes with a tool for generating custom logger wrappers: See http://logging.apache.org/log4j/2.0/manual/customloglevels.html#CustomLoggers

This tool was intended for use with custom log levels but you can also use it for your purpose. There are a few methods you may want to remove if you want to completely remove all references to the log4j2 api, but it will still save you a lot of work.

like image 55
Remko Popma Avatar answered Nov 08 '22 21:11

Remko Popma