With growing projects we made new agreements in terms of logging different scenarios within these projects, because we usually tend to forget to delete tons of disrubting logger calls which where used for hunting bugs in production code (we even created a coffee bug, where everyone has to pay 20c for each undesired logger without success :/). So what I would love to have is a special log level for Log4j which we can use for debug purposes only.
Currently there are these loggers:
DEBUG
INFO
WARN
ERROR
FATAL
warn, error and fatal are speaking for themselves but I would love to add another category somewhere before DEBUG, because INFO we want to use for general logging of application in production mode and DEBUG gives detail Information about project states, which aren`t necessarly of use in production mode.
Next to DEBUG I would appreciate having a special logger, like for example USER (or simular), for temporary included loggers, which where used for example for bug hunting, or whatever, which can be when found in code be deleted at every time, without hesitation.
I stumbled over this useful article to create an own custom level, but I hate, that I have to add the log level at every log I want to add for debug purposes:
logger.log(MyLevel.DISASTER, "i am a disaster");
So I wondered if there is any way to simply this to gain a new method like
logger.disaster( "i am a disaster" );
for example with writing a fassade for Logger.class. Unfortunatly I am not sure, about logger Initialization and - Creation for delegation to the logger, so I wondered, if anyone might have any idea to simply this.I know with coding templates I can generate the level easily, but it just doesnt read well.