Show More
@@ -161,7 +161,12 b' class Application(SingletonConfigurable):' | |||||
161 | """ |
|
161 | """ | |
162 | self.log = logging.getLogger(self.__class__.__name__) |
|
162 | self.log = logging.getLogger(self.__class__.__name__) | |
163 | self.log.setLevel(self.log_level) |
|
163 | self.log.setLevel(self.log_level) | |
164 | self._log_handler = logging.StreamHandler() |
|
164 | if sys.executable.endswith('pythonw.exe'): | |
|
165 | # this should really go to a file, but file-logging is only | |||
|
166 | # hooked up in parallel applications | |||
|
167 | self._log_handler = logging.StreamHandler(open(os.devnull, 'w')) | |||
|
168 | else: | |||
|
169 | self._log_handler = logging.StreamHandler() | |||
165 | self._log_formatter = logging.Formatter("[%(name)s] %(message)s") |
|
170 | self._log_formatter = logging.Formatter("[%(name)s] %(message)s") | |
166 | self._log_handler.setFormatter(self._log_formatter) |
|
171 | self._log_handler.setFormatter(self._log_formatter) | |
167 | self.log.addHandler(self._log_handler) |
|
172 | self.log.addHandler(self._log_handler) |
@@ -166,18 +166,17 b' class KernelApp(BaseIPythonApplication):' | |||||
166 | """create our session object""" |
|
166 | """create our session object""" | |
167 | self.session = Session(config=self.config, username=u'kernel') |
|
167 | self.session = Session(config=self.config, username=u'kernel') | |
168 |
|
168 | |||
169 |
def init_ |
|
169 | def init_blackhole(self): | |
170 |
"""redirects stdout/stderr |
|
170 | """redirects stdout/stderr to devnull if necessary""" | |
171 | # Re-direct stdout/stderr, if necessary. |
|
|||
172 | if self.no_stdout or self.no_stderr: |
|
171 | if self.no_stdout or self.no_stderr: | |
173 | blackhole = file(os.devnull, 'w') |
|
172 | blackhole = file(os.devnull, 'w') | |
174 | if self.no_stdout: |
|
173 | if self.no_stdout: | |
175 | sys.stdout = sys.__stdout__ = blackhole |
|
174 | sys.stdout = sys.__stdout__ = blackhole | |
176 | if self.no_stderr: |
|
175 | if self.no_stderr: | |
177 | sys.stderr = sys.__stderr__ = blackhole |
|
176 | sys.stderr = sys.__stderr__ = blackhole | |
178 |
|
177 | |||
179 | # Redirect input streams and set a display hook. |
|
178 | def init_io(self): | |
180 |
|
179 | """Redirect input streams and set a display hook.""" | ||
181 | if self.outstream_class: |
|
180 | if self.outstream_class: | |
182 | outstream_factory = import_item(str(self.outstream_class)) |
|
181 | outstream_factory = import_item(str(self.outstream_class)) | |
183 | sys.stdout = outstream_factory(self.session, self.iopub_socket, u'stdout') |
|
182 | sys.stdout = outstream_factory(self.session, self.iopub_socket, u'stdout') | |
@@ -199,6 +198,7 b' class KernelApp(BaseIPythonApplication):' | |||||
199 |
|
198 | |||
200 | def initialize(self, argv=None): |
|
199 | def initialize(self, argv=None): | |
201 | super(KernelApp, self).initialize(argv) |
|
200 | super(KernelApp, self).initialize(argv) | |
|
201 | self.init_blackhole() | |||
202 | self.init_session() |
|
202 | self.init_session() | |
203 | self.init_poller() |
|
203 | self.init_poller() | |
204 | self.init_sockets() |
|
204 | self.init_sockets() |
General Comments 0
You need to be logged in to leave comments.
Login now