google / glog

C++ implementation of the Google logging module
http://google.github.io/glog/
BSD 3-Clause "New" or "Revised" License
6.93k stars 2.05k forks source link

Log output inconsistent with other glog implementations #1108

Closed gnoack closed 3 weeks ago

gnoack commented 1 month ago

In https://github.com/google/glog/pull/530, the open source C++ glog package has switched its output format to include the year information on every line. While this is a useful feature in itself, it is now inconsistent with other implementations of glog-style output.

C++ glog is not the only library implementing this log format -- to get an impression of how widespread the format is, look for the phrase Log lines have this form:, which was copied around a few times as the informal spec:

https://github.com/search?q=%22Log+lines+have+this+form%3A%22&type=code

In particular, the Abseil.io implementation also writes the format without years:

https://github.com/abseil/abseil-cpp/blob/69195d5bd2416a7224416887c78353ee8edf67ee/absl/log/internal/log_format.cc#L175

What is the plan here?

sergiud commented 1 month ago

The plan for exactly what? I do not understand what are you asking. Note that glog does not claim to provide (strict) compatibility to other libraries.

gnoack commented 1 month ago

Thank you for your answer!

The name "glog" made the impression to me that this was the C++ implementation of the "Google" log output format, as it is also implemented by the same-named implementation in Go^1, and in line with the Abseil.io logging implementation[^2]. (There is also one in Python[^3], but it is not a Google-released library.)

Spoken in practical terms, that means that the log files are created per program run (solving some aspects of log rotation), have a specific schema for their file name, and the log line format is standardized.

It is a surprise to me that you are not targeting compatibility with that, given that the library is hosted as "google/glog" on Github -- maybe this would be worth clarifying better in the README, possibly in coordination with the Abseil team, so that new users understand the differences better?

[^2]: from https://abseil.io/about/:

Abseil is an open source collection of C++ libraries drawn from the most fundamental pieces of Google’s internal codebase. These libraries are the nuts-and-bolts that underpin almost everything Google runs.

sergiud commented 1 month ago

You are correct that google/glog indeed hosts the original implementation of glog now maintained by community. AFAIK Google abandoned the project in favor of logging implementation in Abseil. The log format, however, was never standardized or at least I'm not aware of such undertaking, which is why it was extended in glog over time to better fit the users' needs. I also believe it is very clear that Abseil log and glog are two different and independent projects (the former being a fork of the latter) and they will further diverge over time.

It is important to note that users can write their own prefix formatters in glog and restore the "original" prefix if necessary.

Given these circumstances, I'm not sure what exactly needs to be clarified. In case you have a specific idea in mind, you are welcome to submit a PR with corresponding changes.

sergiud commented 3 weeks ago

I'll close the issue since glog works as documented.