Skip to main content

I have implemented the Logging Plugin to send me emails when I get a K2 Error message logged,  using the code from the BlackMarket project  http://www.k2underground.com/k2/ProjectHome.aspx?ProjectID=2 and this works fine.


I am now writing a server event in which I want to write to the error log in the event of an error in my custom code, which I can do, but if I call LogErrorMessage it is getting logged as a Debug message, hence I don't get the email when the error occurs. When I try and call LogMessage and pass it the Severity parameter as 'Error' to write to the log with the Error Severity, I get the error:


Method not found: 'Boolean SourceCode.KO.K2LoggerProxy.LogMessage(SourceCode.Logging.Severity, System.String, System.String, System.String, System.String, Int64)'


Being new to writing server events, I am not exactly sure what I am doing wrong.


Below is a snippet of my code:


using System.Drawing;
using SourceCode.KO;
using SourceCode.Logging;
using SourceCode.Workflow.Common.Extenders;
.....
.....


 catch (Exception e) {
//This doesn't work throws an error - trying to write to the log
    K2.ProcessInstance.Logger.LogMessage(SourceCode.Logging.Severity.Error,
                                         e.Source.ToString(),
                                         "MessageName",
                                         e.Message.ToString(),
                                         "MsgCategory",999);


// This works but logs error as Debug message
    K2.ProcessInstance.Logger.LogErrorMessage(  e.Source.ToString(), e.Message.ToString());
}


 


 

Be the first to reply!

Reply