Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to enable package level logging in log4j

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.

like image 688
Siva Avatar asked May 18 '12 07:05

Siva


People also ask

How do I enable INFO in log4j?

Steps to plug log4j into your codeCreate log4j's configuration. Initialize log4j with the configuration. Create a logger. Put logging statements into your code.

What is log4j logging package?

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.

What are some different logging levels for log4j?

Below is the log4j logging level order. Trace < Debug < Info < Warn < Error < Fatal.


1 Answers

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
like image 99
eis Avatar answered Oct 07 '22 08:10

eis