This week's book giveaway is in the Programmer Certification forum. We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
In a huge application comprising of numerous packages how do we selectively enable logging for a few packages & disable logging for those packages where logging is not required. What parameter settings i need to make to my log4j.properties file to achieve the same.
It would be really helpful if someone provided an illustration for the same
From your post it is hard to tell what level of detail to use, but for general help, the log4j short manual should help. For much more detailed help, I highly recommend the The complete log4j Manual available in pdf ($).
log4j uses a root logger. So, you can configure that to log at or above a certain level. Then if you use the package hierarchy to set up your Loggers you can configure the level for whatever part of the package hierarchy you are interested in; e.g., setting up Loggers like like one of these that uses the class name is using the package hierarchy:
Configure the Root Logger level and appenders A1, A2:
Say you want a certail level of logging from org.apache classes in use: