Can any one tell me, what is package level logging in log4j ? And how to enable this, today my interview question am unable to answer this :-(
Even i didn't find good solution in Google.
thank you so much.
Steps to plug log4j into your codeCreate log4j's configuration. Initialize log4j with the configuration. Create a logger. Put logging statements into your code.
log4j is a reliable, fast and flexible logging framework (APIs) written in Java, which is distributed under the Apache Software License. log4j is a popular logging package written in Java. log4j has been ported to the C, C++, C#, Perl, Python, Ruby, and Eiffel languages.
Below is the log4j logging level order. Trace < Debug < Info < Warn < Error < Fatal.
Package level logging is the standard logging of log4j. With log4j configuration, you'd specify the package and the associated level.
In the intro example, there is package level logging for "com.foo".
# Print only messages of level WARN or above in the package com.foo.
log4j.logger.com.foo=WARN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With