0.2.2 Release Notes
Tuning
- Add logger name to all messages logged by non-IHMC loggers, as they do not normally include their source
- Use new date/time format:
20181005 13:13 [INFO] (LogTools:151): Granular logging mode enabled. Not realtime safe. 20181005 13:13 [ERROR] (LogToolsDemo:37): Demo there 20181005 13:13 [WARN] (LogToolsDemo:38): var1: 9, var2: false 20181005 13:13 [INFO] (LogToolsDemo:39): Demo there 20181005 13:13 [DEBUG] (LogToolsDemo:29): Hi I'm subclass 2
Bug fix
- Fix Gradle user logging properties not getting through to deployed applications
0.1.7 Release Notes
Bug Fix
- Add slf4j impl compatibility runtime library to fix external SLF4J logger bindings
0.1.6 Release Notes
Initial release!
Features
- Zero-configuration required API. Use
LogTools.info("msg")
right out of the box, from anywhere. - Realtime safe by default as long as info and higher level messages are non-recurring.
- Provides Java and Gradle properties for setting log levels.
- Granular non-realtime mode for setting log levels of packages and classes.
- Adds class name and line number to all log entries.
Download
plugins { id "us.ihmc.log-tools" version
} // Gradle plugin
compile group: "us.ihmc", name: "log-tools", version:
` // API`
API
To log messages, use the static LogTools
methods.
...
<pass nothing> // all log levels set to info, realtime safe
-Dlog.level=info // same as default, realtime safe
-Dlog.level=off // disable all SLF4J compatable logging, realtime safe
-Dlog.level.us.ihmc=debug // debug IHMC software only, realtime safe
-Dlog.level.us.ihmc.avatar.behaviors=debug // debug behaviors package only, NOT realtime safe
-Dlog.level.us.ihmc.variables.YoDouble=trace // Enables trace level on YoDouble class, NOT realtime safe
-Dlog.granular=true -Dlog.level.us.ihmc.communication=trace // Enables trace level on YoDouble class, NOT realtime safe
-Dlog.granular=false -Dlog.level.us.ihmc.communication=trace // Does NOT enable trace level on YoDouble class, realtime safe
Realtime safety
To ensure your code is realtime safe:
...
LogTools.info("str1 {}", someStrVariable) // SAFE
LogTools.info("str1" + someStrVariable) // NOT realtime safe
Supplier<String> supplier = () -> "string" + "builder"; // as field or existing method, created once
[...]
LogTools.info(supplier) // SAFE
LogTools.info(() -> { "string" + "builder"}) // NOT realtime safe, allocates new Supplier<String>()
Gradle plugin
The Gradle plugin exists solely to provide a wrapper for the JVM properties. All properties are the same as above. Just replace -D
with -P
.
...