• About Us
  • Blog
  • Basket
  • Account
  • Sign In
  •  

Enable Logging

The 51Degrees Java Detector uses SLF4J for logging. The advantage of SLF4J is that it defines a basic abstraction that can be implemented differently by placing a new JAR in the classpath, making it easy to log to a file, a database or some other system.

The Detector ships with the simple logger with default settings that log to std err (short for standard error, if running in an IDE there will probably be a window displaying this at runtime). This behaviour can be modified using a properties file in your classpath.

The following should be placed in a file called simplelogger.properties and placed in your classpath. For web applications this will be in the WEB-INF/classes folder. It will record all trace logs and write them to a file called 51DegreesDetector.log. See the simplelogger properties page for more details.

# simplelogger.properties
#
org.slf4j.simpleLogger.defaultLogLevel=trace
org.slf4j.simpleLogger.showDateTime=true
org.slf4j.simpleLogger.showThreadName=false
org.slf4j.simpleLogger.showLogName=false
org.slf4j.simpleLogger.logFile=51DegreesDetector.log
org.slf4j.simpleLogger.levelInBrackets=true
org.slf4j.simpleLogger.log.Sisu=info
org.slf4j.simpleLogger.warnLevelString=WARNING

See the SLF4J Manual for more information.

Need Help?