Skip to content

Debug messages getting lost after adding seqlog #89

@webJose

Description

@webJose

Hello! First and foremost: This is a very nice project, so thank you very much for your efforts.

Second: I'm just starting to learn Python. As I learn this language, I would like to be able to do the things that I do in other languages, and one of those things is structured logging + Seq. This is why I arrived to this library.

Third: My "problem", and please don't stress too much as it is a minor thing, is that some logging has disappeared once I started using seqlog, and I don't know why.

My Logging Setup Before seqlog

logging.basicConfig(
    level=logging.DEBUG, 
    format="%(asctime)s - [%(name)s] [%(levelname)s]: %(message)s",
)
logging.Formatter.converter = time.gmtime  # Use GMT/UTC instead of local timezone

My Logging Setup With seqlog

# This is the Python logging schema version (currently, only the value 1 is supported here).
version: 1

# Configure logging from scratch.
disable_existing_loggers: False

# Configure the root logger to use Seq
root:
  level: DEBUG
  handlers:
    - seq
    - console

# You can also configure non-root loggers.
# loggers:
#   another_logger:
#     propagate: False
#     level: DEBUG
#     handlers:
#       - seq
#       - console

handlers:
  # Log to STDOUT
  console:
    class: seqlog.structured_logging.ConsoleStructuredLogHandler
    formatter: seq

  # Log to Seq
  seq:
    class: seqlog.structured_logging.SeqLogHandler
    formatter: seq
    server_url: "http://localhost:5341"

formatters:
  seq:
    style: "{"
    format: "{asctime} - [{name}] [{levelname}]: {message}"

This is basically the example found in the documentation. I just added the format to the formatter, and I have played around with the value of disable_existing_loggers to see if this was the culprit of the log entries disappearing.

Which Logging is Missing

The debug logging that happens when issuing an HTTP request using requests. I used to see 2 DEBUG lines from one request I make to the Github API, and after adding seqlog, those lines have disappeared.

As clarification, the lines themselves are not important. What's important to me here is to understand if I did something wrong. I'm trying to learn Python logging the right way, and the right way says that if I use logging.getLogger(__name__), I adhere to the standards, and that a consequence of this standard is that all libraries can participate, and that participation has apparently been affected by my addition of seqlog.

So please, take this as an "academic" issue. The package itself seems to be working just fine.

Oh, side question: Is it possible to configure the printing of asctime as UTC?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions