WCmore's LogAndTrace

From webCoRE Wiki - Web-enabled Community's own Rule Engine
Revision as of 04:52, 11 September 2020 by WCmore (talk | contribs) (Customizable Logs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Share on FacebookShare on TwitterShare on Google+Share on LinkedInShare on DiggShare on deliciousShare on redditShare on StumbleUpon

Introduction to Logs

When we need to troubleshoot a piston's logic, it often helps to see what is happening "behind-the-scenes"... Usually the first step is to turn the Logging Level to "Full" for that piston. (each piston's logs are independent of each other) You will find this option in a drop-down menu at the bottom of each piston.

LogLevel3.jpg

Once Logging Level is set to Full, then all activity in that piston will be recorded down below that piston. (most recent events at the top) Once the Log runs out of room, the old data is automatically deleted off the bottom, to make room for the new data at the top. (the smaller the piston, the more available room for the log)



Introduction to Trace

On simple problems, simply changing the Log level might give enough information to diagnose... But with a complex piston or log, I will rarely even look at a log unless "Trace" is also turned on. This button can be found on every piston's main page. (not while editing)

Buttons Trace.jpg

Where's the Button?

Sometimes on a new piston, you will not see the "Trace" button:

Buttons NoTrace.jpg

In those cases, press "Test" first, and then you will be able to turn on "Trace".



Summary

Once "Trace" is turned on, you will notice extra numbers in your green snapshot that aligns with the Condition #'s in your log. (As highlighted below)

TraceAndLog2.jpg

This makes is easy to follow along, line by line, and see right away what line of code caused an error.



Personal Thoughts

Sometimes, the log can get crazy long. It is MUCH easier to troubleshoot when only the relevant log is posted to the forums.

What I always recommend is:

  • Turn on Trace
  • Set Logging Level to Full
  • Clear Log (Crucial Step!)
Test piston using the normal trigger
Trigger.jpg
  • Wait 10+ seconds after the piston completes all of it's tasks
  • Copy the log to your clipboard
  • Post a green snapshot and paste the matching log (bonus points if you preformat by selecting the log and pressing Ctrl-Shift-C)

What this does is give the experts all the information, without a bunch of clutter to wade through.



Pro Tips

  • Do not ever Edit a piston, and then post a log. We need to see the piston in the same state as when the log was written.
  • On that note, if you edit a piston, you may as well Clear your logs, and run your test again. (the old logs no longer apply)
  • Once a piston has been rock solid reliable for awhile, I often reduce Logging level to Minimum or None
  • If Logging Level is None, then editing/saving a piston will automatically clear the logs.
  • If Logging Level is anything except None, then editing/saving a piston will preserve the logs.
  • If your piston is massive, and saving is difficult due to lack of space, sometimes turning the Logs to None & pressing Clear can help.



Customizable Logs

  • You can manually add nearly anything to the log, as seen on line 22 above. (Manual logs will always appear, even if Logging Level is set to None)

The command appears as "Log to console", and you can select one of five log "Types".

LogType.jpg

Depending on which type you choose, it only affects the color of that specific line... as seen below:

WC LogColors.jpg

This can be helpful to make certain events stand out in the logs...


If you are willing to write a bit of extra code, then nearly any color can be achieved. For example, this snippet of code:

LogAdvanceColors.png

... returns the following log:

LogAdvanceColors2.png

Dark colors look best... (unless you are using a custom CSS)



WCmore's Tips - Table of Contents











.