You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/advanced-setup.md
+200-15
Original file line number
Diff line number
Diff line change
@@ -188,30 +188,111 @@ as the watchdog.
188
188
189
189
## Advanced Logging
190
190
191
-
On many Linux systems the bot can be configured to send its log messages to `syslog` or `journald` system services. Logging to a remote `syslog` server is also available on Windows. The special values for the `--logfile` command line option can be used for this.
191
+
Freqtrade uses the default logging module provided by python.
192
+
Python allows for extensive [logging configuration](https://docs.python.org/3/library/logging.config.html#logging.config.dictConfig) in this regards - way more than what can be covered here.
193
+
194
+
Default logging (Colored terminal output) is setup by default if no `log_config` is provided.
195
+
Using `--logfile logfile.log` will enable the RotatingFileHandler.
196
+
If you're not content with the log format - or with the default settings provided for the RotatingFileHandler, you can customize logging to your liking.
197
+
198
+
The default configuration looks roughly like the below - with the file handler being provided - but not enabled.
Highlighted lines in the above code-block define the Rich handler and belong together.
238
+
The formatter "standard" and "file" will belong to the FileHandler.
194
239
195
-
To send Freqtrade log messages to a local or remote `syslog` service use the `--logfile` command line option with the value in the following format:
240
+
Each handler must use one of the defined formatters (by name) - and it's class must be available and a valid logging class.
241
+
To actually use a handler - it must be in the "handlers" section inside the "root" segment.
242
+
If this section is left out, freqtrade will provide no output (in the non-configured handler, anyway).
196
243
197
-
* `--logfile syslog:<syslog_address>` -- send log messages to `syslog` service using the `<syslog_address>` as the syslog address.
244
+
!!! Tip "Explicit log configuration"
245
+
We recommend to extract the logging configuration from your main configuration, and provide it to your bot via [multiple configuration files](configuration.md#multiple-configuration-files) functionality. This will avoid unnecessary code duplication.
198
246
199
-
The syslog address can be either a Unix domain socket (socket filename) or a UDP socket specification, consisting of IP address and UDP port, separated by the `:` character.
247
+
---
248
+
249
+
On many Linux systems the bot can be configured to send its log messages to `syslog` or `journald` system services. Logging to a remote `syslog` server is also available on Windows. The special values for the `--logfile` command line option can be used for this.
200
250
201
-
So, the following are the examples of possible usages:
251
+
### Logging to syslog
252
+
253
+
To send Freqtrade log messages to a local or remote `syslog` service use the `"log_config"` setup option to configure logging.
// Use one of the other options above as address instead?
271
+
"address": "/dev/log"
272
+
}
273
+
},
274
+
"root": {
275
+
"handlers": [
276
+
// other handlers
277
+
"syslog",
278
+
279
+
]
280
+
}
281
+
282
+
}
283
+
}
284
+
```
285
+
286
+
[Additional log-handlers](#advanced-logging) may need to be configured to for example also have log output in the console.
202
287
203
-
* `--logfile syslog:/dev/log` -- log to syslog (rsyslog) using the `/dev/log` socket, suitable for most systems.
204
-
* `--logfile syslog` -- same as above, the shortcut for `/dev/log`.
205
-
* `--logfile syslog:/var/run/syslog` -- log to syslog (rsyslog) using the `/var/run/syslog` socket. Use this on MacOS.
206
-
* `--logfile syslog:localhost:514` -- log to local syslog using UDP socket, if it listens on port 514.
207
-
* `--logfile syslog:<ip>:514` -- log to remote syslog at IP address and port 514. This may be used on Windows for remote logging to an external syslog server.
288
+
#### Syslog usage
208
289
209
290
Log messages are send to `syslog` with the `user` facility. So you can see them with the following commands:
210
291
211
-
* `tail -f /var/log/user`, or
292
+
* `tail -f /var/log/user`, or
212
293
* install a comprehensive graphical viewer (for instance, 'Log File Viewer' for Ubuntu).
213
294
214
-
On many systems `syslog` (`rsyslog`) fetches data from `journald` (and vice versa), so both `--logfile syslog` or `--logfile journald` can be used and the messages be viewed with both `journalctl` and a syslog viewer utility. You can combine this in any way which suites you better.
295
+
On many systems `syslog` (`rsyslog`) fetches data from `journald` (and vice versa), so both syslog or journald can be used and the messages be viewed with both `journalctl` and a syslog viewer utility. You can combine this in any way which suites you better.
215
296
216
297
For `rsyslog` the messages from the bot can be redirected into a separate dedicated log file. To achieve this, add
217
298
@@ -228,13 +309,69 @@ For `syslog` (`rsyslog`), the reduction mode can be switched on. This will reduc
228
309
$RepeatedMsgReduction on
229
310
```
230
311
312
+
#### Syslog addressing
313
+
314
+
The syslog address can be either a Unix domain socket (socket filename) or a UDP socket specification, consisting of IP address and UDP port, separated by the `:` character.
315
+
316
+
317
+
So, the following are the examples of possible addresses:
318
+
319
+
* `"address": "/dev/log"` -- log to syslog (rsyslog) using the `/dev/log` socket, suitable for most systems.
320
+
* `"address": "/var/run/syslog"` -- log to syslog (rsyslog) using the `/var/run/syslog` socket. Use this on MacOS.
321
+
* `"address": "localhost:514"` -- log to local syslog using UDP socket, if it listens on port 514.
322
+
* `"address": "<ip>:514"` -- log to remote syslog at IP address and port 514. This may be used on Windows for remote logging to an external syslog server.
323
+
324
+
325
+
??? Info "Deprecated - configure syslog via command line"
326
+
327
+
`--logfile syslog:<syslog_address>` -- send log messages to `syslog` service using the `<syslog_address>` as the syslog address.
328
+
329
+
The syslog address can be either a Unix domain socket (socket filename) or a UDP socket specification, consisting of IP address and UDP port, separated by the `:` character.
330
+
331
+
So, the following are the examples of possible usages:
332
+
333
+
* `--logfile syslog:/dev/log` -- log to syslog (rsyslog) using the `/dev/log` socket, suitable for most systems.
334
+
* `--logfile syslog` -- same as above, the shortcut for `/dev/log`.
335
+
* `--logfile syslog:/var/run/syslog` -- log to syslog (rsyslog) using the `/var/run/syslog` socket. Use this on MacOS.
336
+
* `--logfile syslog:localhost:514` -- log to local syslog using UDP socket, if it listens on port 514.
337
+
* `--logfile syslog:<ip>:514` -- log to remote syslog at IP address and port 514. This may be used on Windows for remote logging to an external syslog server.
338
+
231
339
### Logging to journald
232
340
233
341
This needs the `cysystemd` python package installed as dependency (`pip install cysystemd`), which is not available on Windows. Hence, the whole journald logging functionality is not available for a bot running on Windows.
234
342
235
-
To send Freqtrade log messages to `journald` system service use the `--logfile` command line option with the value in the following format:
343
+
To send Freqtrade log messages to `journald` system service, add the following configuration snippet to your configuration.
* `--logfile journald` -- send log messages to `journald`.
374
+
[Additional log-handlers](#advanced-logging) may need to be configured to for example also have log output in the console.
238
375
239
376
Log messages are send to `journald` with the `user` facility. So you can see them with the following commands:
240
377
@@ -244,3 +381,51 @@ Log messages are send to `journald` with the `user` facility. So you can see the
244
381
There are many other options in the `journalctl` utility to filter the messages, see manual pages for this utility.
245
382
246
383
On many systems `syslog` (`rsyslog`) fetches data from `journald` (and vice versa), so both `--logfile syslog` or `--logfile journald` can be used and the messages be viewed with both `journalctl` and a syslog viewer utility. You can combine this in any way which suites you better.
384
+
385
+
??? Info "Deprecated - configure journald via command line"
386
+
To send Freqtrade log messages to `journald` system service use the `--logfile` command line option with the value in the following format:
387
+
388
+
`--logfile journald` -- send log messages to `journald`.
389
+
390
+
### Log format as JSON
391
+
392
+
You can also configure the default output stream to use JSON format instead.
393
+
The "fmt_dict" attribute defines the keys for the json output - as well as the [python logging LogRecord attributes](https://docs.python.org/3/library/logging.html#logrecord-attributes).
394
+
395
+
The below configuration will change the default output to JSON. The same formatter could however also be used in combination with the `RotatingFileHandler`.
396
+
We recommend to keep one format in human readable form.
Copy file name to clipboardexpand all lines: docs/configuration.md
+1
Original file line number
Diff line number
Diff line change
@@ -282,6 +282,7 @@ Mandatory parameters are marked as **Required**, which means that they are requi
282
282
| `dataformat_ohlcv` | Data format to use to store historical candle (OHLCV) data. <br> *Defaults to `feather`*. <br> **Datatype:** String
283
283
| `dataformat_trades` | Data format to use to store historical trades data. <br> *Defaults to `feather`*. <br> **Datatype:** String
284
284
| `reduce_df_footprint` | Recast all numeric columns to float32/int32, with the objective of reducing ram/disk usage (and decreasing train/inference timing in FreqAI). (Currently only affects FreqAI use-cases) <br> **Datatype:** Boolean. <br> Default: `False`.
285
+
| `log_config` | Dictionary containing the log config for python logging. [more info](advanced-setup.md#advanced-logging) <br> **Datatype:** dict. <br> Default: `FtRichHandler`
Copy file name to clipboardexpand all lines: docs/deprecated.md
+5
Original file line number
Diff line number
Diff line change
@@ -88,3 +88,8 @@ Setting protections from the configuration via `"protections": [],` has been rem
88
88
Using hdf5 as data storage has been deprecated in 2024.12 and was removed in 2025.1. We recommend switching to the feather data format.
89
89
90
90
Please use the [`convert-data` subcommand](data-download.md#sub-command-convert-data) to convert your existing data to one of the supported formats before updating.
91
+
92
+
## Configuring advanced logging via config
93
+
94
+
Configuring syslog and journald via `--logfile systemd` and `--logfile journald` respectively has been deprecated in 2025.3.
95
+
Please use configuration based [log setup](advanced-setup.md#advanced-logging) instead.
0 commit comments