Need to implement Custom Logger Wrapper in log4j2

java, log4j, log4j2, logging

Solution

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.

Problem

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 ??

Original source