Difference between revisions of "WCmore's LogAndTrace"
m |
m (→Customizable Logs) |
||
(33 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Introduction to Logs == | == 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 at the bottom of each piston. | + | 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. |
− | [[File: | + | [[File:LogLevel3.jpg|none]] |
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)'' | 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)'' | ||
+ | |||
Line 12: | Line 13: | ||
== Introduction to Trace == | == Introduction to Trace == | ||
− | On simple problems, changing the Log level might | + | 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)'' |
[[File:Buttons Trace.jpg|none]] | [[File:Buttons Trace.jpg|none]] | ||
Line 18: | Line 19: | ||
---- | ---- | ||
− | === | + | === Where's the Button? === |
Sometimes on a new piston, you will not see the "Trace" button: | Sometimes on a new piston, you will not see the "Trace" button: | ||
Line 25: | Line 26: | ||
In those cases, press "Test" first, and then you will be able to turn on "Trace". | In those cases, press "Test" first, and then you will be able to turn on "Trace". | ||
+ | |||
Line 31: | Line 33: | ||
== Summary == | == 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 | + | 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)'' |
− | [[File: | + | [[File:TraceAndLog2.jpg|none]] |
This makes is easy to follow along, line by line, and see right away what line of code caused an error. | This makes is easy to follow along, line by line, and see right away what line of code caused an error. | ||
+ | |||
Line 48: | Line 51: | ||
* Turn on Trace | * Turn on Trace | ||
* Set Logging Level to Full | * Set Logging Level to Full | ||
− | * Clear Log (Crucial Step!) | + | * Clear Log ''(Crucial Step!)'' |
− | + | Test piston using the normal trigger [[File:Trigger.jpg|left]] | |
− | * Wait | + | * Wait 10+ seconds after the piston completes all of it's tasks |
− | * Copy the log | + | * Copy the log to your clipboard |
− | * Post a | + | * 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. | What this does is give the experts all the information, without a bunch of clutter to wade through. | ||
Line 59: | Line 62: | ||
− | == | + | |
+ | == 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. | * 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, ( | + | * 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 | * 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 [[WCmore's_LogAndTrace#Summary|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". | ||
+ | |||
+ | [[File:LogType.jpg|none]] | ||
+ | |||
+ | Depending on which type you choose, it only affects the color of that specific line... as seen below: | ||
+ | |||
+ | [[File:WC LogColors.jpg|none]] | ||
+ | |||
+ | 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: | ||
+ | |||
+ | [[File:LogAdvanceColors.png|none]] | ||
+ | |||
+ | ... returns the following log: | ||
+ | |||
+ | [[File:LogAdvanceColors2.png|none]] | ||
+ | |||
+ | Dark colors look best... (unless you are using a custom CSS) | ||
{{WCmoreTOC}} | {{WCmoreTOC}} |
Latest revision as of 04:52, 11 September 2020
Contents
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.
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)
Where's the Button?
Sometimes on a new piston, you will not see the "Trace" button:
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)
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!)
- 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".
Depending on which type you choose, it only affects the color of that specific line... as seen below:
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:
... returns the following log:
Dark colors look best... (unless you are using a custom CSS)
▲ WCmore's Tips - Table of Contents ▲ |
.