# Logging

### **Setting log level**

Use the parameter **`log-file-level`** to configure the amount of data logged in the Gateway log file, and use **`log-level`** to configure the amount of data logged to standard output.

The Gateway’s common log levels and the possible values for these two flags are listed below in order from most verbose (TRACE) to least verbose (ERROR). The default log level is INFO.

```
TRACE, DEBUG, INFO, WARN, ERROR
```

#### **Accessing the log files**

The log files can be found in the **`logs`** directory of the Docker container (as specified with the Docker command or the startup script). The most recent log file is named `gateway-[external port of gateway].log`.&#x20;

Older log files are named `gateway-[external port of gateway]-[end timestamp].log`**.**

### **Analyzing transaction receipt**&#x20;

Your Local Gateway includes a logging utility that helps you analyze when the gateway received important transactions and the source of such transactions. &#x20;

For each transaction received, the utility records the time the transaction is first received by the gateway and the source from which the gateway received it. To enable this utility, add the parameter `txtrace` to your startup argument when you start the gateway.

{% tabs %}
{% tab title="Docker Argument" %}

```bash
docker run --name bxgateway-go -d \
  -v <LOG_FILE_PATH>:/app/bloxroute/logs \
  -v <SSL_CERT_PATH>:/app/bloxroute/ssl \
  -p 1801:1801 -p 28333:28333 bloxroute/bloxroute-gateway-go \ 
  --blockchain-network <Mainnet, or BSC-Mainnet> \
  --ws --port 1801 \ 
  --txtrace \
  --enodes enode://<BLOCKCHAIN_NODE_PUBLIC_KEY>@<NODE_IP>:<NODE_PORT>
  
```

{% endtab %}
{% endtabs %}

#### **Log format and size**

Each `txtrace` entry is logged in the following format:

`time="[Time Tx Received]" level=trace msg="[Tx Hash] - [Blockchain or BDN] [Source IP]"`

The `txtrace` utility has additional parameters that allow you to control the size of the log file:&#x20;

<table><thead><tr><th>Gateway Parameter</th><th width="351.3333333333333">Description</th><th>Value</th></tr></thead><tbody><tr><td><strong><code>txtrace-max-file-size</code></strong></td><td>Sets max size (megabytes) of individual log files</td><td>integer <br><em>[Default: 100]</em></td></tr><tr><td><strong><code>txtrace-max-files</code></strong></td><td>Sets max number of log files stored</td><td>integer <br><em>[Default: 3]</em></td></tr></tbody></table>

#### **Accessing `txtrace` log files**

Similar to other logs, the `txtrace` log files are also located in the **`logs`** directory.&#x20;

The most recent file is named `txtrace-gateway-[external port of gateway].log`. &#x20;

Older `txtrace` log files are named `txtrace-gateway-[external port of gateway]-[end timestamp].log`**.**

{% hint style="info" %}
The txtrace log is not a substitute for the Tx-Trace service which allows traders to gain insight on transaction propagation by the BDN.&#x20;

More information about this service, can be found [here](https://docs.bloxroute.com/eth/sending-transactions/tx-trace).
{% endhint %}
