You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: STARTS-LOGGING.md
+37-25Lines changed: 37 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,13 @@ Logging in STARTS is a customized (read: simpler) version of [java.util.logging
8
8
The code for logging is located in starts-core/src/main/java/edu/illinois/starts/util/Logger.java
9
9
10
10
11
-
12
11
For any piece of starts that you'd like to add logging to, begin by adding two import statements at the top:
13
-
-``import edu.illinois.starts.util.Logger;``
12
+
13
+
-``import edu.illinois.starts.util.Logger;``
14
14
-``import java.util.logging.Level;``
15
-
_note: you may need to make minor changes to the positioning of these two import statements to ensure checkstyle does not break. place ``edu.illinois.starts.util.Logger`` directly underneath the other imports with the same package name, and do the same with ``java.util.logging.Level``. additionally, ensure you have a newline separating different package names_
15
+
16
+
_note: you may need to make minor changes to the positioning of these two import statements to ensure checkstyle does not break. Place ``edu.illinois.starts.util.Logger`` directly underneath the other imports with the same package name, and do the same with ``java.util.logging.Level``. Additionally, ensure you have a newline separating different package names_
17
+
16
18
17
19
Next, instantiate your Logger as a class variable:
18
20
-``protected static final Logger logger = Logger.getGlobal();``
@@ -27,12 +29,18 @@ There are 7 logging levels (excluding OFF and ALL), just like JUL:
27
29
- FINER
28
30
- FINEST (lowest value)
29
31
30
-
To set the logging level of your log, use the ``setLoggingLevel(Level level)`` method.
31
-
i.e.
32
+
To set the logging level of your log, use the
33
+
34
+
``setLoggingLevel(Level level)``
35
+
36
+
method.
37
+
i.e.,
38
+
32
39
``logger.setLoggingLevel(Level.CONFIG);``
33
40
34
41
To check the logging level, use the ``getLoggingLevel()`` method, which will return an object of type [Level](https://docs.oracle.com/javase/8/docs/api/java/util/logging/Level.html).
@@ -45,7 +53,9 @@ should be used when you want to have a custom message AND an exception message
45
53
###### ``public void log(Level lev, String msg)``
46
54
should be used when you only want to have a custom message
47
55
48
-
i.e. ``logger.log(Level.SEVERE, "houston we have a problem");``
56
+
i.e.,
57
+
58
+
``logger.log(Level.SEVERE, "houston we have a problem");``
49
59
50
60
In both cases above, the provided message will only be logged if the specified logging Level is equal to or higher in severity than the Level the logger is set to.
51
61
For example, if ``logger.setLoggingLevel(Level.SEVERE);``, then only ``logger.log()`` messages with Level.SEVERE will be spit out.
@@ -54,29 +64,31 @@ Similarly, if ``logger.setLoggingLevel(Level.CONFIG);``, then ``logger.log()`` w
54
64
## Where will messages be output?
55
65
Standard Output (System.out)
56
66
57
-
## Artifact Storage
67
+
## Artifact storage
58
68
The logging granularities serve a dual purpose - both to control which log messages in code are sent to standard output, AND to control which artifacts are stored between runs.
59
69
60
-
The default Level.INFO will store:
61
-
- checksum
62
-
- dependency file (.starts/deps.zlc)
70
+
The default __Level.INFO__ will store:
71
+
-_dependency file/checksum (.starts/deps.zlc)_
63
72
64
-
Level.FINER will store:
65
-
-dependency file (.starts/deps.zlc)
66
-
-list of all tests
67
-
-list of impacted tests
73
+
__Level.FINER__ will store:
74
+
-_dependency file/checksum (.starts/deps.zlc)_
75
+
-_list of all tests_
76
+
-_list of impacted tests_
68
77
69
-
Level.FINEST will store:
70
-
- list of all tests
71
-
- list of impacted tests
72
-
- list of non-impacted tests
73
-
- list of dependencies computed by jdeps
74
-
- classpath that STARTS used
75
-
- yasgl graph that STARTS constructed
76
-
- set of changed types
78
+
__Level.FINEST__ will store:
79
+
-_dependency file/checksum (.starts/deps.zlc)_
80
+
-_list of all tests_
81
+
-_list of impacted tests_
82
+
-_list of non-impacted tests_
83
+
-_list of dependencies computed by jdeps_
84
+
-_classpath that STARTS used_
85
+
-_yasgl graph that STARTS constructed_
86
+
-_set of changed types_
77
87
78
88
To set the log level at runtime, call starts like this:
0 commit comments