Biblioteca Java - Blame information for rev 3
Subversion Repositories:
Rev | Author | Line No. | Line |
---|---|---|---|
3 | mihai | 1 | /* |
2 | * IerarhieLogging.java | ||
3 | */ | ||
4 | package lab.scd.logging; | ||
5 | |||
6 | import java.util.logging.*; | ||
7 | /** | ||
8 | * Class created by @author mihai at May 7, 2005. | ||
9 | * | ||
10 | * This class is part of the laborator6_logging project. | ||
11 | * | ||
12 | * In cadrul unui program obiectele de tip logging se afla intr-o relatie | ||
13 | * de parinte - fiu. Relatia este stabilita pe baza numelui atasat obiectului | ||
14 | * de tip Logger, in momentul in care acesta este construit. Obiectul fiu mosteneste | ||
15 | * caracteristicile obiectului Logger parinte (filtre, handlere, nivel de logare) | ||
16 | */ | ||
17 | public class IerarhieLogging { | ||
18 | public static void main(String args[]){ | ||
19 | Logger log1 = Logger.getLogger("nivel1"); | ||
20 | Logger log2 = Logger.getLogger("nivel1.nivel2"); | ||
21 | Logger log3 = Logger.getLogger("nivel1.nivel2.nivel3"); | ||
22 | |||
23 | //caz 1 | ||
24 | log1.setLevel(Level.SEVERE); | ||
25 | |||
26 | log1.severe("my severe message"); | ||
27 | log1.warning("my warning message"); | ||
28 | log1.info("my info message"); | ||
29 | |||
30 | log2.severe("my severe message"); | ||
31 | log2.warning("my warning message"); | ||
32 | log2.info("my info message"); | ||
33 | |||
34 | log3.severe("my severe message"); | ||
35 | log3.warning("my warning message"); | ||
36 | log3.info("my info message"); | ||
37 | |||
38 | System.err.println("----"); | ||
39 | //caz 2 | ||
40 | log1.setLevel(Level.SEVERE); | ||
41 | log2.setLevel(Level.INFO); | ||
42 | |||
43 | log1.severe("my severe message"); | ||
44 | log1.warning("my warning message"); | ||
45 | log1.info("my info message"); | ||
46 | |||
47 | log2.severe("my severe message"); | ||
48 | log2.warning("my warning message"); | ||
49 | log2.info("my info message"); | ||
50 | |||
51 | log3.severe("my severe message"); | ||
52 | log3.warning("my warning message"); | ||
53 | log3.info("my info message"); | ||
54 | |||
55 | |||
56 | } | ||
57 | } |