Skip to content

Logging

The library uses the built-in logger from java.util.logging. It configures to not use the parent logger and places a new ConsoleHandler on static initialization. This outputs the log in formatted lines like:

1
[2020-11-27T14:40:26+0100] [WARNING] [de.hftstuttgart.unifiedticketing.core.Logging.test] calling from app

This will not change visual presentation based on any localization.

change log-level

Default is to use INFO-level. You can change the used level:

1
Logging.setLevel(Level);

The parameter passed is of type java.util.logging.Level.

test logging output

To test if the logging as such works, you can pass a test string:

1
Logging.test("test message");

This message will be logged by the Logging-class own Logger, once per level.

set custom formatter

If you need another format, you can replace the default formatter of this lib by calling:

1
Logging.setFormatter(Formatter);

This formatter has to be of type java.util.logging.Formatter