Wicket - Keyclock hide org.keycloak.adapters debug logs (logback)

1.1k Views Asked by At

I am pretty new with keycloak and I integrated keycloak with my wicket project.

Integration seems ok, but the debug log continuously displaying this:

12:49:41.808 [http-nio-8080-exec-9] DEBUG org.keycloak.adapters.PreAuthActionsHandler - adminRequest http://localhost:8080/
12:49:41.808 [http-nio-8080-exec-9] DEBUG org.keycloak.adapters.OAuthRequestAuthenticator - there was no code
12:49:41.808 [http-nio-8080-exec-9] DEBUG org.keycloak.adapters.OAuthRequestAuthenticator - redirecting to auth server
12:49:41.808 [http-nio-8080-exec-9] DEBUG org.keycloak.adapters.OAuthRequestAuthenticator - callback uri: http://localhost:8080/
12:49:41.808 [http-nio-8080-exec-9] DEBUG org.keycloak.adapters.OAuthRequestAuthenticator - Sending redirect to login page: https://test.sample.app.com/auth/realms/test/protocol/openid-connect/auth?response_type=code&client_id=dev-test&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&state=db49b10a-8983-4d4e-ae6b-ebc23fe57b4e&login=true&scope=openid

This is always showing in the logs, both when authentication or none with keycloak.

I am thinking that my log file size will be huge because of this, that is why I am thinking if there is a way to hide this in the log file.

Any idea, why this is showing both on authenticated and unauthenticated in keycloak?

By the way, below is my logback.xml but it seems this does not work properly since when I use this... It seems all debug and error logs are hidden.

<configuration>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>/Users/borgy/work/apache-tomcat-8.5.57/logs/my-web.log</file>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>/Users/borgy/work/apache-tomcat-8.5.57/logs/my-web.%d{yyyy-MM-dd}.log</fileNamePattern>
        <maxHistory>5</maxHistory>
    </rollingPolicy>
    <encoder>
        <pattern>%d %-5p %-30.30c{1} - %m%n</pattern>
    </encoder>
</appender>

<logger name="com.mywicketapp.sample" level="DEBUG"/>
<logger name="org.apache.wicket" level="ERROR"/>
<logger name="org.keycloak.adapters" level="ERROR"/>
<root level="ERROR">
    <appender-ref ref="FILE" />
</root>
</configuration>

TIA

1

There are 1 best solutions below

2
martin-g On

These are DEBUG log messages. When running an application in normal mode one usually uses INFO log level by default. One needs to enable DEBUG level only when debugging specific problem in these classes.

Check your logback.xml/log4j2.xml/... and adapt it to your needs.