|
2 | 2 |
|
3 | 3 | ## Controlling Log Levels |
4 | 4 |
|
5 | | -To control the log level of a class with a `Logger`, make a logging `.properties` file, and set the level of each of your classes for which you want to use a non-default level; use the property name `className.level`, for example: |
| 5 | +To control the log level of a class with a `Logger`, use properties. As CLI options, you may use, for example, |
| 6 | +``` |
| 7 | +-Dorg.jlab.detector.helicity.HelicityGenerator.level=FINEST # sets HelicityGenerator level to FINEST |
| 8 | +-D.level=FINE # sets the level of all loggers to FINE |
| 9 | +``` |
| 10 | + |
| 11 | +Alternatively, make a logging `.properties` file, and set the level of each of your classes for which you want to use a non-default level; use the property name `className.level`, for example: |
6 | 12 | ``` |
7 | 13 | # my_levels.properties |
8 | 14 | org.jlab.detector.helicity.HelicityGenerator.level = FINEST |
9 | 15 | org.jlab.detector.calib.utils.RCDBProvider.level = FINER |
10 | 16 | ``` |
11 | | -You can also control the _global_ log level for all classes with `.level`, for example, to set |
12 | | -it to `FINE`: |
| 17 | +or use `.level` for the global level: |
13 | 18 | ``` |
| 19 | +# my_levels.properties |
14 | 20 | .level = FINE |
15 | 21 | ``` |
16 | 22 | To use this `.properties` file, run with the `java` option |
17 | 23 | ``` |
18 | 24 | -Djava.util.logging.config.file=my_levels.properties |
19 | 25 | ``` |
20 | | -For example, if using `run-coatjava`, |
| 26 | +Then, here are some examples for using it with `recon-util`: |
21 | 27 | ```bash |
22 | | -run-coatjava [CLASS_NAME] [CLASS_ARGS] -- -Djava.util.logging.config.file=my_levels.properties |
| 28 | +recon-util [ARGS] -- -Djava.util.logging.config.file=my_levels.properties # use your .properties file |
| 29 | +recon-util [ARGS] -- -D.level=ALL # set the global level to ALL (very verbose!) |
| 30 | +recon-util [ARGS] -- -D.level=OFF # silence the loggers |
23 | 31 | ``` |
24 | 32 | From high to low, the levels are `SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST` (see `java.util.logging.Level` documentation). |
25 | 33 | You may also use levels `ALL` or `OFF`, for everything or nothing, respectively. |
|
0 commit comments