Error Handling

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
7/10/2012 5:47:50 AM
Gravatar
Total Posts 4

Error Handling

I have a try catch block in mojoportal custom web control i want to write the stack trace along with the error message that i caught in the catch block in mojoportal log file how can i achieve this?

7/10/2012 7:50:07 AM
Gravatar
Total Posts 2253

Re: Error Handling

Hi,

You need to add the Log4Net Assembly as a reference to your project and then use the following as an example.

using log4net;

namespace MyProject.Web
{
   public partial class MyCustomControl : SiteModuleControl
   {
      private static readonly ILog log = LogManager.GetLogger(typeof(MyCustomControl));
   }

   protected void Page_Load(object sender, EventArgs e)
   {
      try 
      {
         //try to do something here
      }
      catch (Exception ex) //try to be more specific with the exception type
      {
         log.Error("could not do something. Error was: " + ex);
      }
   }
}

That should get you started with logging in mojoPortal.

HTH,
Joe D.

7/10/2012 8:07:35 AM
Gravatar
Total Posts 4

Re: Error Handling

Thanks Joe.. it worked....nice work guys Mojoportal is really cool..........yes

 

You must sign in to post in the forums. This thread is closed to new posts.