jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/694318 )

Change subject: Revert "[IMPR] Use different logfiles for multiple processes 
(Step 2)"
......................................................................

Revert "[IMPR] Use different logfiles for multiple processes (Step 2)"

This reverts commit d0ae0ff3bded6b271557dccf88dd5c96ab7dada3.

Reason for revert: This splits logs for the same script across multiple files
even when multiple copies of that script aren't being run at the same time.
Example:

  python t1.py -log  # pid: 1; logs to t1-bot.log; OK
  # t1.py ends
  python t2.py -log  # pid: 1; logs to t2-bot.log; OK
  python t1.py -log  # pid: 2; logs to t1-2-bot.log; should be t1-bot.log
  # t1.py and t2.py end
  python t1.py -log  # pid: 1; logs to t1-bot.log; OK

This makes it difficult to read the log chronologically across multiple runs
when other scripts may run at overlapping times.

Change-Id: Iae8311b0c3ec40acccb400a30f1de4efea1e37fc
---
M pywikibot/bot.py
1 file changed, 3 insertions(+), 11 deletions(-)

Approvals:
  JJMC89: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 219601d..86ab1d7 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -103,7 +103,7 @@
 from warnings import warn

 import pywikibot
-from pywikibot import config, daemonize, i18n, throttle, version
+from pywikibot import config, daemonize, i18n, version
 from pywikibot.backports import Dict, Iterable, List, Sequence
 from pywikibot.bot_choice import (
     AlwaysChoice,
@@ -346,19 +346,11 @@

     # if user has enabled file logging, configure file handler
     if module_name in config.log or '*' in config.log:
-        # get PID
-        pywikibot.Site().throttle  # initialize a Throttle object and set PID
-        pid = throttle.pid  # get the global PID
-        pid = str(pid) + '-' if pid > 1 else ''
-
         if config.logfilename:
-            # keep config.logfilename unchanged
             logfile = config.datafilepath('logs', config.logfilename)
         else:
-            # add PID to logfle name
-            logfile = config.datafilepath('logs', '{}-{}bot.log'
-                                          .format(module_name, pid))
-
+            logfile = config.datafilepath('logs', '{}-bot.log'
+                                          .format(module_name))
         file_handler = RotatingFileHandler(filename=logfile,
                                            maxBytes=1024 * config.logfilesize,
                                            backupCount=config.logfilecount,

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/694318
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Iae8311b0c3ec40acccb400a30f1de4efea1e37fc
Gerrit-Change-Number: 694318
Gerrit-PatchSet: 2
Gerrit-Owner: JJMC89 <[email protected]>
Gerrit-Reviewer: Bináris <[email protected]>
Gerrit-Reviewer: JAn Dudík <[email protected]>
Gerrit-Reviewer: JJMC89 <[email protected]>
Gerrit-Reviewer: Mpaa <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to