# Logging Custom Event Errors

In this document, we'll walk through the process of creating a Web Page that allows users to submit custom errors that are then [logged as a Custom Event](../actions/log-custom-event-action) and flagged via an Email Notifier.&#x20;

The concepts covered in this document are relevant to the practicalities of using the [Log Custom Event Action](../actions/log-custom-event-action) as well as [publishing an app](../building-apps/publishing/publishing-your-application) so that errors that occur within it are not only logged but also submitted via Email Notifier. Similar concepts are covered in [Configuring App Error Notifications to Slack](integrating-error-notifications-to-slack), which discusses Slack Notifiers as opposed to Email Notifiers and Application Errors as opposed to Custom Event Errors.

## Build the app

This section assumes you have already created an app and are working on it within the Web Builder in the Airkit Studio. The UI described can stand on its own if connected to a link in Journey Builder, or it can be part of a larger application flow.

1. Create a new Web Page and call it "Submit Error Web Page":

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-bd37e883d8bd7274c9910d298b9945c9e03bb71c%2Flogging-custom-event-errors-v1715-0.png?alt=media)

2. Add [Text Area Input Box Web Control](../web-controls/text-area-web-control) to the "Submit Error Web Page". This is where users will submit their custom error messages. Note that, upon creation, the input is bound to the variable name **text\_area**. Leave this as it is:

![](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-e292e53852f817dfbf53b1a645f782b91a807144%2Flogging-custom-event-errors-v1715-1.png?alt=media)

3. Add a [Button Web Control](../web-controls/button-web-control) and change the associated text to "Submit Error":

![](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-a08b31e7d9593f5f5b6f7a65ab16a26bf46d1055%2Flogging-custom-event-errors-v1715-2.png?alt=media)

4. While still inspecting the "Submit Error" Button, open the **Actions** tab in the Inspector to open the Action Builder. Click on the '+' icon to the right of the **Clicked** branch and add a [Custom Log Event Action](../actions/log-custom-event-action).

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-4c371965c8c9dfc6c328f497d121732b7321af42%2Flogging-custom-event-errors-v1715-3.gif?alt=media)

5. Change the **Event Message** to "User submitted custom error", the **Log Level** to ERROR, and the **Metadata** to "User submitted the following message: \{{**text\_area**\}}". Note the presence of quotation marks to designate strings, and the presence of double brackets to designate variables within those strings; this is required to be Airscript-parsable, and both **Event Message** and **Metadata** expect information in the form of Airscript:

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-88f7c649876a3814f5696ba9e3bab70f1294a468%2Flogging-custom-event-errors-v1715-4.png?alt=media)

Upon completing the steps in this section, it is possible to publish this app as-is. The submitted error will be logged withthe other [Airkit Events](../studio/events); it can be accessed in the Console, under the Activity section.

## Set up Email Notifier

1. Save your changes, exit the Studio, and return to the Console. Access **Settings > Logs and Notifiers**.

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-32e3ceb6fb191f2014a5f3643b0e56f009c00c7f%2Flogging-custom-event-errors-v1715-5.png?alt=media)

2. Scroll down to the **Notifiers** section and click on the associated **Create new** button.

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-67a130be2f25c527bbb1976e5b3457690e5ae60f%2Flogging-custom-event-errors-v1715-6.png?alt=media)

3. Clicking on this button will open the Inspector, which will contain the tools to define the details of the new notifier being created. Name this new notifier "error\_email\_notification":

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-6ea008c968c852ac6de564f90876f8b7a8f19a85%2Flogging-custom-event-errors-v1715-7.png?alt=media)

4. Under **Destination**, select **Email:**

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-814948c0287035ca7e849e7f841e7cb7395e2f28%2Flogging-custom-event-errors-v1715-8.png?alt=media)

5. Once **Email** is selected under **Destination**, a new input box labeled **Email** will appear beneath it. Enter the email address that you want to send custom error notifications to. (You will need to check this email address to see related notifications, so make sure you enter an email address that you can easily access.)

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-76a32a89222f338dfeef5beaddc38502608b92d1%2Flogging-custom-event-errors-v1715-9.png?alt=media)

6. Click on the **Create** button on the bottom right.

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-6d9167f1f6ac870cf810b7b641417b01e4480c18%2Flogging-custom-event-errors-v1715-10.png?alt=media)

7. Once a notifier is set up, you can test it by inspecting it and clicking on the **Send Test** button at the bottom of the Inspector. If properly set up, a test email should appear in the inbox of the designated email account.

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-834c35e1ab2cc81ca55a60a0d23b143ee2f1be00%2Flogging-custom-event-errors-v1715-11.png?alt=media)

Upon completing the steps in this section, you have created an Email Notifier. All apps within your [Organization](../administration/airkit-organizations) will have access to this notifier. It can be used by any app to send errors of any kind. There are no limits to the number of errors types that can be associated with a single notifier.

## Publish Application

Most components of of Airkit apps can be tested by previewing them, but this is not the case with notifiers, because notifiers are set up as part of the [publishing](../building-apps/publishing/publishing-your-application) process. In order to confirm that an Email Notifier is properly sent when a Custom Event Error is logged, the following publishing procedure must be done first:

1. Return to accessing your App in the Airkit Studio and publish your application by clicking on the **Publish** button on the upper right. This will open the following window:

![](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-887f7561810708ecc69c47516d6014447f1cfb47%2Flogging-custom-event-errors-v1715-12.png?alt=media)

2. Expand the Notifications section:

![](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-36aa6f1c5a4b1302ff2263306ddb2299de5839e1%2Flogging-custom-event-errors-v1715-13.png?alt=media)

3. Under **Custom Log Error Event**, select **error\_email\_notification**.

![](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-e1270ecdd3ffcc69dd7ad1c72d186fdef798f99f%2Flogging-custom-event-errors-v1715-14.png?alt=media)

4. Click the _Publish_ button on the bottom left of the window.

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-9ce30943eb880668472764f2f6f745b4c745d4fd%2Flogging-custom-event-errors-v1715-15.png?alt=media)

Upon completing the steps in this section, the application will be published, and any error submitted through the **Log Custom Event Action** will not only be logged with other the other [Airkit Events](../studio/events), it will also be sent to the designated email address.

## Test it out!

1. Access the published application via the designated link. This will appear in the window that opens upon publication:

![](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-9aac804e70911297128120fe1e2e2d62b5f5cb83%2Flogging-custom-event-errors-v1715-16.png?alt=media)

It can also be found by inspecting the app in the Console:

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-9f4f94258510bcccb79b4d44a0853aba62546630%2Flogging-custom-event-errors-v1715-17.png?alt=media)

2. Enter some test information in the text box and press the "Submit Error" button:

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-50fc2e824e016b392456be4c565c3a9ef2be4e80%2Flogging-custom-event-errors-v1715-18.png?alt=media)

3. Check the relevant email inbox and look for the error message. Note how the message appears so that you can see the **Event Message** ("User submitted custom error") associated with the [Log Custom Event Action](../actions/log-custom-event-action), as well as the **Metadata** ("User submitted the following message: \{{**text\_area**\}}"), which contains the test information as **text\_area**.

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-722d5cc54e567c529e08734e0e5d62b1ec0f2ad3%2Flogging-custom-event-errors-v1715-19.png?alt=media)
