For instance, you have an application deployed in production and you need to set the log level to debug to investigate an issue. Normally, you will edit the log4j.properties and restart the application in order to have the changes take effect.
Implement Log4j file watchdog
org.apache.log4j.Logger logger = null;
org.apache.log4j.PropertyConfigurator.configureAndWatch("C:\\log4j.properties");
logger = org.apache.log4j.Logger.getLogger("");
logger.info("Info Message");
logger.error("Error Message");
logger.warn("Warn Message");
logger.trace("Trace Message");
No idea on what is log4j and how to use it?
Visit https://logging.apache.org/log4j/1.2/
No comments:
Post a Comment