Remove illegal characters in loggercontext path, and trim to maximum filename length.