New Posts New Posts RSS Feed: Changing LogFile at Runtime
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Changing LogFile at Runtime

 Post Reply Post Reply
Author
ken.nelson View Drop Down
Groupie
Groupie


Joined: 03-Mar-2009
Location: Ann Arbor, MI
Posts: 54
Post Options Post Options   Quote ken.nelson Quote  Post ReplyReply Direct Link To This Post Topic: Changing LogFile at Runtime
    Posted: 03-Mar-2009 at 10:27am
Is there a way to change the log file path at run time?
 
The application we're writing will be installed on several client machines with very limited write access to the local machine.  The default log file path is the same as the executable path (i.e. C:\Program Files...), but we are not allowed write access to that path.  We can write to the user's My Documents path, but obviously this path is different for every user so we can't simply set a different path in the ideablade.ibconfig file.
 
Using the Object Browser, I was able to find:
 
IdeaBlade.Util.IdeaBladeConfig, and thought that I might be able to use the following to set the log file path:
 
IdeaBlade.Util.IdeaBladeConfig c = IdeaBlade.Util.IdeaBladeConfig.Instance;
c.Logging.LogFile= @"C:\new path\DebugLog.xml";
 
This does update the LogFile, but it doesn't seem to have any effect on where the file is written.  I also noticed that c.Logging has a FullyQualifiedLogFile property that is not being updated when I explicitly set the LogFile, and it is read only so I can't update this manually.
 
Is there anyway to get around this problem?
 
Thanks,
Ken
 
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1390
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 03-Mar-2009 at 3:44pm
Unfortunately there's no way to change the path at runtime, since once you reference IdeaBladeConfig.Instance itís too late Ė the configuration information has already loaded and tracing has started.  There is a workaround however; you can create another instance of the logger, like this:

       TraceFileXmlLogger logger = new TraceFileXmlLogger(@"c:\new path\DebugLog.xml", true);

Note that initialization activities prior to creation of this instance wonít be logged to this file.  You can also set the <logFile> element in your ibconfig to an empty string if you donít want multiple log files although you may miss important startup messages.  Note that here in IdeaBlade support we usually want a full debug log when diagnosing problems.

 

Back to Top
ken.nelson View Drop Down
Groupie
Groupie


Joined: 03-Mar-2009
Location: Ann Arbor, MI
Posts: 54
Post Options Post Options   Quote ken.nelson Quote  Post ReplyReply Direct Link To This Post Posted: 05-Mar-2009 at 12:16pm
Excellent.  Thanks, that works for us.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down