logger-py | Bunyan like logger for python
kandi X-RAY | logger-py Summary
kandi X-RAY | logger-py Summary
Bunyan like logger for python
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Format a log record
- Return a formatted time string
- Return the app name and version
- Extract the name from the command line arguments
- Extra serializer
- Serialize an error
logger-py Key Features
logger-py Examples and Code Snippets
Community Discussions
Trending Discussions on logger-py
QUESTION
I've been using Stackdriver Logging for a long time and now I'd like to also take advantage of Error Reporting. I'd prefer to use Python's logging mechanism and scrape exceptions out of a log file if possible (for various reasons) rather than using the error_reporting library. That being said, the documentation is very confusing. For example the documentation says: https://cloud.google.com/error-reporting/docs/setup/compute-engine#log_exceptions
First, install the fluent-logger-python library:
sudo pip install google-cloud-error-reporting --upgrade
which leads me to believe that google-cloud-error-reporting is a fork of or related to fluent-logger-python however, when I initialize google-cloud-error-reporting it directly calls out to the GCE metadata server rather than connecting to the local fluentd. Are these two unrelated packages or is the documentation wrong or misleading? If I send JSON formatted exceptions to fluentd or to a log file monitored by fluentd will error reporting understand them?
Thanks for any clarifications
...ANSWER
Answered 2017-Sep-06 at 22:20The documentation is wrong.
TL;DR You have to output something that looks like https://cloud.google.com/error-reporting/docs/formatting-error-messages
Here's my solution:
QUESTION
I am going through the code of python logging module both in Python2(2.7.12 default on Ubuntu 16.04) and Pyton 3.5 (3.5.2 default on Ubuntu 16.04).
The question is - if we look at the implementation of def _log
that eventually calls self.handle
, the check about self.disabled
is done actually made in the handle
method, but it's not done in the _log
method.
Agree, checking it again in self.handle
might make sense, but why not check it first thing in self._log
or even better in self.isEnabledFor
that avoids doing a lot of work that is done in self._log
method.
What is it that I am missing?
Update: Did some profiling when logger is disabled - The code is in the following gist.
Following gists have the actual cprofile data indicating performance impact when the logger is disabled and when the logger is enabled.
It appears, there's considerable performance impact when the logger is disabled.
May be it is worth considering?
...ANSWER
Answered 2018-Jun-02 at 01:52This indeed was an issue and is fixed now -
https://github.com/python/cpython/commit/6e3ca645e71dd021fead5a70dc06d9b663612e3a
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install logger-py
You can use logger-py like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page