I want to change the log level without restarting the server. I use weblogic server. For this I thought to pass the log level from a external file (LOGBackIncludedFile.xml) and give this file path in the logback <include file>. I cannot hard code the path, as the path is different in Dev, UAT, Production. I want to include this file in a location inside Weblogic 12C server. So I can change log level without touching ear file.
<configuration scan="true" scanPeriod="30 seconds"> <include file="../../LOGBackIncludedFile.xml" /> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender" > <encoder> <pattern>%date %-5level [%logger] > %msg%n</pattern> </encoder> </appender> <root level="${root.level:-DEBUG}"> <appender-ref ref="STDOUT" /> </root> </configuration> Below is the LOGBackIncludedFile.xml
<included> <property value="INFO" name="root.level"/> </included> when I use this existing xml I get this error.
java.io.FileNotFoundException: /usrXX/appXX/oracle/product/XXX/domains/XXXDomain/../../LOGBackIncludedFile.xml My question is how can I set external file path dynamically in the logback.xml. The path should be to the specific weblogic instance. As I put the external file into my instance.
eg : /usrxx/appxx/oracle/product/XXX/domains/xxxDomain/servers/myInstance/