# Logging Messages to aid debugging

**URL:** <https://forum.inductiveautomation.com/t/logging-messages-to-aid-debugging/7460>\
**Category:** Ignition\
**Created:** [October 24, 2013, 3:41pm UTC](https://forum.inductiveautomation.com/t/logging-messages-to-aid-debugging/7460 "2013-10-24T15:41:38Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [October 25, 2013, 12:14pm UTC](https://forum.inductiveautomation.com/t/logging-messages-to-aid-debugging/7460/4 "2013-10-25T12:14:45Z")

</div>

You could write directly to a database table when you wanted to log something. This would work in all contexts:

```auto
message = "My latest log message"
severity = "info"
system.db.runPrepUpdate("INSERT INTO logging (Message,Severity) VALUES (?,?)",[message,info])
```

Probably best to write a function that wraps the database insert so you could just pass the message and severity to the function as arguments.

The only downside to this method is that in the client it takes a bit of time to run a database query due to network overhead but this is handled easily by wrapping the query with system.util.invokeAsynchronous, but you only need this if you need/want the client to be very quick.

Nick

---

_[View the full topic](https://forum.inductiveautomation.com/t/logging-messages-to-aid-debugging/7460)._
