the big "case mismatch" fix

As discussed extensively, this set of changes (mostly from RJBS and DAGOLDEN) make permissions case-preserving & case-insensitive.

Also included is Jason May's refactoring of the logging code to make it easier to override logging for testing and other purposes.  I plan to build on those changes later to quiet down logging in testing, etc.