Skip to content

Commit d2bcc98

Browse files
committed
Document logging settings - use the numbered list in example
Resolves #1974
1 parent ea1dd09 commit d2bcc98

File tree

2 files changed

+44
-41
lines changed

2 files changed

+44
-41
lines changed

doc/reference/configuration/cfg_logging.rst

+43-41
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ application.
6666
directory. If the ``log`` string has no prefix or has the prefix "file:",
6767
then the string is interpreted as a file path.
6868

69-
The example below shows how to send the log to a pipe:
69+
This example shows how to send the log to a pipe:
7070

7171
.. code-block:: lua
7272
@@ -218,67 +218,69 @@ Logging example
218218
This example illustrates how "rotation" works, that is, what happens when the server
219219
instance is writing to a log and signals are used when archiving it.
220220

221-
Start with two terminal shells, Terminal #1 and Terminal #2.
221+
1. Start with two terminal shells: Terminal #1 and Terminal #2.
222222

223-
On Terminal #1: start an interactive Tarantool session, then say the logging
224-
will go to `Log_file`, then put a message "Log Line #1" in the log file:
223+
2. In Terminal #1, start an interactive Tarantool session.
224+
Then, use the ``log`` property to send logs to `Log_file` and
225+
call ``log.info`` to put a message in the log file.
225226

226-
.. code-block:: lua
227+
.. code-block:: lua
227228
228-
box.cfg{log='Log_file'}
229-
log = require('log')
230-
log.info('Log Line #1')
229+
box.cfg{log='Log_file'}
230+
log = require('log')
231+
log.info('Log Line #1')
231232
232-
On Terminal #2: use ``mv`` so the log file is now named `Log_file.bak`.
233-
The result of this is: the next log message will go to `Log_file.bak`.
233+
3. In Terminal #2, use the ``mv`` command to rename the log file to `Log_file.bak`.
234234

235-
.. cssclass:: highlight
236-
.. parsed-literal::
235+
.. cssclass:: highlight
236+
.. parsed-literal::
237237
238-
mv Log_file Log_file.bak
238+
mv Log_file Log_file.bak
239239
240-
On Terminal #1: put a message "Log Line #2" in the log file.
240+
As the result, the next log message will go to `Log_file.bak`.
241241

242-
.. code-block:: lua
242+
4. Go back to Terminal #1 and put a message "Log Line #2" in the log file.
243243

244-
log.info('Log Line #2')
244+
.. code-block:: lua
245245
246-
On Terminal #2: use ``ps`` to find the process ID of the Tarantool instance.
246+
log.info('Log Line #2')
247247
248-
.. cssclass:: highlight
249-
.. parsed-literal::
248+
5. In Terminal #2, use ``ps`` to find the process ID of the Tarantool instance.
250249

251-
ps -A | grep tarantool
250+
.. cssclass:: highlight
251+
.. parsed-literal::
252252
253-
On Terminal #2: use ``kill -HUP`` to send a SIGHUP signal to the Tarantool instance.
254-
The result of this is: Tarantool will open `Log_file` again, and
255-
the next log message will go to `Log_file`.
256-
(The same effect could be accomplished by executing log.rotate() on the instance.)
253+
ps -A | grep tarantool
257254
258-
.. cssclass:: highlight
259-
.. parsed-literal::
255+
6. In Terminal #2, execute ``kill -HUP`` to send a SIGHUP signal to the Tarantool instance.
256+
The result of this is: Tarantool will open `Log_file` again, and
257+
the next log message will go to `Log_file`.
258+
(The same effect could be accomplished by executing log.rotate() on the instance.)
260259

261-
kill -HUP *process_id*
260+
.. cssclass:: highlight
261+
.. parsed-literal::
262262
263-
On Terminal #1: put a message "Log Line #3" in the log file.
263+
kill -HUP *process_id*
264264
265-
.. code-block:: lua
265+
7. In Terminal #1, put a message "Log Line #3" in the log file.
266266

267-
log.info('Log Line #3')
267+
.. code-block:: lua
268268
269-
On Terminal #2: use ``less`` to examine files. `Log_file.bak` will have these lines,
270-
except that the date and time will depend on when the example is done:
269+
log.info('Log Line #3')
271270
272-
.. cssclass:: highlight
273-
.. parsed-literal::
271+
8. In Terminal #2, use ``less`` to examine files.
272+
`Log_file.bak` will have the following lines ...
274273

275-
2015-11-30 15:13:06.373 [27469] main/101/interactive I> Log Line #1`
276-
2015-11-30 15:14:25.973 [27469] main/101/interactive I> Log Line #2`
274+
.. cssclass:: highlight
275+
.. parsed-literal::
277276
278-
and `Log_file` will have
277+
2015-11-30 15:13:06.373 [27469] main/101/interactive I> Log Line #1`
278+
2015-11-30 15:14:25.973 [27469] main/101/interactive I> Log Line #2`
279279
280-
.. cssclass:: highlight
281-
.. parsed-literal::
280+
... and `Log_file` will look like this:
282281

283-
log file has been reopened
284-
2015-11-30 15:15:32.629 [27469] main/101/interactive I> Log Line #3
282+
.. cssclass:: highlight
283+
.. parsed-literal::
284+
285+
log file has been reopened
286+
2015-11-30 15:15:32.629 [27469] main/101/interactive I> Log Line #3

doc/reference/reference_lua/log.rst

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ Below is a list of all ``log`` functions.
141141
.. function:: pid()
142142

143143
:return: A PID of a logger.
144+
You can use this PID to send a signal to a log rotation program, so it can rotate logs.
144145

145146
.. _log-rotate:
146147

0 commit comments

Comments
 (0)