More in this section

Forums / General Discussions / How to change the error.log directory?

How to change the error.log directory?

9 posts, 1 answered
  1. Ian
    Ian avatar
    75 posts
    Registered:
    25 Oct 2010
    27 Jan 2011
    Link to this post
    Hello
    How can I change the location for the error.log file. I'm trying to autodeploy with NAnt, but can't delete the error.log file in the target directory as it is in use by another process so I want to move it out of the project directory and into c:/logs where all my other log files go.

    Thanks

    Ryan
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    27 Jan 2011
    Link to this post
    Hi Ryan,

    You can use ObjectFactory class (represents a static factory class for creating application objects with IUnityContainer )

    Inside Application_Start event of Global.asax you can registers types with IoC framework.

    You can subscribe for ObjectFactory.Initializing and cancel the event if executing args. command name is  ConfigureLogging

    ObjectFactory.Initializing += new EventHandler<Telerik.Sitefinity.Data.ExecutingEventArgs>(
     
    delegate(object s, Telerik.Sitefinity.Data.ExecutingEventArgs args)
     
    {
     
    if (args.CommandName == "ConfigureLogging")
     
    {
     
    args.Cancel = true;
    var errorFileName = HostingEnvironment.MapPath("mypath");
     
    }
     
    });
     
    }



    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Ian
    Ian avatar
    75 posts
    Registered:
    25 Oct 2010
    28 Jan 2011
    Link to this post
    Thanks Ivan - is there a particular namespace I need to import to get that code working?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Jan 2011
    Link to this post
    Hi Ryan,

    You should be add all need namespaces using Visual Studio Intellisense. Can you subscribe for Initializing event? We added it recently and I think that could be not included in your build, but it would be added for sure in the Friday's build.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Ian
    Ian avatar
    75 posts
    Registered:
    25 Oct 2010
    28 Jan 2011
    Link to this post
    Yes, it's the Initializing event that isn't appearing in Intellisense. I'll check out the weekly build.

    Thanks again
    Ryan
  6. Apptain
    Apptain avatar
    30 posts
    Registered:
    20 Aug 2012
    10 Feb 2011
    Link to this post
    Try

    Telerik.Sitefinity.Abstractions.Bootstrapper.Initializing
  7. Zarni Winlatt
    Zarni Winlatt avatar
    2 posts
    Registered:
    14 Jul 2009
    05 Sep 2011
    Link to this post
    Hi I also want to change the location of the error.log to a folder under C:\ . I use the following like you described,

    ObjectFactory.Initializing += new EventHandler<Telerik.Sitefinity.Data.ExecutingEventArgs>(
     
    delegate(object s, Telerik.Sitefinity.Data.ExecutingEventArgs args)
     
    {
     
    if (args.CommandName == "ConfigureLogging")
     
    {
     
    args.Cancel = true;
    var errorFileName = HostingEnvironment.MapPath("mypath");
     
    }
     
    });
     
    }

    However, it is not working, If I want to move to folder "C:\SitefinityLog\" then I should use "var errorFileName = HostingEnvironment.MapPath(@"C:\SitefinityLog\")" ?
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Sep 2011
    Link to this post
    Hello Zarni,

    Please take a look at this post

    http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/change-logging-directory.aspx

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  9. Zarni Winlatt
    Zarni Winlatt avatar
    2 posts
    Registered:
    14 Jul 2009
    08 Sep 2011
    Link to this post
    Hi Thanks a lot for your help. I followed the instructions from the link you provided and it is working now :)
9 posts, 1 answered