-
Notifications
You must be signed in to change notification settings - Fork 253
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
abseil interferes with python logging #99
Comments
While this may not be the answer you want... they aren't lost, but anything below INFO is going to a log file by default with the absl logging handlers in place. Call That is merely a workaround to get your messages in the console output again. I assume you aren't looking to depend on absl from your own code directly, that could be written conditionally within your main code after imports have been done: # Work around TensorFlow's absl.logging depencency which alters the
# default Python logging output behavior when present.
if 'absl.logging' in sys.modules:
import absl.logging
absl.logging.set_stderrthreshold('info')
# and any other apis you want, if you want This is, for better or worse, currently working as intended, |
@gpshead Thanks for the quick reply! I tried the second workaround and that helped. For anyone else that has a similar situation, I also had to set the verbosity level:
+1 to your suggestion. I agree it would be nice to support use in libraries that may be used in code bases with existing logging mechanisms in place. |
@gpshead have you now given any thought to this issue that you called "obvious in hindsight"? As more and more Google-released libraries switched from not-abseil to abseil, this mucking with global state, removing existing logging handlers, overriding formats, etc. is getting really costly. For my team, it's Capirca that's biting us. See also #102. (cc: @tituswinters, if he's still leading Abseil) |
There's more to this in that library code often has no need to depend on absl.logging at all. I expect most library code can Regardless of that, getting all libraries using absl in the world to stop doing |
The key issue however is that neither importing nor using absl.logging
should reconfigure logging. I understand why Google internally configures
logging on import or use but this does not make sense in open source.
That should be moved to Google 3 main or whatever it's called.
…On Fri, May 10, 2019 at 16:35 Gregory P. Smith ***@***.***> wrote:
There's more to this in that library code often has no need to depend on
absl.logging at all. I expect most library code can import logging (the
stdlib library) and use that. (I'm assuming the function calls library code
*should* be making are the standard debug/info/warn/warning/error APIs)
Regardless of that, getting *all* libraries using absl in the world to
stop doing from absl import logging is probably intractable in the
shorter term. Making our absl.logging._initialize() call lazy so that it
is only ever done when first needed, or perhaps when explicitly desired
(ie: what app._run_init() does) would be helpful. Prior to
absl._initialize() the absl.logging functions should just be silent
redirects to the stdlib functions.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#99 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEAQT3DKKRTJYUP72OK7YDPUYBFXANCNFSM4HCKQSUQ>
.
|
One idea might make it better without affecting the existing user base too much.
At import time, instead of attaching the Then in So if a user only uses
For existing |
That's a bit of a mixed-world compromise. I suspect that libraries using absl.logging don't care about absl specific logging properties at all and are just using it because that is the standard style they've adopted our of habit rather than just Having logs go to potentially multiple different places in different formats based on which part of the code called the logging statement in a process could just make a different set of peoples lives messier and lead to questions about that being an undesired behavior people file an issue about. |
Is there any update on this? This is currently blocking updates to Tensorflow 1.14 and 2.0. |
Nobody is assigned to work on this so I don't recommend blocking on a resolution. |
What would you suggest people do?
|
Also, what's wrong with the "mixed-world compromise" proposed by @yilei? Seems fine to me. The alternative would be to provide a guide on "how to monkey-patch your codebase to fix a broken state caused by abseil logging", e.g. batfish/pybatfish#370. |
My earlier comment answered what was wrong with mixed-world. It is cleaner to have That should be less complicated, less surprising, and easier to support as an API. |
Another fix suggestion for those like me who are finding this bug via Google:
|
The newest version of abseil (https://github.com/abseil/abseil-py) apparently interferes with user logging implemented via import logging For details see abseil/abseil-py#99 This was observed when installing the ML package from scratch during the last week. Comparing TensorFlow versions it was observed that most people's ML package was still using TF version 1.13.1/2. Installing the package now leads to installing TF vesion 1.14 and hence a more recent version of abseil as well which causes the weird logging behaviour. A fix is possible thanks to abseil/abseil-py#99 (comment) As soon as this is fixed in abseil this will be propagated to the ML package.
The newest version of abseil (https://github.com/abseil/abseil-py) apparently interferes with user logging implemented via import logging For details see abseil/abseil-py#99 This was observed when installing the ML package from scratch during the last week. Comparing TensorFlow versions it was observed that most people's ML package was still using TF version 1.13.1/2. Installing the package now leads to installing TF vesion 1.14 and hence a more recent version of abseil as well which causes the weird logging behaviour. A fix is possible thanks to abseil/abseil-py#99 (comment) As soon as this is fixed in abseil this will be propagated to the ML package.
The newest version of abseil (https://github.com/abseil/abseil-py) apparently interferes with user logging implemented via import logging For details see abseil/abseil-py#99 This was observed when installing the ML package from scratch during the last week. Comparing TensorFlow versions it was observed that most people's ML package was still using TF version 1.13.1/2. Installing the package now leads to installing TF vesion 1.14 and hence a more recent version of abseil as well which causes the weird logging behaviour. A fix is possible thanks to abseil/abseil-py#99 (comment) As soon as this is fixed in abseil this will be propagated to the ML package.
The newest version of abseil (https://github.com/abseil/abseil-py) apparently interferes with user logging implemented via import logging For details see abseil/abseil-py#99 This was observed when installing the ML package from scratch during the last week. Comparing TensorFlow versions it was observed that most people's ML package was still using TF version 1.13.1/2. Installing the package now leads to installing TF vesion 1.14 and hence a more recent version of abseil as well which causes the weird logging behaviour. A fix is possible thanks to abseil/abseil-py#99 (comment) As soon as this is fixed in abseil this will be propagated to the ML package.
Tensorflow imports absl, and it breaks the standard logging module in python by setting a handler on the root-level logger. The result is that the log-level does not get set, and the format is all wrong. This patch introduces an ugly fix I found on the internet to handle it. Hopefully we can delete it in the future. References: tensorflow/tensorflow#29842 tensorflow/tensorflow#26691 abseil/abseil-py#99
Tensorflow imports absl, and it breaks the standard logging module in python by setting a handler on the root-level logger. The result is that the log-level does not get set, and the format is all wrong. This patch introduces an ugly fix I found on the internet to handle it. Hopefully we can delete it in the future. References: tensorflow/tensorflow#29842 tensorflow/tensorflow#26691 abseil/abseil-py#99
Tensorflow imports absl, and it breaks the standard logging module in python by setting a handler on the root-level logger. The result is that the log-level does not get set, and the format is all wrong. This patch introduces an ugly fix I found on the internet to handle it. Hopefully we can delete it in the future. References: tensorflow/tensorflow#29842 tensorflow/tensorflow#26691 abseil/abseil-py#99
Tensorflow imports absl, and it breaks the standard logging module in python by setting a handler on the root-level logger. The result is that the log-level does not get set, and the format is all wrong. This patch introduces an ugly fix I found on the internet to handle it. Hopefully we can delete it in the future. References: tensorflow/tensorflow#29842 tensorflow/tensorflow#26691 abseil/abseil-py#99
Is there any movement on this? This is a pretty huge bug to have... |
Tensorflow imports absl, and it breaks the standard logging module in python by setting a handler on the root-level logger. The result is that the log-level does not get set, and the format is all wrong. This patch introduces an ugly fix I found on the internet to handle it. Hopefully we can delete it in the future. References: tensorflow/tensorflow#29842 tensorflow/tensorflow#26691 abseil/abseil-py#99
Tensorflow imports absl, and it breaks the standard logging module in python by setting a handler on the root-level logger. The result is that the log-level does not get set, and the format is all wrong. This patch introduces an ugly fix I found on the internet to handle it. Hopefully we can delete it in the future. References: tensorflow/tensorflow#29842 tensorflow/tensorflow#26691 abseil/abseil-py#99
We have a fix and should be pushed out in a week or two. |
It doesn't seems to be an issue as long as we don't use the root logger. We define our logger like this in all our files:
And then set the propagate to False on the package level logger:
If that can helps someone. |
Changelog: ### Added * (testing) `absltest.expectedFailureIf`: a variant of `unittest.expectedFailure` that allows a condition to be given. ### Changed * (bazel) Tests now pass when bazel `--incompatible_allow_python_version_transitions=true` is set. * (bazel) Both Python 2 and Python 3 versions of tests are now created. To only run one major Python version, use `bazel test --test_tag_filters=-python[23]` to ignore the other version. * (testing) `assertTotallyOrdered` no longer requires objects to implement `__hash__`. * (testing) `absltest` now integrates better with `--pdb_post_mortem`. * (testing) `xml_reporter` now includes timestamps to testcases, test_suite, test_suites elements. ### Fixed * abseil#99: `absl.logging` no longer registers itself to `logging.root` at import time. * abseil#108: Tests now pass with Bazel 0.28.0 on macOS. PiperOrigin-RevId: 265519766 Change-Id: Ie80c838f2436cd0c7407f29ca29e74e0abe4c4da
Thanks so much for fixing this @yilei |
In the latest release of absl-py common library, Google fixed the logging mess. Force a minimum version of that library and remove the hack. abseil/abseil-py#99
In the latest release of absl-py common library, Google fixed the logging mess. Force a minimum version of that library and remove the hack. abseil/abseil-py#99
Fixed in abseil version 0.8.0: abseil/abseil-py#99
the absl workaround hasn't been needed since 2019-04 abseil/abseil-py#99 so it should be safe to remove it.
the absl workaround hasn't been needed since 2019-04 abseil/abseil-py#99 so it should be safe to remove it.
the absl workaround hasn't been needed since 2019-04 abseil/abseil-py#99 so it should be safe to remove it.
I have a script where I'm importing a module that internally uses abseil logging. The rest of our code base is using standard python logging. This is leading to a situation where importing that module is interfering with the rest of the code base using standard logging and causing lost log messages.
See here for a description of the issue: tensorflow/hub#263
Have others run into this issue before?
The text was updated successfully, but these errors were encountered: