Skip to content

Commit 51ae81b

Browse files
authored
chore(users): update flags for logging (#948)
As per syncthing/syncthing#10220
1 parent a988359 commit 51ae81b

File tree

3 files changed

+41
-87
lines changed

3 files changed

+41
-87
lines changed

dev/debugging.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,11 @@ quite silent about it. A number of environment variables can be used to
88
set the logging to verbose for various parts of the program, and to
99
enable profiling.
1010

11-
Enabling any of the STTRACE facilities will also change the log format to
12-
include microsecond timestamps and file names plus line numbers. This
13-
can be used to enable this extra information on the normal logging
14-
level, without enabling any debugging: ``STTRACE=somethingnonexistent``
15-
for example.
16-
1711
Under Unix (including Mac) the easiest way to run Syncthing with an
1812
environment variable set is to prepend the variable to the command line.
1913
I.e:
2014

21-
``$ STTRACE=model syncthing``
15+
``$ STTRACE=model,syncthing``
2216

2317
On windows, it needs to be set prior to running Syncthing.
2418

includes/env-vars.rst

Lines changed: 33 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,37 @@
11
STTRACE
2-
Used to increase the debugging verbosity in specific or all facilities,
3-
generally mapping to a Go package. Enabling any of these also enables
4-
microsecond timestamps, file names plus line numbers. Enter a
5-
comma-separated string of facilities to trace. ``syncthing --help`` always
6-
outputs an up-to-date list. The valid facility strings are:
7-
8-
Main and operational facilities:
9-
config
10-
Configuration loading and saving.
11-
main
12-
Main package.
13-
model
14-
The root hub; the largest chunk of the system. File pulling, index
15-
transmission and requests for chunks.
16-
scanner
17-
File change detection and hashing.
18-
versioner
19-
File versioning.
20-
21-
Networking facilities:
22-
beacon
23-
Multicast and broadcast UDP discovery packets: Selected interfaces
24-
and addresses.
25-
connections
26-
Connection handling.
27-
dialer
28-
Dialing connections.
29-
discover
30-
Remote device discovery requests, replies and registration of
31-
devices.
32-
nat
33-
NAT discovery and port mapping.
34-
pmp
35-
NAT-PMP discovery and port mapping.
36-
protocol
37-
The BEP protocol.
38-
relay
39-
Relay interaction (``strelaysrv``).
40-
upnp
41-
UPnP discovery and port mapping.
42-
43-
Other facilities:
44-
fs
45-
Filesystem access.
46-
events
47-
Event generation and logging.
48-
http
49-
REST API.
50-
sha256
51-
SHA256 hashing package (this facility currently unused).
52-
sqlite
53-
The SQLite database
54-
stats
55-
Persistent device and folder statistics.
56-
sync
57-
Mutexes. Used for debugging race conditions and deadlocks.
58-
upgrade
59-
Binary upgrades.
60-
walkfs
61-
Filesystem access while walking.
62-
63-
all
64-
All of the above.
2+
Used to increase the debugging verbosity in specific facilities,
3+
generally mapping to a Go package. Enter a comma-separated string of
4+
facilities to trace: ``api,beacon``. Optionally, a log level can be
5+
given per facility to specify something other than DEBUG:
6+
``api:WARN,beacon:ERR``, potentially overriding a global ``--log-level``
7+
adjustment.
8+
9+
The valid facility strings are listed below; additionally, ``syncthing
10+
serve --help`` always outputs the most up-to-date list.
11+
12+
api - REST API
13+
beacon - Multicast and broadcast discovery
14+
config - Configuration loading and saving
15+
connections - Connection handling
16+
db/sqlite - SQLite database
17+
dialer - Dialing connections
18+
discover - Remote device discovery
19+
events - Event generation and logging
20+
fs - Filesystem access
21+
main - Main package
22+
model - The root hub
23+
nat - NAT discovery and port mapping
24+
pmp - NAT-PMP discovery and port mapping
25+
protocol - The BEP protocol
26+
relay/client - Relay client
27+
scanner - File change detection and hashing
28+
stun - STUN functionality
29+
syncthing - Main run facility
30+
upgrade - Binary upgrades
31+
upnp - UPnP discovery and port mapping
32+
ur - Usage reporting
33+
versioner - File versioning
34+
watchaggregator - Filesystem event watcher
6535

6636
STLOCKTHRESHOLD
6737
Used for debugging internal deadlocks; sets debug sensitivity. Use only

users/syncthing.rst

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Synopsis
1515
[--db-maintenance-interval=<interval>]
1616
[--db-delete-retention-interval=<interval>]
1717
[--gui-address=<address>] [--gui-apikey=<key>]
18-
[--logfile=<filename>] [--logflags=<flags>]
18+
[--log-level=<level>] [--log-file=<filename>]
1919
[--log-max-old-files=<num>] [--log-max-size=<num>]
2020
[--no-browser] [--no-console]
2121
[--no-port-probing] [--no-restart] [--no-upgrade]
@@ -149,25 +149,15 @@ Serve options
149149

150150
Override the API key needed to access the GUI / REST API.
151151

152-
.. cmdoption:: --logfile=<filename>
152+
.. cmdoption:: --log-level=<level>
153153

154-
Set destination filename for logging (use ``"-"`` for stdout, which is the
155-
default option).
156-
157-
.. cmdoption:: --logflags=<flags>
154+
Set the log level for all packages. Valid levels are DEBUG, INFO, WARN,
155+
and ERROR.
158156

159-
Select information in log line prefix. The ``--logflags`` value is a sum of
160-
the following:
157+
.. cmdoption:: --log-file=<filename>
161158

162-
- 1: Date
163-
- 2: Time
164-
- 4: Microsecond time
165-
- 8: Long filename
166-
- 16: Short filename
167-
168-
To prefix each log line with date and time, set ``--logflags=3`` (1 + 2 from
169-
above). The value 0 is used to disable all of the above. The default is to
170-
show time only (2).
159+
Set destination filename for logging (use ``"-"`` for stdout, which is the
160+
default option).
171161

172162
.. cmdoption:: --log-max-old-files=<num>
173163

0 commit comments

Comments
 (0)