user3198603 user3198603 - 1 year ago 133
Java Question

Change Log level at runtime without server restart?

I am using the logback as implementation with SL4j interface. Here is the configuration

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">

<logger name="com.ecom" additivity="false" level="ERROR">
<appender-ref ref="FILE" />

I want to change the level to Info or debug at runtime through configuration or external property change in production without restarting the server. Is it possible ?

FYI ,I am using Weblogic as application server and also Spring frameworks for other purposes >

Answer Source

Variable substitution is your friend here. Default values for variables should be helpful as well.

See also variable scoping.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download