-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce default internal logger #313
Conversation
Codecov Report
@@ Coverage Diff @@
## master #313 +/- ##
==========================================
- Coverage 80.77% 80.73% -0.05%
==========================================
Files 96 96
Lines 5624 5627 +3
==========================================
Hits 4543 4543
- Misses 826 829 +3
Partials 255 255
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels natural and code looks good.
- Is the log guaranteed to be flushed before the process exits?
- Any plans to promote 404s to apm-server to error? Had to turn on debug to find those.
case "stderr": | ||
logWriter = os.Stderr | ||
default: | ||
f, err := os.Create(fileStr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the right call
This is just meant for debugging, so I don't expect that's necessary. We'd have to either flush after every log message (maybe OK given the expected low volume, but preferable not to), or say flush when the tracer is closed. The user would then be responsible for closing the tracer before exiting the process. I'm going to leave this for now.
That would be sensible wouldn't it? I'll fix that before landing. |
Tracer is now initialized with an internal logger implementation if ELASTIC_APM_LOG_FILE is specified. Without setting this environment variable, logging is disabled as before. Setting ELASTIC_APM_LOG_FILE to stdout or stderr will cause logging to write to stdout/stderr respectively. Otherwise, specifying a file path will cause that file to be created/truncated and written to. By default, only errors will be logged. Setting ELASTIC_APM_LOG_LEVEL to "debug" will cause debug messages to be printed in addition.
Tracer is now initialized with an internal logger
implementation if ELASTIC_APM_LOG_FILE is specified.
Without setting this environment variable, logging
is disabled as before.
Setting ELASTIC_APM_LOG_FILE to stdout or stderr will
cause logging to write to stdout/stderr respectively.
Otherwise, specifying a file path will cause that file
to be created/truncated and written to.
By default, only errors will be logged. Setting
ELASTIC_APM_LOG_LEVEL to "debug" will cause debug
messages to be printed in addition.
Closes #278