Print Page | Close Window

Trouble with Programmatic Configuration

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2928
Printed Date: 25-Mar-2025 at 2:28am


Topic: Trouble with Programmatic Configuration
Posted By: jradxl
Subject: Trouble with Programmatic Configuration
Date Posted: 25-Aug-2011 at 4:47pm
Hi,
I've got a problem with basic programmatic configuration.
I've gone back to a Console App, and set the LogFile property to "", but it doesn't turnoff the Logfile.
Setting it to some filename doesn't work either.

        public static void Main(string[] args)
        {
            var config = IdeaBlade.Core.IdeaBladeConfig.Instance;
            config.Logging.LogFile = ""// @"MyLogFile.xml";

Any suggestions?
thanks
John




Replies:
Posted By: jradxl
Date Posted: 26-Aug-2011 at 4:32am
Hi,
I think this is a bug! (Not responding to a programmatic change to LogFile)
Since ShouldLogSqlQueries and EdmKeys work fine, why does LogFile do nothing?
            var config = IdeaBlade.Core.IdeaBladeConfig.Instance;
            config.Logging.LogFile = @".\MyLogFile.xml";
            config.Logging.ShouldLogSqlQueries = true;
            var keys = config.EdmKeys;
            keys.Add(...);
thanks
John



Posted By: robertg
Date Posted: 26-Aug-2011 at 9:42am
John,
 
I'll look into this. I'm not sure if it's a bug, or just an infelicity based on design limitation. Is there a reason you can't make the change in the App.config?
 
Yours,
Robert


Posted By: jradxl
Date Posted: 26-Aug-2011 at 10:31am
Hi,
Mainly because I'm 2-tier and I don't want the user to fiddle with the *.exe.config.
Probably I can compromise with an embedded App.config, but that still means I cannot turn it off.
I did role back to 6.1.0.0 but it has the same symptoms.

I'm convinced that your documentation suggests this is a feature.


thanks
John



Posted By: robertg
Date Posted: 26-Aug-2011 at 10:36am
Yeah, it's as I thought... by the time IdeaBlade.Instance is constructed, logging has already started. In your case, it sounds like you may want to implement your own custom logger, instead of using this default logger on the client side. You can find information on doing this in the DRC, at http://drc.ideablade.com/xwiki/bin/view/Documentation/custom-logger - http://drc.ideablade.com/xwiki/bin/view/Documentation/custom-logger .
 
-- Robert


Posted By: jradxl
Date Posted: 26-Aug-2011 at 1:08pm
Many thanks for the quick response.
I now have logging redirected via NLog

But I think your documentation is missleading.
It describes how the IdeaBlade.Instance can be used to set the configuration, if done early enough before any Entity is requested. And, there does not need to be a setter on LogFile if it can never be set.

thanks
John


http://drc.ideablade.com/xwiki/bin/view/Documentation/deploy-configuration
Section: Configuration contents and defaults, Logging in table




Print Page | Close Window