Repository: DataBiosphere/toil

Issue:
Log level must be explicitly set for RealtimeLogger to work
I have logging statements in my user code that log through the Toil RealtimeLogger. However, the RealtimeLogger doesn't get initialized unless I specify one of the Toil log level options (--logInfo, --logWarning, etc.). Without those I just get a message that it is disabled, even when I pass --realTimeLogging.

Instead, the real time logger should be enabled with the default log level if --realTimeLogging alone is passed.
Log level must be explicitly set for RealtimeLogger to work
I have logging statements in my user code that log through the Toil RealtimeLogger. However, the RealtimeLogger doesn't get initialized unless I specify one of the Toil log level options (--logInfo, --logWarning, etc.). Without those I just get a message that it is disabled, even when I pass --realTimeLogging.

Instead, the real time logger should be enabled with the default log level if --realTimeLogging alone is passed.


Discussion:
You might want to file the last paragraph as a separate issue.

I've just discovered this issue again, in my pursuit of #1818, and was about to report it again.

```
[anovak@kolossus test]$ ./test_workflow.py --help 2>&1 | grep realTimeLogging
                        [--writeLogsGzip [WRITELOGSGZIP]] [--realTimeLogging]
  --realTimeLogging     Enable real-time logging from workers to masters
[anovak@kolossus test]$ ./test_workflow.py tree --realTimeLogging 2>&1 | grep toil.realtimeLogger
kolossus 2017-08-15 11:12:42,966 MainThread INFO toil.realtimeLogger: Real-time logging disabled
[anovak@kolossus test]$ 
```
You might want to file the last paragraph as a separate issue.

I've just discovered this issue again, in my pursuit of #1818, and was about to report it again.

```
[anovak@kolossus test]$ ./test_workflow.py --help 2>&1 | grep realTimeLogging
                        [--writeLogsGzip [WRITELOGSGZIP]] [--realTimeLogging]
  --realTimeLogging     Enable real-time logging from workers to masters
[anovak@kolossus test]$ ./test_workflow.py tree --realTimeLogging 2>&1 | grep toil.realtimeLogger
kolossus 2017-08-15 11:12:42,966 MainThread INFO toil.realtimeLogger: Real-time logging disabled
[anovak@kolossus test]$ 
```

Resolving patch:
diff --git a/src/toil/lib/bioio.py b/src/toil/lib/bioio.py
--- a/src/toil/lib/bioio.py
+++ b/src/toil/lib/bioio.py
@@ -124,12 +124,15 @@ def _addLoggingOptions(addOptionFn):
     # BEFORE YOU ADD OR REMOVE OPTIONS TO THIS FUNCTION, KNOW THAT YOU MAY ONLY USE VARIABLES ACCEPTED BY BOTH
     # optparse AND argparse FOR EXAMPLE, YOU MAY NOT USE default=%default OR default=%(default)s
     defaultLogLevelName = logging.getLevelName( defaultLogLevel )
-    addOptionFn("--logOff", dest="logCritical", action="store_true", default=False,
+    addOptionFn("--logOff", dest="logLevel",
+                default=defaultLogLevelName,
+                action="store_const", const="CRITICAL",
                 help="Same as --logCritical")
     for level in supportedLogLevels:
         levelName = logging.getLevelName(level)
         levelNameCapitalized = levelName.capitalize()
         addOptionFn("--log" + levelNameCapitalized, dest="logLevel",
+                    default=defaultLogLevelName,
                     action="store_const", const=levelName,
                     help="Turn on logging at level %s and above. (default is %s)" % (levelName, defaultLogLevelName))
     addOptionFn("--logLevel", dest="logLevel", default=defaultLogLevelName,


Test patch: