Custom Log Events

Hi All,

I’m trying to do a custom events logger.
Is there a way to “capture” every ( or most of ) event (pressing buttons, write stuff, etc… ) that occurs inside a window?
The best idea I have so far is to create a custom property (with a logging script when it changes ) on the window and then, every action (pressing buttons, write stuff, etc… ) will trigger the custom property.
Is there a better way?


Is the important part to capture when a tag is written? If that is the case look into using an Audit Profile.

As far as your specific question, I would imagine making a project level script that took some parameters such as the object name, object type, the user, the computer that caused the action, the time/date, and the event value. Then you just add a callout to that script on the propertyChange event of each object you want to capture on the window. My only concern would be trying to maintain a system like this as it would require adding a script to each object you want to track.

Hi Brandon,

I already checked the Audit Profile but I don’t like it :sweat_smile:. Also I’m doing it inside a .txt. and not with db.
I’ve done before the solution you have proposed, it works but as you said “trying to maintain a system like this as it would require adding a script to each object you want to track.” it’s a massacre.
I really appreciated your suggestion but it’s not what I’m looking for.

Gotcha. Well, the method you mentioned earlier might work. You would just have to figure out how to parse a propertyChange event that is happening on the root container. I would imagine that any property change; buttons pressed, value entered, etc would show up in some way on the propertyChange event of the root container. I have never looked into this though so I’m not 100% sure.

1 Like

Short answer: No.

Long answer: there’s no “choke” point where you could capture all such events. The best you could do would be to combine the audit log (for tag writes originating in objects that don’t need a script) with a shared or project script function to be called from every component event script. Or maybe implement some kind of hierarchy search for a window that finds all the existing jython event scripts and adds an extra listener object to capture those events. You can’t just “listen” to a whole window, as Swing’s events rise in the object hierarchy only to the point where they are consumed (by an event script or internal listener).

1 Like

I would create a new alarm Journal and log it into a separate database and bind a memory tag to every component you want to log. Enable each memory tag alarm with diagnostic level and make the ack method unused, so it doesn’t show up on your main alarm status table (you can set the minimum level on the main alarm table above diag level so these don’t show up). This only works when diagnostic level is not used anywhere else on your normal alarm status and journal. This way you can customize the heck out of the messages and anything you want.