Java Logging
Java has a log system (logging framework) that records the runtime information of a program on the JVM ).
The program can use logger (Java. util. Logging. Logger) to record logs.
Java uses a hierarchical naming method (for example, java. AWT) to manage logger. Using logmanager, sub-logger may inherit some attributes from their parent logger ..
Use logger. getlogger (name) to obtain the desired logger. Therefore, the generated logger is usually bound with eaglehandle by default. logs recorded by logger are directly displayed on the command console.
Logger can bind multiple handler to record logs in different ways. Both logger and handler have a Level Attribute. Logs lower than this level are not recorded.
Logrecord has seven levels:
· Severe (highest value)
· Warning
· Info
· Config
· Fine
· Finer
· Finest (lowest value)
Logger uses the void log (Level level, string MSG) method to record logs. You can also use a specific method to record logs at a specific level, such
Void Info (string MSG) records the level. info level logrecord.
You can use filter and formatter to filter or format logs and assemble relationships.
References:
1) http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/overview.html
2) http://www.webasp.net/article/22/21433_print.htm is 1) the Chinese version, where examples can be more clear.