Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Invalid configuration file, using default options" -- should throw additional debugging information in logs #711

Closed
nitinmohan87 opened this issue Nov 21, 2013 · 5 comments

Comments

@nitinmohan87
Copy link
Contributor

When there is an error in the yard plugin the debug logs shows the following debug logs which is not quite informative.

> yardoc --plugin chef '.' --debug --backtrace
[error]: Invalid configuration file, using default options
[debug]: Parsing ["."] with `ruby` parser
...

This line could at least add the exception message (backtrace would also be great!)

def self.load
      self.options = SymbolHash.new(false)
      options.update(DEFAULT_CONFIG_OPTIONS)
      options.update(read_config_file)
      load_commandline_safemode
      add_ignored_plugins_file
      translate_plugin_names
      load_plugins
    rescue => e
      log.error "Invalid configuration file, using default options"
      log.error e.message
      log.error e.backtrace.inspect
      options.update(DEFAULT_CONFIG_OPTIONS)
    end

The log would look like this

> yardoc --plugin chef '.' --debug --backtrace
[error]: Invalid configuration file, using default options
[error]: undefined method `register' for class `YARD::CodeObjects::Chef::ChefObject'
@lsegal
Copy link
Owner

lsegal commented Nov 21, 2013

I would accept this as a patch assuming you changed those new lines to log.debug, not log.error. That way they would display with --debug mode.

@nitinmohan87
Copy link
Contributor Author

That makes sense. I will go ahead and submit the patch asap.

@lsegal
Copy link
Owner

lsegal commented Nov 21, 2013

Actually take a look at log.backtrace: http://rubydoc.org/gems/yard/YARD/Logger#backtrace-instance_method

@nitinmohan87
Copy link
Contributor Author

If I set log level to be :debug when using log.backtrace, the error messages do not get printed in the logs. I have to use either :error or :warn to actually print the logs.

@lsegal
Copy link
Owner

lsegal commented Nov 21, 2013

Using the default loglevel on backtrace would work because we have a separate "are backtraces on?" check for that one (--backtrace)

@lsegal lsegal closed this as completed in af95830 Nov 21, 2013
lsegal added a commit that referenced this issue Nov 21, 2013
…_plugins

Add debug information when loading plugin errors (Fixes #711)
lsegal added a commit that referenced this issue Mar 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants