# Logging

{% hint style="info" %}
PDI is configured to provide helpful log messages to help provide understanding in how a job or transformation is running. Logging can be configured to provide minimal logging information, just to know whether a job or transformation failed or was successful, or detailed in providing errors or w arnings such as network issues or mis-configurations.

• **Nothing:** Don't show any output

• **Error**: Only show errors

• **Minimal**: Only use minimal logging

• **Basic**: This is the default basic logging level

• **Detailed**: Give detailed logging output

• **Debug**: For debugging purposes, very detailed output.

• **Row level**: Logging at a row level, this can generate a lot of data.

When executing a job or transformation from within the Spoon development environment, a "Logging" tab is available, showing any log messages that have been generated. Any error messages are shown with red text, to easily identify the cause of any errors in the file.
{% endhint %}

{% hint style="info" %}
In this guided demonstration, you will:

• Create Logging Database Tables in PostgreSQL hibernate database.

• Configure kettle.properties file for logging

• Examine Logging tables
{% endhint %}

{% tabs %}
{% tab title="1. Logging Tables" %}
{% hint style="info" %}
For this demonstration, you will require pgAdmin 4 (or any database management tool) to create the required schema and database tables in PostgreSQL.
{% endhint %}

{% hint style="warning" %}
Ensure that the Pentaho server is up and running ..!
{% endhint %}

1. Create a connection to the hibernate database:

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-bc038b7343a502babee31b3632b7bd5cd03959c1%2Fhibernate%20DB%20connection.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

<table data-header-hidden><thead><tr><th width="206"></th><th></th></tr></thead><tbody><tr><td>Username</td><td>hibuser</td></tr><tr><td>Password</td><td>password</td></tr></tbody></table>

2. Test the connection.
3. Expand the hibernate database -> Schemas -> pentaho\_dilogs -> Tables:

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-fdeb6412f6ce2ad04bd9303132141e6598e14d06%2Fpentaho%20dilogs.png?alt=media" alt="" width="375"><figcaption><p>pentaho_dilogs</p></figcaption></figure>

{% hint style="success" %}
The script has already been executed and the logging tables created ..

The scripts for the supported databases are located at:

/home/pentaho/Pentaho/server/pentaho-server/\[database folder]
{% endhint %}
{% endtab %}

{% tab title="2. kettle.properties" %}
{% hint style="info" %}
To enable logging you will need to edit the kettle.properties file to include the 'logging ' variables.
{% endhint %}

1. Open the kettle.properies file in a text editor.

```bash
cd
cd ~/.kettle
sudo nano kettle.properties
```

{% hint style="info" %}
There are 3 properties to set (added in PDI 10+):

• name of table

• name of database connection

• name of database schema
{% endhint %}

```properties
KETTLE_CHANNEL_LOG_TABLE=channel_logs
KETTLE_CHANNEL_LOG_DB=live_logging_info
KETTLE_CHANNEL_LOG_SCHEMA=pentaho_dilogs

KETTLE_METRICS_LOG_TABLE=metrics_logs
KETTLE_METRICS_LOG_DB=live_logging_info
KETTLE_METRICS_LOG_SCHEMA=pentaho_dilogs

KETTLE_TRANS_LOG_TABLE=trans_logs
KETTLE_TRANS_LOG_DB=live_logging_info
KETTLE_TRANS_LOG_SCHEMA=pentaho_dilogs

KETTLE_JOBENTRY_LOG_TABLE=jobentry_logs
KETTLE_JOBENTRY_LOG_DB=live_logging_info
KETTLE_JOBENTRY_LOG_SCHEMA=pentaho_dilogs

KETTLE_JOB_LOG_TABLE=job_logs
KETTLE_JOB_LOG_DB=live_logging_info
KETTLE_JOB_LOG_SCHEMA=pentaho_dilogs

KETTLE_STEP_LOG_TABLE=step_logs
KETTLE_STEP_LOG_DB=live_logging_info
KETTLE_STEP_LOG_SCHEMA=pentaho_dilogs

KETTLE_TRANS_PERFORMANCE_LOG_TABLE=transperf_logs
KETTLE_TRANS_PERFORMANCE_LOG_DB=live_logging_info
KETTLE_TRANS_PERFORMANCE_LOG_SCHEMA=pentaho_dilogs
```

2. Save and reboot.

{% hint style="warning" %}
No need to reboot if you're using Pentaho 10.0 +. The logging variables have already been added to the kettle.prperties file.
{% endhint %}
{% endtab %}

{% tab title="3. RUN" %}
{% hint style="info" %}
Ensure you have the Pentaho server up and running ..!!

This demonstration just gets you up and running with logging your Jobs and transformations to a bunch of loging tables. Its tricky to get any useful info out of these tables without resorting to some complex SQL querries.

Luckily .. Pentaho came up with Operations Mart. This is a centralized data mart that enables you to query the tables and display the info in dashboards as charts and reports.
{% endhint %}

1. In PDI open the tr\_hello\_world.ktr

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-8e46b3cc855e09d2da2fcb9c438b7dc4028def1c%2Fhello%20world.png?alt=media" alt="" width="476"><figcaption><p>hello_world.ktr</p></figcaption></figure>

{% hint style="info" %}
Now we need to define a connection to the Pentaho Repository.
{% endhint %}

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-2da0b435000e872ec4a4d616e554cb88b3b80016%2Fconnect.png?alt=media" alt="" width="391"><figcaption></figcaption></figure>

2. Click on the 'Connect'button located in the top right corner.
3. Click on Add.
4. Select Pentaho Repository (Recommended)

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-a8c548cc637f645325dbb55265394502c69a8858%2Frepository%20options.png?alt=media" alt="" width="215"><figcaption><p>Repository options</p></figcaption></figure>

5. Enter the following details.

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-e28bb6e8410bdf2f67c5cac17c9ef9f06db77874%2FRepo%20manager.png?alt=media" alt="" width="375"><figcaption><p>Repository Manager</p></figcaption></figure>

6. Save and Close
7. Connect to: 'Pentaho' Repository with the following credentials:

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-2868e42a31507a14d7f0ff769b36247b72760536%2FRepo%20credentials.png?alt=media" alt="" width="375"><figcaption><p>Login to Pentaho Repository</p></figcaption></figure>

8. Once connected, don't close open transformation.
9. Save the tr\_hello\_world.ktr to Public -> folder. You will need to create the folder.

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-ed44f94facc639aa14db44b36c054b75c59491c8%2FSave%20to%20Repo.png?alt=media" alt=""><figcaption><p>Save to Pentaho Repository</p></figcaption></figure>

10. Execute the transformation.
11. In DBeaver: open and view the data in the trans\_log table.

<figure><img src="https://3680356391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZpCSy6Skj215f4oWypdc%2Fuploads%2Fgit-blob-5a0441d9a48a004cd6672fc734829738fe778278%2FView%20trans%20data.png?alt=media" alt=""><figcaption><p>View trans_log</p></figcaption></figure>
{% endtab %}
{% endtabs %}
