@@ -66,7 +66,7 @@ application.
66
66
directory. If the ``log `` string has no prefix or has the prefix "file:",
67
67
then the string is interpreted as a file path.
68
68
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:
70
70
71
71
.. code-block :: lua
72
72
@@ -218,67 +218,69 @@ Logging example
218
218
This example illustrates how "rotation" works, that is, what happens when the server
219
219
instance is writing to a log and signals are used when archiving it.
220
220
221
- Start with two terminal shells, Terminal #1 and Terminal #2.
221
+ 1. Start with two terminal shells: Terminal #1 and Terminal #2.
222
222
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.
225
226
226
- .. code-block :: lua
227
+ .. code-block :: lua
227
228
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')
231
232
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 `.
234
234
235
- .. cssclass :: highlight
236
- .. parsed-literal ::
235
+ .. cssclass :: highlight
236
+ .. parsed-literal ::
237
237
238
- mv Log_file Log_file.bak
238
+ mv Log_file Log_file.bak
239
239
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 ` .
241
241
242
- .. code-block :: lua
242
+ 4. Go back to Terminal #1 and put a message "Log Line #2" in the log file.
243
243
244
- log.info('Log Line #2')
244
+ .. code-block :: lua
245
245
246
- On Terminal #2: use `` ps `` to find the process ID of the Tarantool instance.
246
+ log.info('Log Line #2')
247
247
248
- .. cssclass :: highlight
249
- .. parsed-literal ::
248
+ 5. In Terminal #2, use ``ps `` to find the process ID of the Tarantool instance.
250
249
251
- ps -A | grep tarantool
250
+ .. cssclass :: highlight
251
+ .. parsed-literal ::
252
252
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
257
254
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.)
260
259
261
- kill -HUP *process_id *
260
+ .. cssclass :: highlight
261
+ .. parsed-literal ::
262
262
263
- On Terminal #1: put a message "Log Line #3" in the log file.
263
+ kill -HUP * process_id *
264
264
265
- .. code-block :: lua
265
+ 7. In Terminal #1, put a message "Log Line #3" in the log file.
266
266
267
- log.info('Log Line #3')
267
+ .. code-block :: lua
268
268
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')
271
270
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 ...
274
273
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 ::
277
276
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`
279
279
280
- .. cssclass :: highlight
281
- .. parsed-literal ::
280
+ ... and `Log_file ` will look like this:
282
281
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
0 commit comments