Patch for LOGBACK-815, LOGBACK-816

As requested, pull request for the changes suggested by LOGBACK-815, LOGBACK-816.