How to change the error.log directory?
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
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"
);
);
Thanks Ivan - is there a particular namespace I need to import to get that code working?
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
Yes, it's the Initializing event that isn't appearing in Intellisense. I'll check out the weekly build.
Thanks again
Ryan
Try
Telerik.Sitefinity.Abstractions.Bootstrapper.Initializing
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"
);
);
Hello Zarni,
Please take a look at this post
www.sitefinity.com/.../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 >>
Hi Thanks a lot for your help. I followed the instructions from the link you provided and it is working now :)