{"id":1409,"date":"2012-10-08T01:08:32","date_gmt":"2012-10-07T23:08:32","guid":{"rendered":"https:\/\/alax.info\/blog\/?p=1409"},"modified":"2012-10-08T01:12:31","modified_gmt":"2012-10-07T23:12:31","slug":"log-process-exceptions-filters-and-email-notification","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/1409","title":{"rendered":"Log Process Exceptions: Filters and Email Notification"},"content":{"rendered":"<p>Moving on with <a href=\"https:\/\/alax.info\/blog\/1359\">LogProcessExceptions<\/a> tool which externally monitors (debugs, to be more specific) an application of interest and captures its exceptions writing <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/ms680369%28v=vs.85%29.aspx\">minidump files<\/a> for further analysis.<\/p>\n<p>This updates adds two features:<\/p>\n<ol>\n<li>Ability to filter out the exceptions of interest<\/li>\n<li>An email notification on exception, with or without minidump file<\/li>\n<\/ol>\n<h2>Filter<\/h2>\n<p>A new property page in the wizard provides one with an option to specify filters\/rules to identify exceptions of interest. One rule per line, once exception occurred its codes are compared against rules top to bottom. The first matching rule results in decision whether to log the minidump (and issue a notification) or not. If no filter\/rule applicable found, or the entire filter is empty, the exception is logged (positive).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/10\/Image0051.png\" alt=\"\" title=\"Filter Property Page\" width=\"513\" height=\"400\" class=\"alignnone size-full wp-image-1412\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/10\/Image0051.png 513w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/10\/Image0051-320x249.png 320w\" sizes=\"auto, (max-width: 513px) 100vw, 513px\" \/><\/p>\n<p>The rule syntax is the following:<\/p>\n<ul>\n<li>empty lines are ignored<\/li>\n<li>anything to the right from <code>\/\/<\/code> is considered to be a comment<\/li>\n<li>meaningful line has one or more items separated by spaces<\/li>\n<li>first item on the line is either <code>-<\/code> or <code>+<\/code> to indicate whether the rule will result in skipping the exception (minus sign) or logging in (plus sign)<\/li>\n<li>second item is exception code, e.g. <code>0xC0000005<\/code> for memory access violation, <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2010\/07\/30\/10044061.aspx\"><code>0xE06D7363<\/code><\/a> for native C++ exception (this constant has a dedicated alias &#8220;C++&#8221;<\/li>\n<li>third item applies to C++ exceptions and matches ATL <code>CAtlException<\/code> codes, and this allows to filter out specific <code>HRESULT<\/code>s; it is also possible to specify a range of codes as shown on the screenshot above<\/li>\n<\/ul>\n<h2>Email Notification<\/h2>\n<p>Why? Some issues are long to wait, so you don&#8217;t want to have it in front of you until the issue takes place. This is when a friendly email from the application would be so much appreciated.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/10\/Image0061.png\" alt=\"\" title=\"Email Notification Property Page\" width=\"513\" height=\"400\" class=\"alignnone size-full wp-image-1413\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/10\/Image0061.png 513w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/10\/Image0061-320x249.png 320w\" sizes=\"auto, (max-width: 513px) 100vw, 513px\" \/><\/p>\n<p>The application gets you that by queuing an email once exception of interest takes place. The email settings are basically those of class described on an <a href=\"https:\/\/alax.info\/blog\/1357\">earlier EmailTools.dll post<\/a>. The whole SMTP email class is embedded into this application, and it actually deserves a dedicated post on explaining how to embed ATL COM class with persistence based on COM map, which in turn depends on type library expected to be registered, into another application which additionally runs without registration.<\/p>\n<p>There is a default preset tuned for Google Mail, but there are other options as well. Note that both filter and email settings are saved into registry under <code>HKCU<\/code> to be reused in next runs of the application.<\/p>\n<p>Small minidump files are attached right to the emails. Larger ones (typically those with Full Memory option checked) are only mentioned. There is a threshold setting that defines how many megabytes is OK to attach the most.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/10\/Image007.png\" alt=\"\" title=\"Email Sample\" width=\"575\" height=\"324\" class=\"alignnone size-full wp-image-1414\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/10\/Image007.png 575w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/10\/Image007-320x180.png 320w\" sizes=\"auto, (max-width: 575px) 100vw, 575px\" \/><\/p>\n<p>Download links:<\/p>\n<ul>\n<li>Partial Visual C++ .NET 2010 source code: <a href=\"https:\/\/www.alax.info\/trac\/public\/browser\/trunk\/Utilities\/LogProcessExceptions\">Trac<\/a>, <a href=\"https:\/\/www.alax.info\/svn\/public\/trunk\/Utilities\/LogProcessExceptions\/\">Subversion<\/a><\/li>\n<li>Binaries: Win32 \u00e2\u20ac\u201c <a href=\"https:\/\/www.alax.info\/svn\/public\/trunk\/Utilities\/LogProcessExceptions\/_Bin\/Win32\/Release\/LogProcessExceptions.exe\">LogProcessExceptions.exe<\/a>, x64 \u00e2\u20ac\u201c <a href=\"https:\/\/www.alax.info\/svn\/public\/trunk\/Utilities\/LogProcessExceptions\/_Bin\/x64\/Release\/LogProcessExceptions.exe\">LogProcessExceptions.exe<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Moving on with LogProcessExceptions tool which externally monitors (debugs, to be more specific) an application of interest and captures its exceptions writing minidump files for further analysis. This updates adds two features: Ability to filter out the exceptions of interest An email notification on exception, with or without minidump file Filter A new property page&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/1409\">Read the full article<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,13,2,20],"tags":[218,161,443,347],"class_list":["post-1409","post","type-post","status-publish","format-standard","hentry","category-atl","category-source","category-utilities","category-wtl","tag-debug","tag-exception","tag-log","tag-troubleshooting"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/1409","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/comments?post=1409"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/1409\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=1409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=1409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=1409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}