Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Logging failing after a while

Hi,

I have a program that if I run multiple times inside the cloud sage worksheet, after a while (3-4 runs) gets a strange KeyboardInterrupt error.

Do you know what it is

Here is the code to reproduce the problem:

import logging
import logging.config
import logging.handlers

import sys

# Set logging facilities
#
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
loggingStreamHandler = logging.StreamHandler(sys.stdout)
loggingStreamHandler.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s --- %(message)s'))
logger.addHandler(loggingStreamHandler)

for i in range(100):
    logger.info ("Ciaooooooo: %s", 1000)

logger.info ("End: %s", 1000)

2016-06-09 14:06:18,765 - INFO --- Ciaooooooo: 1000
2016-06-09 14:06:18,766 - INFO --- Ciaooooooo: 1000
2016-06-09 14:06:18,767 - INFO --- Ciaooooooo: 1000
2016-06-09 14:06:18,767 - INFO --- Ciaooooooo: 1000
2016-06-09 14:06:18,768 - INFO --- Ciaooooooo: 1000
Error in lines 12-13
Traceback (most recent call last):
  File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute
    exec compile(block+'\n', '', 'single') in namespace, locals
  File "", line 2, in <module>
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 1165, in info
    self._log(INFO, msg, args, **kwargs)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 1284, in _log
    self.handle(record)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 1294, in handle
    self.callHandlers(record)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 1334, in callHandlers
    hdlr.handle(record)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 757, in handle
    self.emit(record)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 883, in emit
    self.flush()
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 843, in flush
    self.stream.flush()
  File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 369, in flush
    self._f(self._buf, done=done)
  File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1016, in stdout
    self._send_output(stdout=stdout, done=done, id=self._id, once=once)
  File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 529, in _send_output
    raise KeyboardInterrupt
KeyboardInterrupt
    ​

Logging failing after a while

Hi,

I have a program that if I run multiple times inside the cloud sage worksheet, after a while (3-4 runs) gets a strange KeyboardInterrupt error.

Do you know what it is

Here is the code to reproduce the problem:

import logging
import logging.config
import logging.handlers

import sys

# Set logging facilities
#
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
loggingStreamHandler = logging.StreamHandler(sys.stdout)
loggingStreamHandler.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s --- %(message)s'))
logger.addHandler(loggingStreamHandler)

for i in range(100):
    logger.info ("Ciaooooooo: %s", 1000)

logger.info ("End: %s", 1000)

2016-06-09 14:06:18,765 - INFO --- Ciaooooooo: 1000
2016-06-09 14:06:18,766 - INFO --- Ciaooooooo: 1000
2016-06-09 14:06:18,767 - INFO --- Ciaooooooo: 1000
2016-06-09 14:06:18,767 - INFO --- Ciaooooooo: 1000
2016-06-09 14:06:18,768 - INFO --- Ciaooooooo: 1000
Error in lines 12-13
Traceback (most recent call last):
  File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute
    exec compile(block+'\n', '', 'single') in namespace, locals
  File "", line 2, in <module>
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 1165, in info
    self._log(INFO, msg, args, **kwargs)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 1284, in _log
    self.handle(record)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 1294, in handle
    self.callHandlers(record)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 1334, in callHandlers
    hdlr.handle(record)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 757, in handle
    self.emit(record)
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 883, in emit
    self.flush()
  File "/projects/sage/sage-6.10/local/lib/python/logging/__init__.py", line 843, in flush
    self.stream.flush()
  File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 369, in flush
    self._f(self._buf, done=done)
  File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1016, in stdout
    self._send_output(stdout=stdout, done=done, id=self._id, once=once)
  File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 529, in _send_output
    raise KeyboardInterrupt
KeyboardInterrupt
    ​