Fixed some small memory leaks in logging if files unwriteable
If the variable logfilter is set it names a filter. Any messages
matching this filter are logged. This is an independent
mechanism from the other logging variables. If you want to
control all logging with logfilter the other variables must be
set to their default (off) settings. [BZ 37]
Relatively substantial changes made under the hood to support
filter logging. Now have more consistent interfaces to
creating messages etc. Still needs more work though.