change priority at runtime

Topics: Logging Application Block
Nov 9, 2007 at 5:08 AM
Hi,

I am using EntLib Logging Application block, Tracer with priority 1 in my project and i have set minimumPriority = 3 for priority filter in config file which means that start and end messages due to Tracer will never be loged to log file. I want to keep it this way for most of the time, but however during performance issues, i want tracer to be temporiarly enabled so that i can track down what is taking too long. How do i enable tracer to put message in log file? One way is to change the minimumPriority = 1 for priority filter in config file manually which in my case is not a option. Is there a way that i can programatically change this config settings with out bringing down the application so that future calls will be traced?

Thanks in advance,
Shankaar.
Nov 9, 2007 at 11:53 AM
If you change the minimumPriority to 1 in the config file the EntLib Logging Application block will automatically pick up the change and use it. You do not have to restart your app for the changes to the config file to be picked up. That is how I am handling this same situations. I have all my debug stuff set to priority 0, then when I want them to start showing up I just change my config file minimumPriority to 0 and the debug stuff will start showing up shortly without ever having to restart my app.

Just a note the polling for config file changes is hardcoded to 15 seconds so your changes wont take effect rigth away. This one threw me off at first. There is now way to changes this without recompiling the Entlib right now.

Hope this helps

Joe
Nov 9, 2007 at 1:08 PM
Joe, thanks for your response.

Just to give you our infrastructure background, our apps are executed from network drive which is read only. So i cannot change config file. Is there a way to change priority filter settings programatically? Any set methods which allows to change priority filter? I want this change to take effect only for current instance of my app. I do not want or expect to persist this change in config file.

If this feature is not currently available, how do i request patterns & practices group to provide such a feature? I am sure many will get benifeted by this. Use case is you cannot expect end users of your application to edit config file properly. It is always better to provide users with a winform to change the settings and save were in data entry can be validated before saving settings rather than edit config file directly. I hope you all agree to this.

Any help is greatly appreciated.
Regards,
Shankaar.
Nov 9, 2007 at 6:11 PM
Hi Shankaar,

There is currently no way to change the settings used by the Logger facade programmatically but you can, with some effort, put together your own facade using the same bulding blocks (filters, formatters, trace listeners, etc).

You can post a suggestion with the Issue Tracker right next to this discussion list.

I'm confused about your request though; there currently is a winforms application that will let users author a proper configuration file, and also a version of the editor integrated to Sisual Studio. How would the tool you are suggesting differ from the available tool?

Regards,
Fernando