<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt">Hi Kriti.<br><br>This sounds an elegant solution. <br>Maybe I will try without the properties file, simply using change of the properties in java only<div> p.setProperty("FILE_SIZE", 200000);<br> System.setProperties(p);</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">Thanks,</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style:
normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">Xavier.<br></div> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1"> <font face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> Kriti Wadhwa <kriti.wadhwa@tcs.com><br> <b><span style="font-weight: bold;">To:</span></b> logback users list <logback-user@qos.ch> <br><b><span style="font-weight: bold;">Cc:</span></b> logback <logback-user@qos.ch> <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, August 12, 2013 10:28 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [logback-user] Using configuration file and programatically changing configuration?<br> </font> </div>
<div class="y_msg_container"><br><div id="yiv2320817860"><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font size="3"><font face="Calibri">Hi Xavier,</font></font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font face="Calibri" size="3"> </font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font size="3"><font face="Calibri">Have a look at this thread, might be of some help:</font></font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font size="3"><font face="Calibri">http://logback.10977.n7.nabble.com/Basic-example-of-programmatically-setting-the-configuration-td12667.html</font></font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font face="Calibri" size="3"> </font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font
size="3"><font face="Calibri">In my application too there was a similar requirement, I did the following: </font></font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font face="Calibri" size="3"> </font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font size="3"><font face="Calibri">Store values to be modified on the fly from UI in a properties(configuration) file, reset the logger context programmatically, logback.xml will read the configuration file and hence the configuration shall be modified. </font></font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font size="3"><font face="Calibri">(Used Variable Substitution to implement this: <a rel="nofollow" target="_blank" href="http://logback.qos.ch/manual/configuration.html#variableSubstitution"><font color="#0066cc">http://logback.qos.ch/manual/configuration.html#variableSubstitution</font></a>).</font></font></div><div
class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font face="Calibri" size="3"> </font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font size="3"><font face="Calibri">example:</font></font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font size="3"><font face="Calibri"># process_settings.properties : Configuration file (Set the values set from UI here, logback.xml will read this properties file to substitute the variables)</font></font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font size="3"><font face="Calibri">FILE_SIZE=20000000</font></font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font size="3"><font face="Calibri">LOG_LEVEL=INFO</font></font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font size="3"><font face="Calibri">BACKUP_COUNT=4</font></font></div><div class="yiv2320817860MsoNormal"
style="MARGIN:0in 0in 0pt;"><font face="Calibri" size="3"> </font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font size="3"><font face="Calibri">Use these values in logback.xml as follows:</font></font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"> </span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><?</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">xml</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> <span style="COLOR:#7f007f;">version</span><span style="COLOR:black;">=</span><i><span style="COLOR:#2a00ff;">"1.0"</span></i> <span style="COLOR:#7f007f;">encoding</span><span style="COLOR:black;">=</span><i><span style="COLOR:#2a00ff;">"UTF-8"</span></i><span style="COLOR:teal;">?></span></span></div><div
class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">configuration</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">property</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> <span style="COLOR:#7f007f;">resource</span><span style="COLOR:black;">=</span><i><span style="COLOR:#2a00ff;">"</span><b style=""><span style="COLOR:red;">process_settings.properties</span></b><span
style="COLOR:#2a00ff;">"</span></i> <span style="COLOR:teal;">/></span></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> </span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">appender</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> <span style="COLOR:#7f007f;">name</span><span style="COLOR:black;">=</span><i><span style="COLOR:#2a00ff;">"STDOUT"</span></i> <span style="COLOR:#7f007f;">class</span><span style="COLOR:black;">=</span><i><span style="COLOR:#2a00ff;">"ch.qos.logback.core.ConsoleAppender"</span></i><span style="COLOR:teal;">></span></span></div><div
class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">encoder</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">pattern</span><span
style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;">%d [%thread] %-5level %class{0} %<u>msg</u>%n</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">pattern</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">encoder</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span
style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">appender</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> </span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span
style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">appender</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> <span style="COLOR:#7f007f;">name</span><span style="COLOR:black;">=</span><i><span style="COLOR:#2a00ff;">"FILE"</span></i></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"><span style=""> </span><span style="COLOR:#7f007f;">class</span><span style="COLOR:black;">=</span><i><span style="COLOR:#2a00ff;">"ch.qos.logback.core.rolling.RollingFileAppender"</span></i><span style="COLOR:teal;">></span></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span
style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">file</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;">/<u>var</u>/log/<u>xyz</u>.log</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">file</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span
style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">rollingPolicy</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> <span style="COLOR:#7f007f;">class</span><span style="COLOR:black;">=</span><i><span style="COLOR:#2a00ff;">"ch.qos.logback.core.rolling.FixedWindowRollingPolicy"</span></i><span style="COLOR:teal;">></span><span style="COLOR:black;"><span style=""> </span><span style=""> </span></span></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span
style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">fileNamePattern</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;">/<u>var</u>/log/<u>xyz</u>.log.%i.gz</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">fileNamePattern</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span
style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">minIndex</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;">1</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">minIndex</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span
style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">maxIndex</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;">${</span><b style=""><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:red;">BACKUP_COUNT</span></b><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;">}</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">maxIndex</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span
style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">rollingPolicy</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span
style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">triggeringPolicy</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> <span style="COLOR:#7f007f;">class</span><span style="COLOR:black;">=</span><i><span style="COLOR:#2a00ff;">"ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"</span></i><span style="COLOR:teal;">></span></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span><span style="">
</span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">maxFileSize</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;">${</span><b style=""><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:red;">FILE_SIZE</span></b><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;">}</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">maxFileSize</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span><span
style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">triggeringPolicy</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span
style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">encoder</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">pattern</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;">%d{HH:mm:ss.SSS} [%thread] %-5level %class{0} %<u>msg</u>%n</span><span
style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">pattern</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">encoder</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span
style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">appender</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> </span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">root</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> <span style="COLOR:#7f007f;">level</span><span style="COLOR:black;">=</span><i><span
style="COLOR:#2a00ff;">"INFO"</span></i><span style="COLOR:teal;">></span></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">appender-ref</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> <span style="COLOR:#7f007f;">ref</span><span style="COLOR:black;">=</span><i><span style="COLOR:#2a00ff;">"STDOUT"</span></i> <span style="COLOR:teal;">/></span></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span
style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">appender-ref</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> <span style="COLOR:#7f007f;">ref</span><span style="COLOR:black;">=</span><i><span style="COLOR:#2a00ff;">"FILE"</span></i> <span style="COLOR:teal;">/></span></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">root</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span
style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">logger</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> <span style="COLOR:#7f007f;">name</span><span style="COLOR:black;">=</span><i><span style="COLOR:#2a00ff;">"com.test"</span></i><span style="COLOR:teal;">></span></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"><</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">level</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"> <span
style="COLOR:#7f007f;">value</span><span style="COLOR:black;">=</span><i><span style="COLOR:#2a00ff;">"${</span></i><b style=""><span style="COLOR:red;">LOG_LEVEL</span></b><i><span style="COLOR:#2a00ff;">}"</span></i> <span style="COLOR:teal;">/></span></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">logger</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span style=""> </span></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"><span
style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"></</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#3f7f7f;">configuration</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;">></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"> </span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><b style=""><font size="3"><font face="Calibri">Sample JAVA Code:</font></font></b></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"> </span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><font size="3"><font
face="Calibri">Set the values set in UI to properties file and reset the logger context as follows.</font></font></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:teal;"> </span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;">LoggerContext loggerContext = (LoggerContext) LoggerFactory.<i>getILoggerFactory</i>();</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;">loggerContext.reset();<span style=""> </span></span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in
0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;">ContextInitializer ci = </span><b><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:#7f0055;">new</span></b><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;"> ContextInitializer(loggerContext);</span><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;"></span></div><div class="yiv2320817860MsoNormal" style="MARGIN:0in 0in 0pt;"><span style="FONT-SIZE:10pt;FONT-FAMILY:Consolas;COLOR:black;">ci.autoConfig();</span></div><div>Hope this helps..</div><div>Regards,</div><div>Kriti</div><div> </div><div><div><br></div><font color="#990099">-----"Logback-user" <logback-user-bounces@qos.ch> wrote: -----<br><br></font><blockquote style="PADDING-LEFT:5px;MARGIN-LEFT:5px;BORDER-LEFT:#000000 2px solid;PADDING-RIGHT:0px;MARGIN-RIGHT:0px;">To: logback <logback-user@qos.ch><br>From: Xavier Outhier <xouthier@yahoo.fr><br>Sent by: "Logback-user"
<logback-user-bounces@qos.ch><br>Date: 08/09/2013 12:26PM<br>Subject: [logback-user] Using configuration file and programatically changing configuration?<br><br><div style="FONT-SIZE:12pt;FONT-FAMILY:times new roman, new york, times, serif;COLOR:#000;BACKGROUND-COLOR:#fff;"><div>Hi,</div><div><br></div><div style="FONT-SIZE:16px;FONT-FAMILY:times new roman, new york, times, serif;COLOR:rgb(0,0,0);FONT-STYLE:normal;BACKGROUND-COLOR:transparent;">the idea is to have to enable the user to change the config from the UI of the web applications (without accessing the server).<br></div><div style="FONT-SIZE:16px;FONT-FAMILY:times new roman, new york, times, serif;COLOR:rgb(0,0,0);FONT-STYLE:normal;BACKGROUND-COLOR:transparent;">I would like to know if it is possible to have both a configuration file for LogBack for the default usage of the application and the configuration being modified programatically the fly when investigating issue. How to implement
that?</div><div style="FONT-SIZE:16px;FONT-FAMILY:times new roman, new york, times, serif;COLOR:rgb(0,0,0);FONT-STYLE:normal;BACKGROUND-COLOR:transparent;">On way could be to write on the fly the configuration file when it is set to be reloaded automatically but is there an another way that would pause the reading from the config file and use the API?</div><div style="FONT-SIZE:16px;FONT-FAMILY:times new roman, new york, times, serif;COLOR:rgb(0,0,0);FONT-STYLE:normal;BACKGROUND-COLOR:transparent;"><br></div><div style="FONT-SIZE:16px;FONT-FAMILY:times new roman, new york, times, serif;COLOR:rgb(0,0,0);FONT-STYLE:normal;BACKGROUND-COLOR:transparent;">Thanks,</div><div style="FONT-SIZE:16px;FONT-FAMILY:times new roman, new york, times, serif;COLOR:rgb(0,0,0);FONT-STYLE:normal;BACKGROUND-COLOR:transparent;"><br></div><div style="FONT-SIZE:16px;FONT-FAMILY:times new roman, new york, times,
serif;COLOR:rgb(0,0,0);FONT-STYLE:normal;BACKGROUND-COLOR:transparent;">Xavier.<br></div><div style="FONT-SIZE:16px;FONT-FAMILY:times new roman, new york, times, serif;COLOR:rgb(0,0,0);FONT-STYLE:normal;BACKGROUND-COLOR:transparent;"></div></div><font face="Default Monospace,Courier New,Courier,monospace" size="2">_______________________________________________<br>Logback-user mailing list<br>Logback-user@qos.ch<br><a rel="nofollow" target="_blank" href="http://mailman.qos.ch/mailman/listinfo/logback-user">http://mailman.qos.ch/mailman/listinfo/logback-user</a></font></blockquote><br></div></font><div>=====-----=====-----=====<br>
Notice: The information contained in this e-mail<br>
message and/or attachments to it may contain <br>
confidential or privileged information. If you are <br>
not the intended recipient, any dissemination, use, <br>
review, distribution, printing or copying of the <br>
information contained in this e-mail message <br>
and/or attachments to it are strictly prohibited. If <br>
you have received this communication in error, <br>
please notify us by reply e-mail or telephone and <br>
immediately and permanently delete the message <br>
and any attachments. Thank you</div>
</div><br>_______________________________________________<br>Logback-user mailing list<br><a ymailto="mailto:Logback-user@qos.ch" href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br><a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a><br><br></div> </div> </div> </div></body></html>