EduArn is your learning hub for AI, Cloud Computing, and DevOps tools and technologies. Explore detailed guides, practical examples, and real-world use cases of artificial intelligence platforms, cloud services, automation tools, CI/CD pipelines, containers, Kubernetes, infrastructure as code, and modern IT solutions. Learn how emerging technologies are transforming software development, deployment, and business operations while building your technical skills for the future.
LOGGER.isDebugEnabled() Example Java
Why LOGGER.isDebugEnabled() condition need to check in all implementation of LOG messages?
We all know logger bring app slowness if unnecessary, message will log in place, if we implement as mention below. We can avoid/control on logging message:
e.g.:-
protected static final Logger LOG = Logger.getLogger(TutorialByExampleJavaLogger.class);
Make sure that whenever using LOG messages, check with LOGGER.isDebugEnabled() flag, so that when debugger is disabled, logs won't get printed to the log files.
e.g.:-
if(LOG. isDebugEnabled())
{ /* print your log messages as you want to print*/
LOG.info("Info type message") ;
//OR
LOG.debug("Debug type message");
}
Feel free put your point of view if any....!!!
Subscribe to:
Post Comments (Atom)
This comment has been removed by the author.
ReplyDelete