Silhouette uses named loggers for logging. This gives your application fine-grained control over the log entries logged by Silhouette.

Configure logging

📘

Note

Play uses Logback as its logging framework. Please see the Play documentation on how to configure base logging in Play.

As an example, in your logging.xml you can set the logging level for the complete com.mohiva namespace to ERROR and then define a more detailed level for some components.

<configuration debug="false">
    ...
    <logger name="com.mohiva" level="ERROR" />
    <logger name="com.mohiva.play.silhouette.api.Silhouette" level="INFO" />
    ...
</configuration>

Use the logger

To use the named logger you only need to mix the Logger trait into your class or trait. Then you can use the logger property to access the Play logging API.

import com.mohiva.play.silhouette.core.Logger

class LoggerExample extends Logger {
  def log {
    logger.error("My log message")
  }
}

What’s Next