Trigger and journal both can be use to log details but my question is what is the difference between these two and which method is good for log.
Announcement
Collapse
No announcement yet.
Trigger vs journal
Collapse
X
-
This is sort of like asking "Should I watch the Weather Channel or install a window in my house?" I suppose they could serve the same purpose in some cases, but they're not really the same thing.
A journal keeps track of every detail of everything that happens, and it's all done for you.
A trigger lets you write code that happens when an insert/update/delete (or even read) is made. What that code does is entirely up to you.
So just as the Weather Channel has tons of historical data, trends, accurate measurements from lots of different places, and detailed analysis of the weather, so also does a journal have tons of information. But this may be "information overload" if all you want to know is "who changed the price for order 1234?" On the other hand, the trigger won't do anything at all by itself. Much like a window doesn't tell you the weather, it's up to you to look out and analyze what you see... you'd have to write a program that logs whatever data you want to log, you'd have to debug it and make sure the code is perfect and doesn't ever fail to log what is needed. But, it has the advantage that the log can do exactly what you want -- so if you just want to know one simple piece of information, you can code it to only show that one piece of information, making the log much simpler to read. And, of course, triggers aren't limited to logging, they can do anything...
Does that help?
- Likes 1
Comment
Comment