forked from python/python-docs-es
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogging-cookbook.po
2891 lines (2611 loc) · 145 KB
/
logging-cookbook.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (C) 2001-2020, Python Software Foundation
# This file is distributed under the same license as the Python package.
# Maintained by the python-doc-es workteam.
# https://mail.python.org/mailman3/lists/docs-es.python.org/
# Check https://github.com/python/python-docs-es/blob/3.8/TRANSLATORS to
# get the list of volunteers
#
msgid ""
msgstr ""
"Project-Id-Version: Python 3.8\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-10-25 19:47+0200\n"
"PO-Revision-Date: 2022-10-27 15:51-0300\n"
"Last-Translator: Carlos A. Crespo <[email protected]>\n"
"Language-Team: python-doc-es\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Generated-By: Babel 2.10.3\n"
"X-Generator: Poedit 3.0.1\n"
#: ../Doc/howto/logging-cookbook.rst:5
msgid "Logging Cookbook"
msgstr "Libro de recetas de Logging"
#: ../Doc/howto/logging-cookbook.rst
msgid "Author"
msgstr "Autor"
#: ../Doc/howto/logging-cookbook.rst:7
msgid "Vinay Sajip <vinay_sajip at red-dove dot com>"
msgstr "Vinay Sajip <vinay_sajip at red-dove dot com>"
#: ../Doc/howto/logging-cookbook.rst:9
msgid ""
"This page contains a number of recipes related to logging, which have been "
"found useful in the past. For links to tutorial and reference information, "
"please see :ref:`cookbook-ref-links`."
msgstr ""
"Esta página contiene un número de recetas sobre *logging*, que han sido "
"útiles en el pasado. Para obtener enlaces al tutorial e información de "
"referencia, consulte :ref:`cookbook-ref-links`."
#: ../Doc/howto/logging-cookbook.rst:16
msgid "Using logging in multiple modules"
msgstr "Usar logging en múltiples módulos"
#: ../Doc/howto/logging-cookbook.rst:18
msgid ""
"Multiple calls to ``logging.getLogger('someLogger')`` return a reference to "
"the same logger object. This is true not only within the same module, but "
"also across modules as long as it is in the same Python interpreter "
"process. It is true for references to the same object; additionally, "
"application code can define and configure a parent logger in one module and "
"create (but not configure) a child logger in a separate module, and all "
"logger calls to the child will pass up to the parent. Here is a main "
"module::"
msgstr ""
"Múltiples llamadas a ``logging.getLogger('someLogger')`` retornan una "
"referencia al mismo objeto logger. Esto es cierto no solo dentro del mismo "
"módulo, sino también en todos los módulos siempre que estén ejecutándose en "
"el mismo proceso del intérprete de Python. Es válido para las referencias al "
"mismo objeto. Además, el código de la aplicación puede definir y configurar "
"un logger primario en un módulo y crear (pero no configurar) un logger "
"secundario en un módulo separado, y todas las llamadas al secundario pasarán "
"al principal. A continuación un módulo principal::"
# Esto me confunde un poco. Cuando menciona módulo principal / auxiliar en los
# ejemplos, ¿se refiere a principal y secundario que está en el cuerpo del
# texto? ¿no convendría unificar?
#: ../Doc/howto/logging-cookbook.rst:56
msgid "Here is the auxiliary module::"
msgstr "Y aquí un módulo auxiliar::"
#: ../Doc/howto/logging-cookbook.rst:76
msgid "The output looks like this:"
msgstr "El resultado se ve así:"
#: ../Doc/howto/logging-cookbook.rst:102
msgid "Logging from multiple threads"
msgstr "Logging desde múltiples hilos"
#: ../Doc/howto/logging-cookbook.rst:104
msgid ""
"Logging from multiple threads requires no special effort. The following "
"example shows logging from the main (initial) thread and another thread::"
msgstr ""
"Realizar *logging* desde múltiples hilos (*threads*) no requiere ningún "
"esfuerzo especial. El siguiente ejemplo muestra el logging desde el hilo "
"principal (inicial) y otro hilo::"
#: ../Doc/howto/logging-cookbook.rst:133
msgid "When run, the script should print something like the following:"
msgstr "Cuando se ejecuta, el script debe imprimir algo como lo siguiente:"
#: ../Doc/howto/logging-cookbook.rst:155
msgid ""
"This shows the logging output interspersed as one might expect. This "
"approach works for more threads than shown here, of course."
msgstr ""
"Esto muestra la salida de logging intercalada como cabría esperar. Por "
"supuesto, este enfoque funciona para más hilos de lo que se muestran aquí."
#: ../Doc/howto/logging-cookbook.rst:159
msgid "Multiple handlers and formatters"
msgstr "Múltiples gestores y formateadores"
#: ../Doc/howto/logging-cookbook.rst:161
msgid ""
"Loggers are plain Python objects. The :meth:`~Logger.addHandler` method has "
"no minimum or maximum quota for the number of handlers you may add. "
"Sometimes it will be beneficial for an application to log all messages of "
"all severities to a text file while simultaneously logging errors or above "
"to the console. To set this up, simply configure the appropriate handlers. "
"The logging calls in the application code will remain unchanged. Here is a "
"slight modification to the previous simple module-based configuration "
"example::"
msgstr ""
"Los *loggers* son simples objetos Python. El método :meth:`~Logger."
"addHandler` no tiene una cuota mínima o máxima para la cantidad de gestores "
"(*handlers*) que puede agregar. A veces será beneficioso para una aplicación "
"registrar todos los mensajes de todas las prioridades en un archivo de texto "
"mientras se registran simultáneamente los errores o más en la consola. Para "
"configurar esto, simplemente configure los gestores apropiados. Las llamadas "
"de logging en el código de la aplicación permanecerán sin cambios. Aquí hay "
"una ligera modificación al ejemplo de configuración simple anterior basado "
"en módulo::"
#: ../Doc/howto/logging-cookbook.rst:194
msgid ""
"Notice that the 'application' code does not care about multiple handlers. "
"All that changed was the addition and configuration of a new handler named "
"*fh*."
msgstr ""
"Tenga en cuenta que el código de la 'aplicación' no se preocupa por los "
"gestores múltiples. Todo lo que cambió fue la adición y configuración de un "
"nuevo gestor llamado *fh*."
#: ../Doc/howto/logging-cookbook.rst:197
msgid ""
"The ability to create new handlers with higher- or lower-severity filters "
"can be very helpful when writing and testing an application. Instead of "
"using many ``print`` statements for debugging, use ``logger.debug``: Unlike "
"the print statements, which you will have to delete or comment out later, "
"the logger.debug statements can remain intact in the source code and remain "
"dormant until you need them again. At that time, the only change that needs "
"to happen is to modify the severity level of the logger and/or handler to "
"debug."
msgstr ""
"La capacidad de crear nuevos gestores con filtros de mayor o menor prioridad "
"puede ser muy útil al escribir y probar una aplicación. En lugar de usar "
"muchas declaraciones ``print`` para la depuración, use ``logger.debug``: a "
"diferencia de las declaraciones de impresión, que tendrá que eliminar o "
"comentar más tarde, las declaraciones de *logger.debug* pueden permanecer "
"intactas en el código fuente y permanecen inactivas hasta que las necesite "
"nuevamente. En ese momento, el único cambio que debe realizar es modificar "
"el nivel de prioridad del *logger* y/o gestor para depurar."
#: ../Doc/howto/logging-cookbook.rst:208
msgid "Logging to multiple destinations"
msgstr "Logging en múltiples destinos"
#: ../Doc/howto/logging-cookbook.rst:210
msgid ""
"Let's say you want to log to console and file with different message formats "
"and in differing circumstances. Say you want to log messages with levels of "
"DEBUG and higher to file, and those messages at level INFO and higher to the "
"console. Let's also assume that the file should contain timestamps, but the "
"console messages should not. Here's how you can achieve this::"
msgstr ""
"Supongamos que desea que la consola y un archivo tengan diferentes formatos "
"de mensaje y salida de log para diferentes situaciones. Por ejemplo, desea "
"registrar mensajes con un nivel DEBUG y superiores en un archivo y enviar "
"mensajes con nivel INFO y superior a la consola. Además, suponga que desea "
"grabar una marca de tiempo en el archivo y no imprimirlo en la consola. "
"Puede lograr este comportamiento haciendo lo siguiente::"
#: ../Doc/howto/logging-cookbook.rst:248
msgid "When you run this, on the console you will see"
msgstr "Cuando ejecute esto, en la consola verá"
#: ../Doc/howto/logging-cookbook.rst:257
msgid "and in the file you will see something like"
msgstr "y en el archivo verá algo como"
#: ../Doc/howto/logging-cookbook.rst:267
msgid ""
"As you can see, the DEBUG message only shows up in the file. The other "
"messages are sent to both destinations."
msgstr ""
"Como se puede ver, el mensaje DEBUG sólo se muestra en el archivo. Los otros "
"mensajes se envían a los dos destinos."
#: ../Doc/howto/logging-cookbook.rst:270
msgid ""
"This example uses console and file handlers, but you can use any number and "
"combination of handlers you choose."
msgstr ""
"Este ejemplo usa gestores de consola y archivos, pero puede usar cualquier "
"número y combinación de los gestores que elija."
#: ../Doc/howto/logging-cookbook.rst:273
msgid ""
"Note that the above choice of log filename ``/tmp/myapp.log`` implies use of "
"a standard location for temporary files on POSIX systems. On Windows, you "
"may need to choose a different directory name for the log - just ensure that "
"the directory exists and that you have the permissions to create and update "
"files in it."
msgstr ""
"Tenga en cuenta que la elección anterior del nombre del archivo de registro "
"``/tmp/myapp.log`` implica el uso de una ubicación estándar para los "
"archivos temporales en los sistemas POSIX. En Windows, es posible que tenga "
"que elegir un nombre de directorio diferente para el registro - sólo "
"asegúrese de que el directorio existe y que tiene los permisos para crear y "
"actualizar archivos en él."
#: ../Doc/howto/logging-cookbook.rst:282
msgid "Custom handling of levels"
msgstr "Gestión personalizada de niveles"
#: ../Doc/howto/logging-cookbook.rst:284
msgid ""
"Sometimes, you might want to do something slightly different from the "
"standard handling of levels in handlers, where all levels above a threshold "
"get processed by a handler. To do this, you need to use filters. Let's look "
"at a scenario where you want to arrange things as follows:"
msgstr ""
"A veces, es posible que desee hacer algo ligeramente diferente del manejo "
"estándar de niveles, donde todos los niveles por encima de un umbral son "
"procesados por un gestor. Para ello, es necesario utilizar filtros. Veamos "
"un escenario en el que se desea organizar las cosas de la siguiente manera:"
#: ../Doc/howto/logging-cookbook.rst:289
msgid "Send messages of severity ``INFO`` and ``WARNING`` to ``sys.stdout``"
msgstr "Enviar mensajes de gravedad ``INFO`` y ``WARNING`` a ``sys.stdout``"
#: ../Doc/howto/logging-cookbook.rst:290
msgid "Send messages of severity ``ERROR`` and above to ``sys.stderr``"
msgstr "Enviar mensajes de gravedad ``ERROR`` y superiores a ``sys.stderr``"
#: ../Doc/howto/logging-cookbook.rst:291
msgid "Send messages of severity ``DEBUG`` and above to file ``app.log``"
msgstr ""
"Envía los mensajes de gravedad ``DEBUG`` y superiores al archivo ``app.log``"
#: ../Doc/howto/logging-cookbook.rst:293
msgid "Suppose you configure logging with the following JSON:"
msgstr "Supongamos que se configura el registro con el siguiente JSON:"
#: ../Doc/howto/logging-cookbook.rst:335
msgid ""
"This configuration does *almost* what we want, except that ``sys.stdout`` "
"would show messages of severity ``ERROR`` and above as well as ``INFO`` and "
"``WARNING`` messages. To prevent this, we can set up a filter which excludes "
"those messages and add it to the relevant handler. This can be configured by "
"adding a ``filters`` section parallel to ``formatters`` and ``handlers``:"
msgstr ""
"Esta configuración hace *casi* lo que queremos, excepto que ``sys.stdout`` "
"mostraría mensajes de gravedad ``ERROR`` y superiores, así como mensajes "
"``INFO`` y ``WARNING``. Para evitarlo, podemos configurar un filtro que "
"excluya esos mensajes y añadirlo al gestor correspondiente. Esto se puede "
"configurar añadiendo una sección ``filters`` paralela a ``formatters`` y "
"``handlers``:"
#: ../Doc/howto/logging-cookbook.rst:350
msgid "and changing the section on the ``stdout`` handler to add it:"
msgstr "y cambiando la sección del gestor ``stdout`` para añadirlo:"
#: ../Doc/howto/logging-cookbook.rst:362
msgid ""
"A filter is just a function, so we can define the ``filter_maker`` (a "
"factory function) as follows:"
msgstr ""
"Un filtro no es más que una función, por lo que podemos definir el "
"``filter_maker`` (una función de fábrica) como sigue:"
#: ../Doc/howto/logging-cookbook.rst:375
msgid ""
"This converts the string argument passed in to a numeric level, and returns "
"a function which only returns ``True`` if the level of the passed in record "
"is at or below the specified level. Note that in this example I have defined "
"the ``filter_maker`` in a test script ``main.py`` that I run from the "
"command line, so its module will be ``__main__`` - hence the ``__main__."
"filter_maker`` in the filter configuration. You will need to change that if "
"you define it in a different module."
msgstr ""
"Esto convierte el argumento de la cadena de caracteres pasada en un nivel "
"numérico, y retorna una función que sólo retorna ``True`` si el nivel del "
"registro pasado está en o por debajo del nivel especificado. Ten en cuenta "
"que en este ejemplo se ha definido el ``filter_maker`` en un script de "
"prueba ``main.py`` que se ejecuta desde la línea de comandos, por lo que su "
"módulo será ``__main__`` - de ahí el ``__main__.filter_maker`` en la "
"configuración del filtro. Tendrás que cambiar eso si lo defines en un módulo "
"diferente."
#: ../Doc/howto/logging-cookbook.rst:383
msgid "With the filter added, we can run ``main.py``, which in full is:"
msgstr ""
"Con el filtro añadido, podemos ejecutar ``main.py``, que en su totalidad es:"
#: ../Doc/howto/logging-cookbook.rst:453
msgid "And after running it like this:"
msgstr "Y después de ejecutarlo de esta manera:"
#: ../Doc/howto/logging-cookbook.rst:459
msgid "We can see the results are as expected:"
msgstr "Podemos ver que los resultados son los esperados:"
#: ../Doc/howto/logging-cookbook.rst:485
msgid "Configuration server example"
msgstr "Ejemplo de servidor de configuración"
#: ../Doc/howto/logging-cookbook.rst:487
msgid "Here is an example of a module using the logging configuration server::"
msgstr ""
"Aquí hay un ejemplo de un módulo que usa el servidor de configuración "
"logging::"
#: ../Doc/howto/logging-cookbook.rst:518
msgid ""
"And here is a script that takes a filename and sends that file to the "
"server, properly preceded with the binary-encoded length, as the new logging "
"configuration::"
msgstr ""
"Y aquí hay un script que toma un nombre de archivo y envía ese archivo al "
"servidor, precedido adecuadamente con la longitud codificada en binario, "
"como la nueva configuración de logging::"
#: ../Doc/howto/logging-cookbook.rst:543
msgid "Dealing with handlers that block"
msgstr "Tratar con gestores que bloquean"
#: ../Doc/howto/logging-cookbook.rst:547
msgid ""
"Sometimes you have to get your logging handlers to do their work without "
"blocking the thread you're logging from. This is common in web applications, "
"though of course it also occurs in other scenarios."
msgstr ""
"A veces tiene que hacer que sus gestores de registro hagan su trabajo sin "
"bloquear el hilo desde el que está iniciando sesión. Esto es común en las "
"aplicaciones web, aunque, por supuesto, también ocurre en otros escenarios."
# -"under the hood": de bajo nivel? más técnicas?
#: ../Doc/howto/logging-cookbook.rst:551
msgid ""
"A common culprit which demonstrates sluggish behaviour is the :class:"
"`SMTPHandler`: sending emails can take a long time, for a number of reasons "
"outside the developer's control (for example, a poorly performing mail or "
"network infrastructure). But almost any network-based handler can block: "
"Even a :class:`SocketHandler` operation may do a DNS query under the hood "
"which is too slow (and this query can be deep in the socket library code, "
"below the Python layer, and outside your control)."
msgstr ""
"Un responsable habitual que ejemplifica un comportamiento lento es la :class:"
"`SMTPHandler`: el envío de correos electrónicos puede llevar mucho tiempo, "
"por varias razones fuera del control del desarrollador (por ejemplo, una "
"infraestructura de red o correo de bajo rendimiento). Pero casi cualquier "
"controlador basado en red puede bloquear: incluso una operación :class:"
"`SocketHandler` puede estar haciendo a bajo nivel una consulta DNS que es "
"demasiado lenta (y esta consulta puede estar en el código de la biblioteca "
"de socket, debajo de la capa de Python, y fuera de su control)."
#: ../Doc/howto/logging-cookbook.rst:559
msgid ""
"One solution is to use a two-part approach. For the first part, attach only "
"a :class:`QueueHandler` to those loggers which are accessed from performance-"
"critical threads. They simply write to their queue, which can be sized to a "
"large enough capacity or initialized with no upper bound to their size. The "
"write to the queue will typically be accepted quickly, though you will "
"probably need to catch the :exc:`queue.Full` exception as a precaution in "
"your code. If you are a library developer who has performance-critical "
"threads in their code, be sure to document this (together with a suggestion "
"to attach only ``QueueHandlers`` to your loggers) for the benefit of other "
"developers who will use your code."
msgstr ""
"Una solución es utilizar un enfoque de dos partes. Para la primera parte, "
"adjunte solo una :class:`QueueHandler` a los loggers que se acceden desde "
"subprocesos críticos de rendimiento. Simplemente escriben en su cola, que "
"puede dimensionarse a una capacidad lo suficientemente grande o "
"inicializarse sin límite superior a su tamaño. La escritura en la cola "
"generalmente se aceptará rápidamente, aunque es probable que deba atrapar la "
"excepción :exc:`queue.Full` como precaución en su código. Si usted es un "
"desarrollador de bibliotecas que tiene subprocesos críticos de rendimiento "
"en su código, asegúrese de documentar esto (junto con una sugerencia de "
"adjuntar solo ``QueueHandlers`` a sus loggers) para el beneficio de otros "
"desarrolladores que usarán su código."
#: ../Doc/howto/logging-cookbook.rst:570
msgid ""
"The second part of the solution is :class:`QueueListener`, which has been "
"designed as the counterpart to :class:`QueueHandler`. A :class:"
"`QueueListener` is very simple: it's passed a queue and some handlers, and "
"it fires up an internal thread which listens to its queue for LogRecords "
"sent from ``QueueHandlers`` (or any other source of ``LogRecords``, for that "
"matter). The ``LogRecords`` are removed from the queue and passed to the "
"handlers for processing."
msgstr ""
"La segunda parte de la solución es :class:`QueueListener`, que fue designado "
"como la contraparte de :class:`QueueHandler`. Un :class:`QueueListener` es "
"muy simple: ha pasado una cola y algunos gestores, y activa un hilo interno "
"que escucha su cola para *LogRecords* enviados desde ``QueueHandlers`` (o "
"cualquier otra fuente de ``LogRecords``, para el caso). Los ``LogRecords`` "
"se eliminan de la cola y se pasan a los gestores para su procesamiento."
#: ../Doc/howto/logging-cookbook.rst:578
msgid ""
"The advantage of having a separate :class:`QueueListener` class is that you "
"can use the same instance to service multiple ``QueueHandlers``. This is "
"more resource-friendly than, say, having threaded versions of the existing "
"handler classes, which would eat up one thread per handler for no particular "
"benefit."
msgstr ""
"La ventaja de tener una clase separada :class:`QueueListener` es que puede "
"usar la misma instancia para dar servicio a múltiples ``QueueHandlers``. "
"Esto es más amigable con los recursos que, por ejemplo, tener versiones "
"enhebradas de las clases de gestores existentes, que consumirían un hilo por "
"gestor sin ningún beneficio particular."
#: ../Doc/howto/logging-cookbook.rst:583
msgid "An example of using these two classes follows (imports omitted)::"
msgstr ""
"Un ejemplo del uso de estas dos clases a continuación (se omiten *imports*)::"
#: ../Doc/howto/logging-cookbook.rst:601
msgid "which, when run, will produce:"
msgstr "que, cuando se ejecuta, producirá:"
#: ../Doc/howto/logging-cookbook.rst:607
msgid ""
"Although the earlier discussion wasn't specifically talking about async "
"code, but rather about slow logging handlers, it should be noted that when "
"logging from async code, network and even file handlers could lead to "
"problems (blocking the event loop) because some logging is done from :mod:"
"`asyncio` internals. It might be best, if any async code is used in an "
"application, to use the above approach for logging, so that any blocking "
"code runs only in the ``QueueListener`` thread."
msgstr ""
"Aunque la discusión anterior no se refería específicamente al código "
"asíncrono, sino más bien a los gestores de logging lentos, hay que tener en "
"cuenta que cuando se realiza logging desde código asíncrono, los gestores de "
"red e incluso de archivos podrían dar problemas (bloqueo del bucle de "
"eventos) porque parte del logging se realiza desde los internos de :mod:"
"`asyncio`. Podría ser mejor, si se utiliza cualquier código asíncrono en una "
"aplicación, utilizar el enfoque anterior para el logging, de modo que "
"cualquier código de bloqueo se ejecute sólo en el hilo ``QueueListener``."
#: ../Doc/howto/logging-cookbook.rst:615
msgid ""
"Prior to Python 3.5, the :class:`QueueListener` always passed every message "
"received from the queue to every handler it was initialized with. (This was "
"because it was assumed that level filtering was all done on the other side, "
"where the queue is filled.) From 3.5 onwards, this behaviour can be changed "
"by passing a keyword argument ``respect_handler_level=True`` to the "
"listener's constructor. When this is done, the listener compares the level "
"of each message with the handler's level, and only passes a message to a "
"handler if it's appropriate to do so."
msgstr ""
"Antes de Python 3.5, :class:`QueueListener` siempre pasaba cada mensaje "
"recibido de la cola a cada controlador con el que se inicializaba. (Esto se "
"debió a que se asumió que el filtrado de nivel se realizó en el otro lado, "
"donde se llena la cola). A partir de 3.5, este comportamiento se puede "
"cambiar pasando un argumento de palabra clave ``respect_handler_level=True`` "
"al constructor del oyente . Cuando se hace esto, el oyente compara el nivel "
"de cada mensaje con el nivel del controlador y solo pasa un mensaje a un "
"controlador si es apropiado hacerlo."
#: ../Doc/howto/logging-cookbook.rst:628
msgid "Sending and receiving logging events across a network"
msgstr "Enviar y recibir eventos logging a través de una red"
#: ../Doc/howto/logging-cookbook.rst:630
msgid ""
"Let's say you want to send logging events across a network, and handle them "
"at the receiving end. A simple way of doing this is attaching a :class:"
"`SocketHandler` instance to the root logger at the sending end::"
msgstr ""
"Supongamos que desea enviar eventos de registro a través de una red y "
"gestionarlos en el extremo receptor. Una forma sencilla de hacer esto es "
"adjuntar una instancia de :class:`SocketHandler` al registrador raíz en el "
"extremo de envío::"
#: ../Doc/howto/logging-cookbook.rst:658
msgid ""
"At the receiving end, you can set up a receiver using the :mod:"
"`socketserver` module. Here is a basic working example::"
msgstr ""
"En el extremo receptor, puede configurar un receptor usando el módulo :mod:"
"`socketserver`. Aquí hay un ejemplo básico de trabajo:"
#: ../Doc/howto/logging-cookbook.rst:746
msgid ""
"First run the server, and then the client. On the client side, nothing is "
"printed on the console; on the server side, you should see something like:"
msgstr ""
"Primero ejecuta el servidor, y luego el cliente. Del lado del cliente, nada "
"se imprime en la consola; del lado del servidor, se debería ver algo como "
"esto:"
#: ../Doc/howto/logging-cookbook.rst:758
msgid ""
"Note that there are some security issues with pickle in some scenarios. If "
"these affect you, you can use an alternative serialization scheme by "
"overriding the :meth:`~handlers.SocketHandler.makePickle` method and "
"implementing your alternative there, as well as adapting the above script to "
"use your alternative serialization."
msgstr ""
"Tenga en cuenta que existen algunos problemas de seguridad con pickle en "
"algunos escenarios. Si estos le afectan, puede usar un esquema de "
"serialización alternativo anulando el método :meth:`~ handlers.SocketHandler."
"makePickle` e implementando su alternativa allí, así como adaptar el script "
"anterior para usar su serialización alternativa."
#: ../Doc/howto/logging-cookbook.rst:766
msgid "Running a logging socket listener in production"
msgstr "Ejecutando un logging de socket oyente en producción"
#: ../Doc/howto/logging-cookbook.rst:768
msgid ""
"To run a logging listener in production, you may need to use a process-"
"management tool such as `Supervisor <http://supervisord.org/>`_. `Here "
"<https://gist.github.com/vsajip/4b227eeec43817465ca835ca66f75e2b>`_ is a "
"Gist which provides the bare-bones files to run the above functionality "
"using Supervisor: you will need to change the ``/path/to/`` parts in the "
"Gist to reflect the actual paths you want to use."
msgstr ""
"Para ejecutar un logging oyente en producción, es posible que tenga que "
"utilizar una herramienta de gestión de procesos como `Supervisor <http://"
"supervisord.org/>`_. `Aquí <https://gist.github.com/"
"vsajip/4b227eeec43817465ca835ca66f75e2b>`_ hay un Gist que proporciona los "
"archivos básicos para ejecutar la funcionalidad anterior utilizando "
"Supervisor: tendrá que cambiar las partes ``/path/to/`` en el Gist para "
"reflejar las rutas reales que desea utilizar."
#: ../Doc/howto/logging-cookbook.rst:779
msgid "Adding contextual information to your logging output"
msgstr "Agregar información contextual a su salida de logging"
# no estoy seguro de la parte "se liberan de memoria via recolector de
# basura". En la wikipedia en español lo llaman así. "se liberan de memoria"
# es una agregado mío.
#: ../Doc/howto/logging-cookbook.rst:781
msgid ""
"Sometimes you want logging output to contain contextual information in "
"addition to the parameters passed to the logging call. For example, in a "
"networked application, it may be desirable to log client-specific "
"information in the log (e.g. remote client's username, or IP address). "
"Although you could use the *extra* parameter to achieve this, it's not "
"always convenient to pass the information in this way. While it might be "
"tempting to create :class:`Logger` instances on a per-connection basis, this "
"is not a good idea because these instances are not garbage collected. While "
"this is not a problem in practice, when the number of :class:`Logger` "
"instances is dependent on the level of granularity you want to use in "
"logging an application, it could be hard to manage if the number of :class:"
"`Logger` instances becomes effectively unbounded."
msgstr ""
"A veces, desea que la salida de logging contenga información contextual "
"además de los parámetros pasados a la llamada del logging. Por ejemplo, en "
"una aplicación en red, puede ser conveniente registrar información "
"específica del cliente en el logging (por ejemplo, el nombre de usuario del "
"cliente remoto o la dirección IP). Aunque puede usar el parámetro *extra* "
"para lograr esto, no siempre es conveniente pasar la información de esta "
"manera. Si bien puede resultar tentador crear instancias :class:`Logger` por "
"conexión, esta no es una buena idea porque estas instancias no se liberan de "
"memoria vía el recolector de basura (*garbage collector*). Si bien esto no "
"es un problema en la práctica, cuando el número de instancias de :class:"
"`Logger` depende del nivel de granularidad que desea usar para hacer el "
"logging de una aplicación, podría ser difícil de administrar si el número de "
"instancias :class:`Logger` se vuelven efectivamente ilimitadas."
#: ../Doc/howto/logging-cookbook.rst:796
msgid "Using LoggerAdapters to impart contextual information"
msgstr "Uso de LoggerAdapters para impartir información contextual"
# "signatures" por "características"?
#: ../Doc/howto/logging-cookbook.rst:798
msgid ""
"An easy way in which you can pass contextual information to be output along "
"with logging event information is to use the :class:`LoggerAdapter` class. "
"This class is designed to look like a :class:`Logger`, so that you can call :"
"meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:"
"`exception`, :meth:`critical` and :meth:`log`. These methods have the same "
"signatures as their counterparts in :class:`Logger`, so you can use the two "
"types of instances interchangeably."
msgstr ""
"Una manera fácil de pasar información contextual para que se genere junto "
"con la información de eventos logging es usar la clase :class:"
"`LoggerAdapter`. Esta clase está diseñada para parecerse a :class:`Logger`, "
"de modo que pueda llamar :meth:`debug`, :meth:`info`, :meth:`warning`, :meth:"
"`error`, :meth:`excepción`, :meth:`critical` y :meth:`log`. Estos métodos "
"tienen las mismas signaturas que sus contrapartes en :class:`Logger`, por lo "
"que puede usar los dos tipos de instancias indistintamente."
#: ../Doc/howto/logging-cookbook.rst:806
msgid ""
"When you create an instance of :class:`LoggerAdapter`, you pass it a :class:"
"`Logger` instance and a dict-like object which contains your contextual "
"information. When you call one of the logging methods on an instance of :"
"class:`LoggerAdapter`, it delegates the call to the underlying instance of :"
"class:`Logger` passed to its constructor, and arranges to pass the "
"contextual information in the delegated call. Here's a snippet from the code "
"of :class:`LoggerAdapter`::"
msgstr ""
"Cuando creas una instancia de :class:`LoggerAdapter`, le pasas una instancia "
"de :class:`Logger` y un objeto similar a un dict que contiene tu información "
"contextual. Cuando llamas a uno de los métodos de registro en una instancia "
"de :class:`LoggerAdapter`, delega la llamada a la instancia subyacente de :"
"class:`Logger` pasada a su constructor, y se arregla para pasar la "
"información contextual en la llamada delegada . Aquí hay un fragmento del "
"código de :class:`LoggerAdapter`::"
#: ../Doc/howto/logging-cookbook.rst:822
msgid ""
"The :meth:`~LoggerAdapter.process` method of :class:`LoggerAdapter` is where "
"the contextual information is added to the logging output. It's passed the "
"message and keyword arguments of the logging call, and it passes back "
"(potentially) modified versions of these to use in the call to the "
"underlying logger. The default implementation of this method leaves the "
"message alone, but inserts an 'extra' key in the keyword argument whose "
"value is the dict-like object passed to the constructor. Of course, if you "
"had passed an 'extra' keyword argument in the call to the adapter, it will "
"be silently overwritten."
msgstr ""
"El método :meth:`~LoggerAdapter.process` de :class:`LoggerAdapter` es donde "
"la información contextual se agrega a la salida del logging. Se pasa el "
"mensaje y los argumentos de palabra clave de la llamada logging, y retorna "
"versiones (potencialmente) modificadas de estos para usar en la llamada al "
"logging subyacente. La implementación predeterminada de este método deja el "
"mensaje solo, pero inserta una clave 'extra' en el argumento de palabra "
"clave cuyo valor es el objeto tipo dict pasado al constructor. Por supuesto, "
"si ha pasado un argumento de palabra clave 'extra' en la llamada al "
"adaptador, se sobrescribirá silenciosamente."
#: ../Doc/howto/logging-cookbook.rst:831
msgid ""
"The advantage of using 'extra' is that the values in the dict-like object "
"are merged into the :class:`LogRecord` instance's __dict__, allowing you to "
"use customized strings with your :class:`Formatter` instances which know "
"about the keys of the dict-like object. If you need a different method, e.g. "
"if you want to prepend or append the contextual information to the message "
"string, you just need to subclass :class:`LoggerAdapter` and override :meth:"
"`~LoggerAdapter.process` to do what you need. Here is a simple example::"
msgstr ""
"La ventaja de usar 'extra' es que los valores en el objeto dict se combinan "
"en la instancia :class:`LogRecord` __dict__, lo que le permite usar cadenas "
"personalizadas con sus instancias :class:`Formatter` que conocen las claves "
"del objeto dict. Si necesita un método diferente, por ejemplo, si desea "
"anteponer o agregar la información contextual a la cadena del mensaje, solo "
"necesita la subclase :class:`LoggerAdapter` y anular :meth:`~LoggerAdapter."
"process` para hacer lo que necesita. Aquí hay un ejemplo simple:"
#: ../Doc/howto/logging-cookbook.rst:847
msgid "which you can use like this::"
msgstr "que puede usar así::"
#: ../Doc/howto/logging-cookbook.rst:852
msgid ""
"Then any events that you log to the adapter will have the value of "
"``some_conn_id`` prepended to the log messages."
msgstr ""
"Luego, cualquier evento que registre en el adaptador tendrá el valor de "
"``some_conn_id`` antepuesto a los mensajes de logging."
#: ../Doc/howto/logging-cookbook.rst:856
msgid "Using objects other than dicts to pass contextual information"
msgstr ""
"Usar objetos distintos a los diccionarios para transmitir información "
"contextual"
#: ../Doc/howto/logging-cookbook.rst:858
msgid ""
"You don't need to pass an actual dict to a :class:`LoggerAdapter` - you "
"could pass an instance of a class which implements ``__getitem__`` and "
"``__iter__`` so that it looks like a dict to logging. This would be useful "
"if you want to generate values dynamically (whereas the values in a dict "
"would be constant)."
msgstr ""
"No es necesario pasar un diccionario real a la :class:`LoggerAdapter` - "
"puedes pasar una instancia de una clase que implemente ``__getitem__`` y "
"``__iter__`` de modo que parezca un diccionario para el logging. Esto es "
"útil si quieres generar valores dinámicamente (mientras que los valores en "
"un diccionario son constantes)."
#: ../Doc/howto/logging-cookbook.rst:867
msgid "Using Filters to impart contextual information"
msgstr "Usar filtros para impartir información contextual"
#: ../Doc/howto/logging-cookbook.rst:869
msgid ""
"You can also add contextual information to log output using a user-defined :"
"class:`Filter`. ``Filter`` instances are allowed to modify the "
"``LogRecords`` passed to them, including adding additional attributes which "
"can then be output using a suitable format string, or if needed a custom :"
"class:`Formatter`."
msgstr ""
"También puedes agregar información contextual a la salida del log utilizando "
"un :class:`Filter` definido por el usuario. Las instancias de ``Filter`` "
"pueden modificar los ``LogRecords`` que se les pasan, incluido el agregado "
"de atributos adicionales que luego se pueden generar utilizando cadena de "
"caracteres con el formato adecuado, o si es necesario, un :class:`Formatter` "
"personalizado."
#: ../Doc/howto/logging-cookbook.rst:874
msgid ""
"For example in a web application, the request being processed (or at least, "
"the interesting parts of it) can be stored in a threadlocal (:class:"
"`threading.local`) variable, and then accessed from a ``Filter`` to add, "
"say, information from the request - say, the remote IP address and remote "
"user's username - to the ``LogRecord``, using the attribute names 'ip' and "
"'user' as in the ``LoggerAdapter`` example above. In that case, the same "
"format string can be used to get similar output to that shown above. Here's "
"an example script::"
msgstr ""
"Por ejemplo, en una aplicación web, la solicitud que se está procesando (o "
"al menos, las partes interesantes de la misma) se pueden almacenar en una "
"variable *threadlocal* (:class:`threading.local`) y luego se puede acceder a "
"ella desde ``Filter`` para agregar información de la solicitud, - digamos, "
"la dirección IP remota y el nombre de usuario-, al ``LogRecord``, usando los "
"nombres de atributo 'ip' y 'user' como en el ejemplo anterior de "
"``LoggerAdapter``. En ese caso, se puede usar el mismo formato de cadena de "
"caracteres para obtener un resultado similar al que se muestra arriba. Aquí "
"hay un script de ejemplo::"
#: ../Doc/howto/logging-cookbook.rst:920
msgid "which, when run, produces something like:"
msgstr "que cuando se ejecuta, produce algo como:"
#: ../Doc/howto/logging-cookbook.rst:938
msgid "Use of ``contextvars``"
msgstr "Uso de ``contextvars``"
#: ../Doc/howto/logging-cookbook.rst:940
msgid ""
"Since Python 3.7, the :mod:`contextvars` module has provided context-local "
"storage which works for both :mod:`threading` and :mod:`asyncio` processing "
"needs. This type of storage may thus be generally preferable to thread-"
"locals. The following example shows how, in a multi-threaded environment, "
"logs can populated with contextual information such as, for example, request "
"attributes handled by web applications."
msgstr ""
"Desde la versión 3.7 de Python, el módulo :mod:`contextvars` ha "
"proporcionado almacenamiento local de contexto que funciona tanto para las "
"necesidades de procesamiento de :mod:`threading` como de :mod:`asyncio`. "
"Este tipo de almacenamiento puede ser, por tanto, preferible a los hilos "
"locales. El siguiente ejemplo muestra cómo, en un entorno multihilo, los "
"logs pueden rellenarse con información contextual como, por ejemplo, los "
"atributos de las peticiones gestionadas por las aplicaciones web."
#: ../Doc/howto/logging-cookbook.rst:946
msgid ""
"For the purposes of illustration, say that you have different web "
"applications, each independent of the other but running in the same Python "
"process and using a library common to them. How can each of these "
"applications have their own log, where all logging messages from the library "
"(and other request processing code) are directed to the appropriate "
"application's log file, while including in the log additional contextual "
"information such as client IP, HTTP request method and client username?"
msgstr ""
"A modo de ilustración, digamos que tienes diferentes aplicaciones web, cada "
"una de ellas independiente de la otra, pero que se ejecutan en el mismo "
"proceso de Python y utilizan una biblioteca común a todas ellas. ¿Cómo puede "
"cada una de estas aplicaciones tener su propio registro, donde todos los "
"mensajes de logging de la biblioteca (y otro código de procesamiento de "
"solicitudes) se dirigen al archivo de registro de la aplicación apropiada, "
"mientras se incluye en el registro información contextual adicional como la "
"IP del cliente, el método de solicitud HTTP y el nombre de usuario del "
"cliente?"
#: ../Doc/howto/logging-cookbook.rst:953
msgid "Let's assume that the library can be simulated by the following code:"
msgstr "Supongamos que la biblioteca se puede simular con el siguiente código:"
#: ../Doc/howto/logging-cookbook.rst:969
msgid ""
"We can simulate the multiple web applications by means of two simple "
"classes, ``Request`` and ``WebApp``. These simulate how real threaded web "
"applications work - each request is handled by a thread:"
msgstr ""
"Podemos simular las aplicaciones web múltiples mediante dos clases simples, "
"``Request`` y ``WebApp``. Éstas simulan cómo funcionan las aplicaciones web "
"reales con hilos, cada petición es manejada por un hilo:"
#: ../Doc/howto/logging-cookbook.rst:1113
msgid ""
"If you run the above, you should find that roughly half the requests go "
"into :file:`app1.log` and the rest into :file:`app2.log`, and the all the "
"requests are logged to :file:`app.log`. Each webapp-specific log will "
"contain only log entries for only that webapp, and the request information "
"will be displayed consistently in the log (i.e. the information in each "
"dummy request will always appear together in a log line). This is "
"illustrated by the following shell output:"
msgstr ""
"Si ejecuta lo anterior, debería encontrar que aproximadamente la mitad de "
"las peticiones van a :file:`app1.log` y el resto a :file:`app2.log`, y las "
"todas las peticiones se registran en :file:`app.log`. Cada registro "
"específico de la aplicación web contendrá únicamente entradas de log para "
"esa aplicación web, y la información de las peticiones se mostrará de forma "
"consistente en el registro (es decir, la información de cada petición "
"ficticia aparecerá siempre junta en una línea de log). Esto se ilustra con "
"la siguiente salida del shell:"
#: ../Doc/howto/logging-cookbook.rst:1160
msgid "Imparting contextual information in handlers"
msgstr "Impartir información contextual en los gestores"
#: ../Doc/howto/logging-cookbook.rst:1162
msgid ""
"Each :class:`~Handler` has its own chain of filters. If you want to add "
"contextual information to a :class:`LogRecord` without leaking it to other "
"handlers, you can use a filter that returns a new :class:`~LogRecord` "
"instead of modifying it in-place, as shown in the following script::"
msgstr ""
"Cada :class:`~Handler` tiene su propia cadena de filtros. Si quieres añadir "
"información contextual a una :class:`LogRecord` sin filtrarla a otros "
"gestores, puedes utilizar un filtro que retorna una nueva :class:"
"`~LogRecord` en lugar de modificarlo in situ, como se muestra en el "
"siguiente script::"
#: ../Doc/howto/logging-cookbook.rst:1189
msgid "Logging to a single file from multiple processes"
msgstr "Logging a un sólo archivo desde múltiples procesos"
# Traté de refrasear las primeras oraciones para que no sea super repetitivo.
# No tengo claro cómo es todo el tema de socket y si está bien traducido
# "socket server", "working socket".
#: ../Doc/howto/logging-cookbook.rst:1191
msgid ""
"Although logging is thread-safe, and logging to a single file from multiple "
"threads in a single process *is* supported, logging to a single file from "
"*multiple processes* is *not* supported, because there is no standard way to "
"serialize access to a single file across multiple processes in Python. If "
"you need to log to a single file from multiple processes, one way of doing "
"this is to have all the processes log to a :class:`~handlers.SocketHandler`, "
"and have a separate process which implements a socket server which reads "
"from the socket and logs to file. (If you prefer, you can dedicate one "
"thread in one of the existing processes to perform this function.) :ref:"
"`This section <network-logging>` documents this approach in more detail and "
"includes a working socket receiver which can be used as a starting point for "
"you to adapt in your own applications."
msgstr ""
"Aunque logging es seguro para hilos, y el logging a un solo archivo desde "
"múltiples hilos en un solo proceso *es* compatible, el logging en un solo "
"archivo desde *múltiples procesos* *no* es compatible, porque no existe una "
"forma estándar de serializar el acceso a un solo archivo en múltiples "
"procesos en Python. Si necesita hacer esto último, una forma de abordarlo es "
"hacer que todos los procesos se registren en una :class:`~handlers."
"SocketHandler`, y tener un proceso separado que implemente un servidor de "
"socket que lee del socket y los loggings para archivar. (Si lo prefiere, "
"puede dedicar un hilo en uno de los procesos existentes para realizar esta "
"función.) :ref:`Esta sección <network-logging>` documenta este enfoque con "
"más detalle e incluye un receptor socket que funciona que se puede utilizar "
"como punto de partida para que se adapte a sus propias aplicaciones."
#: ../Doc/howto/logging-cookbook.rst:1204
msgid ""
"You could also write your own handler which uses the :class:"
"`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to "
"serialize access to the file from your processes. The existing :class:"
"`FileHandler` and subclasses do not make use of :mod:`multiprocessing` at "
"present, though they may do so in the future. Note that at present, the :mod:"
"`multiprocessing` module does not provide working lock functionality on all "
"platforms (see https://bugs.python.org/issue3770)."
msgstr ""
"También puedes escribir tu propio gestor que use la clase :class:"
"`~multiprocessing.Lock` del módulo :mod:`multiprocessing` para serializar el "
"acceso al archivo desde tus procesos. La existente :class:`FileHandler` y "
"las subclases no hacen uso de :mod:`multiprocessing` en la actualidad, "
"aunque pueden hacerlo en el futuro. Tenga en cuenta que, en la actualidad, "
"el módulo :mod:`multiprocessing` no proporciona la funcionalidad de bloqueo "
"de trabajo en todas las plataformas (ver https://bugs.python.org/issue3770)."
#: ../Doc/howto/logging-cookbook.rst:1214
msgid ""
"Alternatively, you can use a ``Queue`` and a :class:`QueueHandler` to send "
"all logging events to one of the processes in your multi-process "
"application. The following example script demonstrates how you can do this; "
"in the example a separate listener process listens for events sent by other "
"processes and logs them according to its own logging configuration. Although "
"the example only demonstrates one way of doing it (for example, you may want "
"to use a listener thread rather than a separate listener process -- the "
"implementation would be analogous) it does allow for completely different "
"logging configurations for the listener and the other processes in your "
"application, and can be used as the basis for code meeting your own specific "
"requirements::"
msgstr ""
"Alternativamente, puede usar una ``Queue`` y :class:`QueueHandler` para "
"enviar todos los logging a uno de los procesos en su aplicación multi-"
"proceso. El siguiente script de ejemplo demuestra cómo puede hacer esto; en "
"el ejemplo, un proceso de escucha independiente escucha los eventos enviados "
"por otros procesos y los registra de acuerdo con su propia configuración de "
"logging. Aunque el ejemplo solo demuestra una forma de hacerlo (por ejemplo, "
"es posible que desee utilizar un hilo de escucha en lugar de un proceso de "
"escucha separado; la implementación sería análoga), permite configuraciones "
"de logging completamente diferentes para el oyente y los otros procesos en "
"su aplicación. Y se puede utilizar como base para el código que cumpla con "
"sus propios requisitos específicos::"
#: ../Doc/howto/logging-cookbook.rst:1330
msgid ""
"A variant of the above script keeps the logging in the main process, in a "
"separate thread::"
msgstr ""
"Una variante del script anterior mantiene el logging en el proceso "
"principal, en un hilo separado::"
#: ../Doc/howto/logging-cookbook.rst:1425
msgid ""
"This variant shows how you can e.g. apply configuration for particular "
"loggers - e.g. the ``foo`` logger has a special handler which stores all "
"events in the ``foo`` subsystem in a file ``mplog-foo.log``. This will be "
"used by the logging machinery in the main process (even though the logging "
"events are generated in the worker processes) to direct the messages to the "
"appropriate destinations."
msgstr ""
"Esta variante muestra cómo puede, por ejemplo, aplicar la configuración para "
"logging particulares: el registrador ``foo`` tiene un gestor especial que "
"almacena todos los eventos en el subsistema ``foo`` en un archivo ``mplog-"
"foo.log``. Esto será utilizado por la maquinaria de logging en el proceso "
"principal (aunque los eventos logging se generen en los procesos de trabajo) "
"para dirigir los mensajes a los destinos apropiados."
#: ../Doc/howto/logging-cookbook.rst:1432
msgid "Using concurrent.futures.ProcessPoolExecutor"
msgstr "Usando concurrent.futures.ProcessPoolExecutor"
#: ../Doc/howto/logging-cookbook.rst:1434
msgid ""
"If you want to use :class:`concurrent.futures.ProcessPoolExecutor` to start "
"your worker processes, you need to create the queue slightly differently. "
"Instead of"
msgstr ""
"Si desea utilizar :class:`concurrent.futures.ProcessPoolExecutor` para "
"iniciar sus procesos de trabajo, debe crear la cola de manera ligeramente "
"diferente. En vez de"
#: ../Doc/howto/logging-cookbook.rst:1442
msgid "you should use"
msgstr "debería usar"
#: ../Doc/howto/logging-cookbook.rst:1448
msgid "and you can then replace the worker creation from this::"
msgstr "y luego puede reemplazar la creación del trabajador de esto::"
#: ../Doc/howto/logging-cookbook.rst:1459
msgid "to this (remembering to first import :mod:`concurrent.futures`)::"
msgstr "a esto (recuerda el primer *import* :mod:`concurrent.futures`)::"
#: ../Doc/howto/logging-cookbook.rst:1466
msgid "Deploying Web applications using Gunicorn and uWSGI"
msgstr "Despliegue de aplicaciones web con Gunicorn y uWSGI"
#: ../Doc/howto/logging-cookbook.rst:1468
msgid ""
"When deploying Web applications using `Gunicorn <https://gunicorn.org/>`_ or "
"`uWSGI <https://uwsgi-docs.readthedocs.io/en/latest/>`_ (or similar), "
"multiple worker processes are created to handle client requests. In such "
"environments, avoid creating file-based handlers directly in your web "
"application. Instead, use a :class:`SocketHandler` to log from the web "
"application to a listener in a separate process. This can be set up using a "
"process management tool such as Supervisor - see `Running a logging socket "
"listener in production`_ for more details."
msgstr ""
"Cuando se despliegan aplicaciones web utilizando `Gunicorn <https://gunicorn."
"org/>`_ o `uWSGI <https://uwsgi-docs.readthedocs.io/en/latest/>`_ (o "
"similares), se crean múltiples procesos de trabajo para gestionar las "
"peticiones de los clientes. En estos entornos, evite crear gestores basados "
"directamente en archivos en su aplicación web. En su lugar, utilice un :"
"class:`SocketHandler` para registrar desde la aplicación web al oyente en un "
"proceso separado. Esto puede configurarse usando una herramienta de gestión "
"de procesos como Supervisor - vea `Running a logging socket listener in "
"production`_ para más detalles."
#: ../Doc/howto/logging-cookbook.rst:1478
msgid "Using file rotation"
msgstr "Usando rotación de archivos"
#: ../Doc/howto/logging-cookbook.rst:1483
msgid ""
"Sometimes you want to let a log file grow to a certain size, then open a new "
"file and log to that. You may want to keep a certain number of these files, "
"and when that many files have been created, rotate the files so that the "
"number of files and the size of the files both remain bounded. For this "
"usage pattern, the logging package provides a :class:`~handlers."
"RotatingFileHandler`::"
msgstr ""
"A veces, se desea dejar que un archivo de log crezca hasta cierto tamaño y "
"luego abra un nuevo archivo e inicie sesión en él. Es posible que desee "
"conservar una cierta cantidad de estos archivos, y cuando se hayan creado "
"tantos archivos, rote los archivos para que la cantidad de archivos y el "
"tamaño de los archivos permanezcan limitados. Para este patrón de uso, el "
"paquete logging proporciona :class:`~handlers.RotatingFileHandler`::"
#: ../Doc/howto/logging-cookbook.rst:1515
msgid ""
"The result should be 6 separate files, each with part of the log history for "
"the application:"
msgstr ""
"El resultado debe ser 6 archivos separados, cada uno con parte del historial "