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

Logger doesn't clear cached NullLoggers #516

Closed
ferventcoder opened this issue Dec 23, 2015 · 1 comment
Closed

Logger doesn't clear cached NullLoggers #516

ferventcoder opened this issue Dec 23, 2015 · 1 comment

Comments

@ferventcoder
Copy link
Member

NOTE: This is mostly an internal issue that doesn't affect users of choco.exe, but it may affect users of the API.

If you use Log() and then later initialize a different log type (such as changing NullLogger to Log4Net), any existing instances of a Logger for a particular object will continue to use NullLogger. This is because the types are cached and then reused. When Initializing the log type, one should also make sure the cache of loggers is cleared.

This mostly affects the specs and is the source of the failing AppVeyor builds.

@ferventcoder ferventcoder self-assigned this Dec 23, 2015
@ferventcoder ferventcoder added this to the 0.9.10 milestone Dec 23, 2015
@ferventcoder ferventcoder changed the title Specs - Logger doesn't clear cached NullLoggers Logger doesn't clear cached NullLoggers Dec 23, 2015
ferventcoder added a commit to ferventcoder/choco that referenced this issue Dec 23, 2015
This mostly affects the specs - if you use the loggers and then later
initialize them with a logger, the already initialized loggers will
still use the NullLogger because they were not cleared.

This could also lead to some very interesting behavior when using the
dll version of Chocolatey.
ferventcoder added a commit that referenced this issue Dec 23, 2015
* stable:
  (maint) formatting
  (spec) Ensure MockLogger is setup first in test suite
  (specs) Allow for nupkgs to finish copying
  (specs) use deep copy for config
  (GH-516) Fix: Log.InitializeWith doesn't clear cached loggers
  (GH-445) Only fail scripts on non-zero exit code
  (GH-510) allow silentargs in template
@ferventcoder
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants