Create log for umbraco 7.x

//You can specificy the class your are logging
LogHelper.Error(typeof(MyClass), "msg", e);
//Otherwise, you can use this code, that gets type automatically
LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "msg", e);

OR

LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "msg", ex);
OR
@using Umbraco.Core.Logging;
@{
LogHelper.Info(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "Message"); 
}
OR
@using Umbraco.Core.Logging;
@{
    LogHelper.Info(this.GetType(), "Message"); 
}

About eagle081183

Passionate, Loyal
This entry was posted in ASP.NET MVC, C#. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s