I am soon going to use log4j class using Java, for a project, to create logs. But i dont think i know or have any slightest idea about it. Hope someone enlightens me over this, but, trivial issue.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Log4j basically takes any statement you want to output, lets you assign a "severity" level to it (warning, error, critical, etc) and logs it out in a variety of ways. (to a file, to a byte stream, etc. there are lots of appender options available.);
Here's a short blurb introduction to log4j.
http://www.developer.com/open/article.php/3097221/Logging-with-log4jmdashAn-Efficient-Way-to-Log-Java-Applications.htm
Here's a short tutorial:
http://veerasundar.com/blog/2009/07/log4j-tutorial-adding-log4j-logging-to-your-project/
Log4j is very easy to use. Try the manual.
Also lots of people use commons logging to wrapper log4j, if you are sure you want to use log4j for the long term then use it directly.
You should also get agreement within your development team what logging levels mean what to your org, for example TRACE & DEBUG are pretty easy. But often people dont have standards as when to use INFO vs WARN vs ERROR. Also what should happen when a log entry of a certain level happens. I like to look at it from the operators point of view, when you see a log level of "FATAL" what do you do? or of "ERROR" etc.