Skip to content

Commit 7be94c3

Browse files
authored
Merge pull request #2574 from sopel-irc/faq-logs
docs: FAQ entry on logging + some minor clarification
2 parents 7693af3 + f48273b commit 7be94c3

File tree

3 files changed

+77
-11
lines changed

3 files changed

+77
-11
lines changed

docs/source/faq.rst

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ We talk about the bot's development, and we answer questions from bot owners &
1616
plugin authors as much as we can. We try to keep it as friendly as possible;
1717
sometimes we also just chat about about non-development topics.
1818

19+
If you're coming to IRC with a question, you can often help us help you faster
20+
by :ref:`having your logs ready <faq-logging>`.
21+
1922
All conversations are in English (except when someone swears in French).
2023

2124
.. __: https://libera.chat/guides/connect
@@ -31,10 +34,72 @@ configured some templates to help and guide you through the process and
3134
hopefully to make it easier for you.
3235

3336
Before submitting your bug, you can `search existing issues`__ to see if there
34-
is one open already.
37+
is one open already. If no existing issue covers your bug, please :ref:`have log
38+
excerpts ready <faq-logging>` that demonstrate the problem, if possible.
3539

36-
Do not hesitate to :ref:`contact us<faq-contact-us>` if you are unsure about
40+
Do not hesitate to :ref:`contact us <faq-contact-us>` if you are unsure about
3741
your bug report.
3842

3943
.. __: https://github.com/sopel-irc/sopel/issues/new/choose
4044
.. __: https://github.com/sopel-irc/sopel/issues
45+
46+
47+
.. _faq-logging:
48+
49+
How to obtain logs?
50+
===================
51+
52+
When requesting help, you'll probably be asked to provide logs illustrating the
53+
problem. If you :ref:`report a bug <faq-bug-report>`, the form includes a field
54+
for "Relevant logs" that you should fill in if possible.
55+
56+
By default you will find Sopel's logs in the ``~/.sopel/logs`` folder. If
57+
:attr:`~.config.core_section.CoreSection.homedir` and/or
58+
:attr:`~.config.core_section.CoreSection.logdir` is specified in Sopel's config
59+
file, logs will be found in ``/path/to/homedir/logdir`` if ``logdir`` is a
60+
relative path, or at ``/path/to/logdir`` if ``logdir`` is an absolute path. (If
61+
Sopel is :doc:`being run as a service <run/service>`, the ``logdir`` should be
62+
an absolute path.)
63+
64+
Log files' names start with :ref:`their associated config file's name
65+
<logging-basename>`, i.e. the :option:`--config <sopel start --config>`
66+
argument's value.
67+
68+
There are two main log types you might be asked to provide: ``sopel`` logs and
69+
``raw`` logs.
70+
71+
Obtaining ``sopel`` logs
72+
------------------------
73+
74+
``<configname>.sopel.log`` files contain everything Sopel does from startup to
75+
shutdown.
76+
77+
In normal operation, the ``INFO`` (default) or ``WARNING``
78+
:attr:`~.config.core_section.CoreSection.logging_level` is usually sufficient.
79+
For ambiguous or particularly gnarly problems, you might be asked to enable
80+
``DEBUG`` logging and reproduce your issue to help Sopel's developers understand
81+
what's happening.
82+
83+
Obtaining ``raw`` logs
84+
----------------------
85+
86+
For certain problem types, a developer might ask for ``raw`` logs to examine
87+
exactly what Sopel and the IRC server are saying to each other.
88+
89+
These ``<configname>.raw.log`` files are not enabled by default. If requested
90+
by the person helping you in our issue tracker or IRC channel, you can turn
91+
``raw`` logs on using the :attr:`~.config.core_section.CoreSection.log_raw`
92+
setting in your config file.
93+
94+
.. warning::
95+
96+
The ``raw`` log may contain sensitive information, e.g. your bot's NickServ
97+
account credentials, its IP address, or channel keys.
98+
99+
Always check the portion of your ``raw`` log that you are sharing for
100+
secrets, and censor any you find!
101+
102+
.. seealso::
103+
104+
More information about configuring Sopel's logging is available in the
105+
:ref:`Logging` section.

docs/source/run/configuration.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -804,12 +804,10 @@ there may be as many as four log files per config:
804804
Sopel uses the built-in :func:`logging.basicConfig` function to configure its
805805
logs with the following arguments:
806806

807-
* ``format``: set to :attr:`~CoreSection.logging_format` if configured
808-
* ``datefmt``: set to :attr:`~CoreSection.logging_datefmt` if configured
809-
* ``level``: set to :attr:`~CoreSection.logging_level`, default to ``WARNING``
810-
(see the Python documentation for `available logging levels`__)
811-
812-
.. __: https://docs.python.org/3/library/logging.html#logging-levels
807+
* ``format``: set to :attr:`~CoreSection.logging_format`
808+
* ``datefmt``: set to :attr:`~CoreSection.logging_datefmt`
809+
* ``level``: set to :attr:`~CoreSection.logging_level` (see
810+
:ref:`available logging levels <levels>` in Python's documentation)
813811

814812
Example of configuration for logging::
815813

sopel/config/core_section.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -756,8 +756,11 @@ class CoreSection(StaticSection):
756756
def homedir(self):
757757
"""The directory in which various files are stored at runtime.
758758
759-
By default, this is the same directory as the config file. It cannot be
760-
changed at runtime.
759+
Specifying the ``homedir`` option is useful for e.g. :doc:`running Sopel
760+
as a system service </run/service>`.
761+
762+
If not set, the config file's parent directory will be used. This value
763+
cannot be changed at runtime.
761764
"""
762765
return self._parent.homedir
763766

@@ -824,7 +827,7 @@ def homedir(self):
824827
:default: ``logs``
825828
826829
If the given value is not an absolute path, it will be interpreted relative
827-
to the directory containing the config file with which Sopel was started.
830+
to the :attr:`homedir` of the config file with which Sopel was started.
828831
829832
.. seealso::
830833

0 commit comments

Comments
 (0)