{"id":12743,"date":"2024-11-25T05:57:32","date_gmt":"2024-11-25T13:57:32","guid":{"rendered":"https:\/\/www.coretechnologies.com\/blog\/?p=12743"},"modified":"2024-11-25T05:57:32","modified_gmt":"2024-11-25T13:57:32","slug":"debugview-messages","status":"publish","type":"post","link":"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/debugview-messages\/","title":{"rendered":"Q&#038;A: With AlwaysUp, Where Do My Application&#8217;s Debug Messages Go?"},"content":{"rendered":"<div align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"no-lazy-load\" src=\"\/blog\/images\/where-do-debug-messages-go.webp\" style=\"margin-bottom:20px;\" title=\"With AlwaysUp, Where Do My Application's Debug Messages Go?\" alt=\"With AlwaysUp, Where Do My Application's Debug Messages Go?\" border=\"0\" width=\"380\" height=\"160\" \/><\/div>\n<div class=\"blog-qa-question-box\">\n<img loading=\"lazy\" decoding=\"async\" class=\"no-lazy-load\" src=\"https:\/\/cdn.coretechnologies.com\/images\/quotes-transparent-21x21.webp\" width=\"21\" height=\"21\" \/>&nbsp;&nbsp;We have installed <a href=\"\/products\/AlwaysUp\/\">AlwaysUp<\/a> in a number of our Windows servers, and it works great.<\/p>\n<p>We have a specific application that outputs debugging messages that are usually visible in the Windows Debug console view via the <a href=\"https:\/\/learn.microsoft.com\/en-us\/sysinternals\/downloads\/debugview\" target=\"_blank\" rel=\"noopener\">Sysinternals DebugView<\/a> or <a href=\"https:\/\/github.com\/CobaltFusion\/DebugViewPP\" target=\"_blank\" rel=\"noopener\">DebugView++<\/a> desktop applications. <\/p>\n<p>When we start the same application from AlwaysUp, I don&#8217;t see the debug messages in the DebugView console. Do you know where they go?<\/p>\n<p align=\"right\">&mdash; Giovanni<\/p>\n<\/div>\n<p>Hi Giovanni, thanks for getting in touch.<\/p>\n<p>We&#8217;ve seen this problem before. To explain in a sentence, you&#8217;re not seeing your applications debug messages because AlwaysUp is running your application in Session 0 while DebugView is monitoring your logon session. <\/p>\n<p>But that&#8217;s a mouthful! Let&#8217;s try to explain what it means. \ud83d\ude42<\/p>\n<h2 class=\"blog-caption\">Windows Sessions, in a nutshell<\/h2>\n<p>To understand what&#8217;s going on, it&#8217;s important to be aware of <a href=\"https:\/\/techcommunity.microsoft.com\/t5\/ask-the-performance-team\/sessions-desktops-and-windows-stations\/ba-p\/372473\" target=\"_blank\" rel=\"noopener\">Windows sessions<\/a> and how they work. In case you could use a refresher on this very technical topic, here are a few facts about sessions:<\/p>\n<ol>\n<li>\n<p><b>When you log in to your computer, Windows creates a new session for you.<\/b> That session stays open until you log out &mdash; or Windows restarts. You can think of a session as the &#8220;container&#8221; for your entire login experience.<\/p>\n<\/li>\n<li>\n<p><b>A session holds your desktop and all the programs you launch.<\/b> Indeed, every application you start runs in your session.<\/p>\n<\/li>\n<li>\n<p>By design, Windows allows programs running in the same session to communicate freely. However, because of security restrictions, <b>applications running in different sessions cannot easily interact<\/b>.<\/p>\n<p>For example, an application running in your session cannot use the popular <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/winuser\/nf-winuser-enumwindows\" target=\"_blank\" rel=\"noopener\">EnumWindows<\/a> API function to list the top-level windows in someone else&#8217;s session. Windows simply disallows that overreach.<\/p>\n<\/li>\n<li>\n<p><b>Sessions are numbered.<\/b> The first person to log in to the computer is given Session 1 (&#8220;the session with ID 1&#8221;). The next person to log in is assigned Session 2, and so on.<\/p>\n<\/li>\n<li>\n<p>When your computer boots, <b>Windows automatically creates a special session, called Session 0<\/b>. All Windows Services &mdash; which may start at boot before anyone logs on &mdash; run in Session 0.<\/p>\n<p>Session 0 is sometimes called the &#8220;console&#8221; or &#8220;background&#8221; session because of the special role it plays.<\/p>\n<\/li>\n<\/ol>\n<p>And with that framework in place, let&#8217;s return to your specific situation.<\/p>\n<h2 class=\"blog-caption\">DebugView and your application are running in different Windows sessions<\/h2>\n<p>When you logged into your PC &mdash; either using the keyboard and mouse or remotely via RDP &mdash; Windows created a new session for you. Let&#8217;s say it&#8217;s Session 1 (but it could just as well be Session 2 or 3 if you weren&#8217;t the first person to log in after boot).<\/p>\n<p>So when you start DebugView on your desktop, Windows launches it in Session 1. DebugView comes up visibly on your desktop, like any other application you start.<\/p>\n<p>Similarly, when you start your application normally (without AlwaysUp), it will likely pop up on-screen as well. And DebugView will log its debugging messages, as expected.<\/p>\n<p>But the situation is different when AlwaysUp runs your application. Instead of starting it visibly on your desktop, in Session 1, <b>AlwaysUp starts your application in Session 0<\/b> &mdash; the session created at boot. Recall that&#8217;s where all Windows Services operate.<\/p>\n<p>In that situation, DebugView will not capture messages from your application. That&#8217;s because DebugView is only monitoring applications running in Session 1 &mdash; the same session where it&#8217;s running.<\/p>\n<h2 class=\"blog-caption\">The solution: Configure DebugView to capture messages from Session 0<\/h2>\n<p>Fortunately there&#8217;s a simple fix:<\/p>\n<ol style=\"margin-bottom:24px\">\n<li>\n<p>Start DebugView.<\/p>\n<\/li>\n<li>\n<p>Select the <b>Capture<\/b> menu and ensure that <b>Capture Global Win32<\/b> is checked:<\/p>\n<div align=\"center\"><a href=\"\/blog\/images\/debugview-capture-global-win32.png\" class=\"zoomPopup\" title=\"Capture Global Win32 in Sysinternals DebugView\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" class=\"image-padding\" src=\"\/blog\/images\/debugview-capture-global-win32.png\" title=\"Capture Global Win32 in Sysinternals DebugView (click to enlarge)\" alt=\"Capture Global Win32 in Sysinternals DebugView\" border=\"0\" width=\"520\" \/><\/a><\/div>\n<\/li>\n<\/ol>\n<p>With that option active, DebugView will capture messages from all Windows sessions &mdash; not only the session where it&#8217;s running.<\/p>\n<p>The <a href=\"https:\/\/documentation.help\/DebugView\/DbgviewCapturing_Debug_Output.htm\" target=\"_blank\" rel=\"noopener\">somewhat dated DebugView help file<\/a> explains what&#8217;s going on this way:<\/p>\n<div class=\"blog-qa-question-box\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cdn.coretechnologies.com\/images\/quotes-transparent-21x21.png\" width=\"21\" height=\"21\" \/>&nbsp;If you run DebugView in a remote logon session of Windows 2000 Terminal Services, DebugView adds a <b>Capture Global Win32<\/b> menu item to the <b>Capture<\/b> menu. Whereas the <b>Capture Win32<\/b> menu item and associated toolbar button enable and disable capture of debug output in DebugView&#8217;s local logon session, the <b>Capture Global Win32<\/b> menu item lets you enable and disable the capture of debug output that is generated in the console (global) session. Win32 services run in the console session, so this feature lets you capture the output that services generate even when you are running DebugView in another logon session.<\/p>\n<\/div>\n<h2 class=\"blog-caption\">You can capture debug messages from all sessions with DebugView++ too<\/h2>\n<p>DebugView++ provides a similar <b>Capture Global Win32<\/b> option, which is on by default. It&#8217;s available under the <b>Log<\/b> menu:<\/p>\n<div align=\"center\"><a href=\"\/blog\/images\/debugviewpp-capture-global-win32.png\" class=\"zoomPopup\" title=\"Capture Global Win32 in DebugView++\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" class=\"image-padding\" src=\"\/blog\/images\/debugviewpp-capture-global-win32.png\" title=\"Capture Global Win32 in DebugView++ (click to enlarge)\" alt=\"Capture Global Win32 in DebugView++\" border=\"0\" width=\"520\" \/><\/a><\/div>\n<p>So you&#8217;re free to use either tool when running your application as a Windows Service with AlwaysUp.<\/p>\n<p style=\"margin-top: 30px\">\nHappy debugging!\n<\/p>\n<div style=\"margin-top:30px\" align=\"center\">\n<div class=\"cta-button-1\">\n<table role=\"presentation\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"left\">\n<tbody>\n<tr>\n<td align=\"center\"><a href=\"\/blog\/tag\/alwaysup-tag\/\" title=\"More articles about AlwaysUp\"><span><nobr>More articles about AlwaysUp&#8230;<\/nobr><\/span><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<!-- relpost-thumb-wrapper --><div class=\"relpost-thumb-wrapper\"><!-- filter-class --><div class=\"relpost-thumb-container\"><style>.relpost-block-single-image, .relpost-post-image { margin-bottom: 10px; }<\/style><h3>You may also like...<\/h3><div style=\"clear: both\"><\/div><div style=\"clear: both\"><\/div><!-- relpost-block-container --><div class=\"relpost-block-container relpost-block-column-layout\" style=\"--relposth-columns: 3;--relposth-columns_t: 2; --relposth-columns_m: 2\"><a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/versus-service-protector\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"Q&amp;A: What&#039;s the Difference between AlwaysUp and Service Protector?\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/alwaysup-vs-service-protector-150x150.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">Q&amp;A: What&#039;s the Difference between AlwaysUp and Service Protector?<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/how-dropbox-auto-upgrade-works\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"How Dropbox Auto-Upgrade Works\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/dropbox-logo-150x150.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">How Dropbox Auto-Upgrade Works (and How to get AlwaysUp to Play Nice with it)<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/multiple-alpha-servers\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"Q &amp; A: How do I Prevent Multiple Alpha Application Servers from Running?\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/qa-150x150.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">Q &amp; A: How do I Prevent Multiple Alpha Application Servers from Running?<\/h2><\/div><\/div><\/a><\/div><!-- close relpost-block-container --><div style=\"clear: both\"><\/div><\/div><!-- close filter class --><\/div><!-- close relpost-thumb-wrapper -->","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp;We have installed AlwaysUp in a number of our Windows servers, and it works great. We have a specific application that outputs debugging messages that are usually visible in the Windows Debug console view via the Sysinternals DebugView or DebugView++ &hellip; <a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/debugview-messages\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":12745,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[26,66,364,153,283],"class_list":["post-12743","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-alwaysup","tag-alwaysup-tag","tag-debugging","tag-debugview","tag-session-0-isolation","tag-sysinternals"],"_links":{"self":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/12743","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=12743"}],"version-history":[{"count":13,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/12743\/revisions"}],"predecessor-version":[{"id":12781,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/12743\/revisions\/12781"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media\/12745"}],"wp:attachment":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=12743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=12743"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=12743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}