Skip to content
This repository

make config-loading debug messages more explicit #703

Merged
merged 1 commit into from over 2 years ago

2 participants

Min RK Fernando Perez
Min RK
Owner

It was never clear in debug messages that the cwd is searched
for config files. This adjusts various debug messages during
config-file loading to make things more clear.

The following debug messages were added:

  • specify search-path at start of load-config routine
  • on success, full path of loaded config files
  • always note when config files are not found
Min RK make config-loading debug messages more explicit
It was never clear in debug messages that the cwd is searched
for config files.  This adjusts various debug messages during
config-file loading to make things more clear:

The following debug messages were added:
* specify search-path at start of load-config routine
* on success, full path of loaded config files
* always note when config files are not found
b9a348b
Fernando Perez
Owner
Fernando Perez
Owner
Min RK
Owner
Fernando Perez
Owner

Great, then merge away!

Fernando Perez fperez merged commit fbc50c4 into from August 15, 2011
Fernando Perez fperez closed this August 15, 2011
Fernando Perez fperez referenced this pull request from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 15, 2011
Min RK make config-loading debug messages more explicit
It was never clear in debug messages that the cwd is searched
for config files.  This adjusts various debug messages during
config-file loading to make things more clear:

The following debug messages were added:
* specify search-path at start of load-config routine
* on success, full path of loaded config files
* always note when config files are not found
b9a348b
This page is out of date. Refresh to see the latest.
8  IPython/config/application.py
@@ -373,10 +373,14 @@ def load_config_file(self, filename, path=None):
373 373
             # problem with the file (probably doesn't exist), raise
374 374
             raise
375 375
         except Exception:
  376
+            # try to get the full filename, but it will be empty in the
  377
+            # unlikely event that the error raised before filefind finished
  378
+            filename = loader.full_filename or filename
376 379
             # problem while running the file
377  
-            self.log.error("Exception while loading config file %s [path=%s]"%
378  
-                            (filename, path), exc_info=True)
  380
+            self.log.error("Exception while loading config file %s",
  381
+                            filename, exc_info=True)
379 382
         else:
  383
+            self.log.debug("Loaded config file: %s", loader.full_filename)
380 384
             self.update_config(config)
381 385
     
382 386
     def generate_config_file(self):
8  IPython/core/application.py
@@ -172,6 +172,7 @@ def load_config_file(self, suppress_errors=True):
172 172
         printed on screen. For testing, the suppress_errors option is set
173 173
         to False, so errors will make tests fail.
174 174
         """
  175
+        self.log.debug("Searching path %s for config files", self.config_file_paths)
175 176
         base_config = 'ipython_config.py'
176 177
         self.log.debug("Attempting to load config file: %s" %
177 178
                        base_config)
@@ -183,6 +184,7 @@ def load_config_file(self, suppress_errors=True):
183 184
             )
184 185
         except IOError:
185 186
             # ignore errors loading parent
  187
+            self.log.debug("Config file %s not found", base_config)
186 188
             pass
187 189
         if self.config_file_name == base_config:
188 190
             # don't load secondary config
@@ -198,8 +200,10 @@ def load_config_file(self, suppress_errors=True):
198 200
         except IOError:
199 201
             # Only warn if the default config file was NOT being used.
200 202
             if self.config_file_specified:
201  
-                self.log.warn("Config file not found, skipping: %s" %
202  
-                               self.config_file_name)
  203
+                msg = self.log.warn
  204
+            else:
  205
+                msg = self.log.debug
  206
+            msg("Config file not found, skipping: %s", self.config_file_name)
203 207
         except:
204 208
             # For testing purposes.
205 209
             if not suppress_errors:
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.