public server static void writeEventLogEntry(str _message)
{
System.Diagnostics.EventLog ev;
System.Boolean sourceExists;
System.Diagnostics.EventLogEntryType entryType;
System.String msg;
;
new InteropPermission(InteropKind::ClrInterop).assert();
sourceExists = System.Diagnostics.EventLog::SourceExists('<AOS Runtime>', '<Computer Name>');
if (sourceExists)
{
ev = new System.Diagnostics.EventLog('<Microsoft Dynamics AX AIF>',
'<Computer Name>',
'<AOS Runtime>');
try
{
entryType = CLRInterop::parseClrEnum('System.Diagnostics.EventLogEntryType',
'<Error>');
msg = _message;
ev.WriteEntry(msg, entryType);
}
catch
{
exceptionTextFallThrough();
}
if (ev != null)
{
ev.Close();
}
}
CodeAccessPermission::revertAssert();
}
{
System.Diagnostics.EventLog ev;
System.Boolean sourceExists;
System.Diagnostics.EventLogEntryType entryType;
System.String msg;
;
new InteropPermission(InteropKind::ClrInterop).assert();
sourceExists = System.Diagnostics.EventLog::SourceExists('<AOS Runtime>', '<Computer Name>');
if (sourceExists)
{
ev = new System.Diagnostics.EventLog('<Microsoft Dynamics AX AIF>',
'<Computer Name>',
'<AOS Runtime>');
try
{
entryType = CLRInterop::parseClrEnum('System.Diagnostics.EventLogEntryType',
'<Error>');
msg = _message;
ev.WriteEntry(msg, entryType);
}
catch
{
exceptionTextFallThrough();
}
if (ev != null)
{
ev.Close();
}
}
CodeAccessPermission::revertAssert();
}
No comments:
Post a Comment