Homebrew running service shows error, how to debug this?
-
31-05-2021 - |
Pregunta
When I run brew services list
one of my services state shows err
.
brew services restart elasticsearch@6
for example stops and restarts with no error output and shows:
brew services restart elasticsearch@6
Stopping `elasticsearch@6`... (might take a while)
==> Successfully stopped `elasticsearch@6` (label: homebrew.mxcl.elasticsearch@6)
==> Successfully started `elasticsearch@6` (label: homebrew.mxcl.elasticsearch@6)
But list still shows err. There's something wrong but Homebrew doesn't tell us what it is. How to fix this problem?
Solución
Look at the log file in /usr/local/var/log/elasticsearch.log
.
TL;DR
If you look at the formula definition with:
brew edit elasticsearch@6
You will find the content of the plist file used for this service, which define the output log as:
#{var}/log/elasticsearch.log
According to the documentation:
#var ⇒ Object
The directory where the formula's variable files should be installed. This directory is not inside the HOMEBREW_CELLAR so it persists across upgrades.
According to the source code:
def var
HOMEBREW_PREFIX/"var"
end
You can find the HOMEBREW_PREFIX
with:
brew --prefix
It is most likely /usr/local
. So you will find your log file in /usr/local/var/log/elasticsearch.log
.