@@ -127,11 +127,13 @@ setup_logging(config_path="", log_path="",
127127 use_multiprocessing = False ,
128128 limit_line_length = 1000 ,
129129 analyze_raise_statement = False ,
130+ host = " " ,
131+ port = 0 ,
130132 )
131133```
132134
133135This function also return a ` LogConfig ` object.
134- Except ` config_path ` , ` log_path ` and ` use_multiprocessing ` ,
136+ Except ` config_path ` , ` log_path ` , ` use_multiprocessing ` , ` host ` and ` port ` ,
135137other parameters are attributes of this object and can be changed on the fly.
136138
137139Except ` config_path ` , ` log_path ` , all other parameters can be defined in ` logger_tt ` section in the config file
@@ -507,6 +509,18 @@ The content of `log.txt` should be similar to below:
507509 ** Note** : Under linux, to use ` queueHandler ` , you must pass ` use_multiprocessing="fork" ` to ` setup_logging ` .<br >
508510 Other options ` True ` , ` spawn ` , ` forkserver ` will use ` socketHandler ` by default.<br >
509511 This is to prevent you ` set_start_method ` as ` spawn ` under linux and thus ` queueHandler ` won't work.
512+
513+
514+ ** Socket Address** : ` socketHandler ` will use tcp ` localhost ` and port ` 9020 ` by default.
515+ In the rare cases where you run multiple multiprocessing applications with ` logger_tt ` ,
516+ the ` Address already in use ` error will be raised. In such cases, you have to set the address manually.
517+
518+ ``` python
519+ setup_logging(host = ' localhost' , port = 6789 )
520+ ```
521+ You can omit the ` host ` if you use ` "localhost" ` .
522+ You can also set this in the log config file for each application.
523+
510524
511525### 8. Temporary disable logging:
512526
@@ -875,10 +889,14 @@ logger_tt:
875889# # 1.7.0
876890* Fixed:
877891 * multiprocessing: log file rollover fails as child process keep opening the file.
878- * multiprocessing: if the log path is set by variable with time,
892+ * multiprocessing: if the log path is set by a variable with time,
879893 child process creates a new redundant log path.
880- * New functionality: Added `StreamHandlerWithBuffer`.
881- GUI app could use this handler to keep the app responsive while having a tremendous log output.
894+
895+ * New functionality: Added `StreamHandlerWithBuffer`. Buffer the log output by time or by line number.
896+ GUI app could use this handler to keep the app responsive while having a tremendous log output.
897+
898+ * Usability: In multiprocessing logging,
899+ users can set the log server address themselves through `setup_logging` or log config file.
882900
883901# # 1.6.1
884902* Added `limit_line_length` parameter: log only maximum `n` characters for each traceback line.
@@ -933,7 +951,7 @@ logger_tt:
933951**Pre-existing loggers:**<br>
934952Before this version, if you import submodules before importing `logger_tt` and
935953there are loggers in submodules, these loggers do not inspect exception when you call `logger.exception()`.
936- That is because there class was different than loggers created after importing `logger_tt`.
954+ That is because there class was different from the loggers created after importing `logger_tt`.
937955Now all loggers have the same new class regardless the point of importing `logger_tt`.
938956
939957**setup_logging()**: This function should only be called once.
0 commit comments