-
Notifications
You must be signed in to change notification settings - Fork 91
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
Fails to log silently with specific extra field #85
Comments
Do you know why this happens? |
I'm currently working on another refactoring build nklapste#3 and have worked into testing this issue. I was unable to create this issue/failure with my tests: #!/usr/bin/python
# -*- coding: utf-8 -*-
"""pytests for addressing potential issues with adding an ``status`` extra
field withing a given log and having the log failing to appear within graylog.
Related issue:
- Fails to log silently with specific extra field #85
URL:
- https://github.com/severb/graypy/issues/85
"""
import pytest
from tests.integration import LOCAL_GRAYLOG_UP
from tests.integration.helper import get_unique_message, get_graylog_response
from tests.helper import handler, logger
@pytest.mark.skipif(not LOCAL_GRAYLOG_UP,
reason="local graylog instance not up")
def test_non_status_field_log(logger):
message = get_unique_message()
logger.error(message, extra={"foo": "bar"})
graylog_response = get_graylog_response(message, fields=["foo"])
assert message == graylog_response["message"]
assert "bar" == graylog_response["foo"]
@pytest.mark.skipif(not LOCAL_GRAYLOG_UP,
reason="local graylog instance not up")
def test_status_field_issue(logger):
message = get_unique_message()
logger.error(message, extra={"status": "OK"})
graylog_response = get_graylog_response(message, fields=["status"])
assert message == graylog_response["message"]
assert "OK" == graylog_response["status"]
@pytest.mark.skipif(not LOCAL_GRAYLOG_UP,
reason="local graylog instance not up")
def test_status_field_issue_multi(logger):
message = get_unique_message()
logger.error(message, extra={"foo": "bar", "status": "OK"})
graylog_response = get_graylog_response(message, fields=["foo", "status"])
assert message == graylog_response["message"]
assert "bar" == graylog_response["foo"]
assert "OK" == graylog_response["status"] Note: these tests are logging to a active graylog docker container. Possibly when this branch gets finished and (hopefully) merged. This issue will likely be resolved. |
@gnudiff does this issue persist with graypy version 1.1.X+? Currently the implemented test cases in https://github.com/severb/graypy/blob/master/tests/integration/test_status_issue.py seem to validate this issue as resolved as of version 1.1.X+. |
If I add extra field named 'status' to the extra fields dict when logging, graypy will drop the message without any error (nothing gets logged).
Example:
The text was updated successfully, but these errors were encountered: