You can set the logging level by passing the parameter level
with @Logit
annotation.
Available options: DEBUG
, INFO
, WARN
, ERROR
By default level=Level.INFO
Example
@LogIt(level=Level.DEBUG)
or if you add a static import
@LogIt(level=DEBUG)
You can set a different logging level for each method individually.
For example you can set some level for one method and another level for all other methods in the class.
In the code below level=WARN
will be applied for getUser(..)
, level=DEBUG
will be applied for createUser(..)
and all other methods in the class
@LogIt(level=DEBUG)
public class UserHandler {
public User createUser(CreateUserRequest request) {
...
}
@LogIt(level=WARN)
public User getUser(String userId) {
...
}
...
}