<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Is it possible in the log to see previous shutdown</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/76808551b9/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/76808551b9/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/76808551b9/</id><updated>2024-02-09T12:22:29.441000Z</updated><subtitle>Recent posts to Is it possible in the log to see previous shutdown</subtitle><entry><title>Is it possible in the log to see previous shutdown</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/76808551b9/?limit=25#624c" rel="alternate"/><published>2024-02-09T12:22:29.441000Z</published><updated>2024-02-09T12:22:29.441000Z</updated><author><name>alexgooi</name><uri>https://forge.codesys.com/u/alexgooi/</uri></author><id>https://forge.codesys.com6f76ddeba8db2d02b95a33549529f350a58e4188</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi DavidBo, &lt;/p&gt;
&lt;p&gt;In general Codesys is used to control equipment and an exception is the worst thing that can happen in your installation.&lt;/p&gt;
&lt;p&gt;If you cannot prevent the exception from triggering, you could implement a Try catch statement, with this solution your controller keeps on running and you are able to handle the exception. &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;__TRY&lt;/span&gt;
    &lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;This&lt;/span&gt; &lt;span class="n"&gt;statement&lt;/span&gt; &lt;span class="n"&gt;will&lt;/span&gt; &lt;span class="n"&gt;trigger&lt;/span&gt; &lt;span class="n"&gt;an&lt;/span&gt; &lt;span class="n"&gt;exception&lt;/span&gt;
    &lt;span class="n"&gt;Result&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;__CATCH&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;Handle&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;exception&lt;/span&gt;
    &lt;span class="n"&gt;HandleException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;strExceptionText&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;strExceptionText&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="n"&gt;From&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;Codesys&lt;/span&gt; &lt;span class="n"&gt;help&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;
    &lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;Create&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;log&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;
    &lt;span class="o"&gt;//--------------------------------------------------------&lt;/span&gt;
&lt;span class="n"&gt;__ENDTRY&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;What you also could to is implement implicit checks, these functions cover most of the exceptions (like dividing by zero)&lt;br/&gt;
See picture&lt;/p&gt;
&lt;p&gt;But in general avoid a complete controller shutdown!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Is it possible in the log to see previous shutdown</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/76808551b9/?limit=25#5835" rel="alternate"/><published>2024-02-08T11:27:53.935000Z</published><updated>2024-02-08T11:27:53.935000Z</updated><author><name>DavidBo</name><uri>https://forge.codesys.com/u/davidbo/</uri></author><id>https://forge.codesys.comde28b1b7d6720df0d25d6d3c15027e228d1c56a0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;If my application does some kind of violation which makes it cast an exception it will trigger my real watchdog which results in a reboot.&lt;br/&gt;
Unfortunately the log it seems only shows the boot sequence. Is it possible to see what happen before reboot?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>