Skip to content

Commit

Permalink
adds fixes suggested by August
Browse files Browse the repository at this point in the history
  • Loading branch information
cptwonton authored and cptwonton committed Dec 15, 2017
1 parent df51ce7 commit e144cb2
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ checksums of files in the latest version, while the command in (4)
behavior. For example, to update the checksums while checking the
diff, run `mvn starts:diff -DupdateDiffChecksums=true`.

[Logging and Artifact storage Docs](./STARTS-LOGGING.md)
[Logging and Artifact Storage Docs](./STARTS-LOGGING.md)

## Papers on STARTS

Expand Down
62 changes: 37 additions & 25 deletions STARTS-LOGGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ Logging in STARTS is a customized (read: simpler) version of [java.util.logging
The code for logging is located in starts-core/src/main/java/edu/illinois/starts/util/Logger.java



For any piece of starts that you'd like to add logging to, begin by adding two import statements at the top:
- ``import edu.illinois.starts.util.Logger;``

- ``import edu.illinois.starts.util.Logger;``
- ``import java.util.logging.Level;``
_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_

_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_


Next, instantiate your Logger as a class variable:
- ``protected static final Logger logger = Logger.getGlobal();``
Expand All @@ -27,12 +29,18 @@ There are 7 logging levels (excluding OFF and ALL), just like JUL:
- FINER
- FINEST (lowest value)

To set the logging level of your log, use the ``setLoggingLevel(Level level)`` method.
i.e.
To set the logging level of your log, use the

``setLoggingLevel(Level level)``

method.
i.e.,

``logger.setLoggingLevel(Level.CONFIG);``

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).
i.e.
i.e.,

``Level currentLevel = logger.getLoggingLevel();``

## Writing messages
Expand All @@ -45,7 +53,9 @@ should be used when you want to have a custom message AND an exception message
###### ``public void log(Level lev, String msg)``
should be used when you only want to have a custom message

i.e. ``logger.log(Level.SEVERE, "houston we have a problem");``
i.e.,

``logger.log(Level.SEVERE, "houston we have a problem");``

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.
For example, if ``logger.setLoggingLevel(Level.SEVERE);``, then only ``logger.log()`` messages with Level.SEVERE will be spit out.
Expand All @@ -54,29 +64,31 @@ Similarly, if ``logger.setLoggingLevel(Level.CONFIG);``, then ``logger.log()`` w
## Where will messages be output?
Standard Output (System.out)

## Artifact Storage
## Artifact storage
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.

The default Level.INFO will store:
- checksum
- dependency file (.starts/deps.zlc)
The default __Level.INFO__ will store:
- _dependency file/checksum (.starts/deps.zlc)_

Level.FINER will store:
- dependency file (.starts/deps.zlc)
- list of all tests
- list of impacted tests
__Level.FINER__ will store:
- _dependency file/checksum (.starts/deps.zlc)_
- _list of all tests_
- _list of impacted tests_

Level.FINEST will store:
- list of all tests
- list of impacted tests
- list of non-impacted tests
- list of dependencies computed by jdeps
- classpath that STARTS used
- yasgl graph that STARTS constructed
- set of changed types
__Level.FINEST__ will store:
- _dependency file/checksum (.starts/deps.zlc)_
- _list of all tests_
- _list of impacted tests_
- _list of non-impacted tests_
- _list of dependencies computed by jdeps_
- _classpath that STARTS used_
- _yasgl graph that STARTS constructed_
- _set of changed types_

To set the log level at runtime, call starts like this:

``mvn starts:starts -DStartsLogging=<Level>``
``mvn starts:starts -DstartsLogging=<Level>``

i.e.,

i.e. ``mvn starts:starts -DStartsLogging=FINEST``
``mvn starts:starts -DstartsLogging=FINEST``

0 comments on commit e144cb2

Please sign in to comment.