For privacy reasons, OS X does not allow third-party applications (such as TextExpander) to log keystrokes unless access for assistive devices is turned on.
In macOS 11.0 (Big Sur):
- Go to System Preferences -> Security & Privacy -> Privacy -> Accessibility -> TextExpander.