Giter Club home page Giter Club logo

le_python's People

Contributors

arthurprs avatar d-a-n avatar dat-boris avatar decoyfish avatar drgarcia1986 avatar eflanagan-r7 avatar gearoidof avatar graingert avatar marklc-r7 avatar nielsonsantana avatar qba73 avatar rsheng-r7 avatar rtrajano avatar siniar1990 avatar stephenhynes7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

le_python's Issues

ImportError: cannot import name LogentriesHandler

Hi,

I'm using Mac OS X 10.9.4 and Python 2.7.5

I have created my account on Logentries, and using the code generated by the app (with token), running the logging.py on the Terminal.

The installation:

$ sudo pip install logentries
Downloading/unpacking logentries
Downloading Logentries-0.2.1.tar.gz
Running setup.py egg_info for package logentries

Installing collected packages: logentries
Running setup.py install for logentries

Successfully installed logentries
Cleaning up...
$ sudo pip freeze | grep entries
LogentriesLogger==0.2.1

The snippet that I use:

!/usr/bin/env python

from logentries import LogentriesHandler
import logging
import time
log = logging.getLogger('logentries')
log.setLevel(logging.INFO)
test = LogentriesHandler('--- MY TOKEN ---')
log.addHandler(test)
log.warn("Warning message")
log.info("Info message")
time.sleep(10)

When run the snippet show this stack trace:

$ python logging.py
Traceback (most recent call last):
File "logging.py", line 3, in
from logentries import LogentriesHandler
File "/Library/Python/2.7/site-packages/logentries/init.py", line 1, in
from .utils import LogentriesHandler
File "/Library/Python/2.7/site-packages/logentries/utils.py", line 9, in
import logging
File "/Users/myuser/Desktop/logging.py", line 3, in
from logentries import LogentriesHandler

certifi package requirement messes up access to google storage via requests

In setup.py

install_requires=[
        "certifi",
    ],

This causes errors when using the requests library to access https://storage.googleapis.com

requests.exceptions.SSLError: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Even though not directly your bug, having this as a requirement in your setup messes up the environment so I think you should consider solving this as well.

Confirm support for Python 3

It looks like this library supports python 3, but I'm not 100% sure. If so, could you make it so that this tool doesn't report the library as blocking:
https://caniusepython3.com/project/Logentries

I think what you need to do is add classifiers to setup.py like this:
classifiers=[
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
]

UnicodeError exception on format

I get UnicodeError exception at some reports. An example exception:

  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1423, in log_
exception
    ), exc_info=exc_info)
  File "/usr/lib/python2.7/logging/__init__.py", line 1174, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1267, in _log
    self.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1277, in handle
    self.callHandlers(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1317, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 748, in handle
    self.emit(record)
  File "/usr/local/lib/python2.7/dist-packages/logentries/utils.py", line 124, i
n emit
    msg = self.format(record).rstrip('\n')
  File "/usr/lib/python2.7/logging/__init__.py", line 723, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

Failed to log in cx_Freeze frozen executables

logentries.utils.TLSSocketAppender use certifi.where() to locate root certifications, but certifi.where() doesn't know frozen environment and provided wrong certification path when running in frozen executables. This leads to continuously output of error LE: Unable to connect to Logentries.

Maybe le_python could provide a environment variable to override root certification path. At least that would allow applications to manually include necessary certifications and make them available to le_python.

Getting error while installing linux agent

I'm getting following error while installing linux agent

***** Step 2 of 3 - Login *****
Traceback (most recent call last):
  File "/usr/bin/le", line 8, in ?
    sys.exit(
  File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 236, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 2097, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 1830, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/share/logentries/logentries/le.py", line 2375
    return resp['host'] if resp['response'] == 'ok' else None
                         ^
SyntaxError: invalid syntax

logger thread dies when exception contains illegal characters.

We found this exception during testing:

Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/local/lib/python2.7/dist-packages/logentries/utils.py", line 96, in run
multiline = le_helpers.create_unicode(data).replace(
File "/usr/local/lib/python2.7/dist-packages/logentries/helpers.py", line 31, in create_unicode
return unicode(ch, 'utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0xf5 in position 716: invalid start byte
> python --version
Python 2.7.6

Since the worker thread dies, the whole application will suddenly stop working because of #48

RuntimeError Exception "threads can only be started once"

I created 2 handlers and two loggers using the logentries on my Django project.
When I start my celery worker, I geting RuntimeError "threads can only be started once".

I'm using:
django 1.5
celery 3.1.7

Track:

File "/home/user/.virtualenvs/celery3.1/local/lib/python2.7/site-packages/celery/worker/__init__.py", line 206, in start
  self.blueprint.start(self)
File "/home/user/.virtualenvs/celery3.1/local/lib/python2.7/site-packages/celery/bootsteps.py", line 123, in start
  step.start(parent)
File "/home/user/.virtualenvs/celery3.1/local/lib/python2.7/site-packages/celery/bootsteps.py", line 373, in start
  return self.obj.start()
File "/home/user/.virtualenvs/celery3.1/local/lib/python2.7/site-packages/celery/worker/consumer.py", line 270, in start
  blueprint.start(self)
File "/home/user/.virtualenvs/celery3.1/local/lib/python2.7/site-packages/celery/bootsteps.py", line 123, in start
  step.start(parent)
File "/home/user/.virtualenvs/celery3.1/local/lib/python2.7/site-packages/celery/worker/consumer.py", line 469, in start
  info('Connected to %s', c.connection.as_uri())
File "/usr/lib/python2.7/logging/__init__.py", line 1140, in info
  self._log(INFO, msg, args, **kwargs)
File "/usr/lib/python2.7/logging/__init__.py", line 1258, in _log
  self.handle(record)
File "/usr/lib/python2.7/logging/__init__.py", line 1268, in handle
  self.callHandlers(record)
File "/usr/lib/python2.7/logging/__init__.py", line 1308, in callHandlers
  hdlr.handle(record)
File "/usr/lib/python2.7/logging/__init__.py", line 748, in handle
  self.emit(record)
File "/home/user/Dropbox/workspace/paas/appfog/soar-site/logentries/utils.py", line 132, in emit
  self._thread.start()
File "/usr/lib/python2.7/threading.py", line 488, in start
  raise RuntimeError("threads can only be started once")
RuntimeError: threads can only be started once

error: can't start new thread

The logger.warning(e) happens in a loop and this can try to send a lot of logs.

Traceback:

File "[...]/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 114, in get_response 
response = wrapped_callback(request, *callback_args, **callback_kwargs) 

File "[...]/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view 
return self.dispatch(request, *args, **kwargs) 

File "[...]/local/lib/python2.7/site-packages/newrelic-2.40.0.34/newrelic/hooks/component_djangorestframework.py", line 8, in _nr_wrapper_APIView_dispatch_ 
return wrapped(*args, **kwargs) 

File "[...]/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 57, in wrapped_view 
return view_func(*args, **kwargs) 

File "[...]/local/lib/python2.7/site-packages/rest_framework/views.py", line 400, in dispatch 
response = self.handle_exception(exc) 

File "[...]/local/lib/python2.7/site-packages/rest_framework/views.py", line 397, in dispatch 
response = handler(request, *args, **kwargs) 

File "./api/views/filemanager.py", line 49, in get 
return Response(serializer.list_files_in_folder(path, images_only), 200) 

File "./api/serializers/filemanager.py", line 156, in list_files_in_folder 
logger.warning(e) 

File "/usr/lib/python2.7/logging/__init__.py", line 1152, in warning 
self._log(WARNING, msg, args, **kwargs) 

File "/usr/lib/python2.7/logging/__init__.py", line 1258, in _log 
self.handle(record) 

File "/usr/lib/python2.7/logging/__init__.py", line 1268, in handle 
self.callHandlers(record) 

File "/usr/lib/python2.7/logging/__init__.py", line 1308, in callHandlers 
hdlr.handle(record) 

File "/usr/lib/python2.7/logging/__init__.py", line 748, in handle 
self.emit(record) 

File "[...]/local/lib/python2.7/site-packages/logentries/utils.py", line 124, in emit 
self._thread.start() 

File "/usr/lib/python2.7/threading.py", line 494, in start 
_start_new_thread(self.__bootstrap, ()) 

error: can't start new thread 

out of the box version 1.7 is broken: use of tabs/whitespace error

Hello,
The lib installed by pip (1.7) is broken apparently, it fails with an error message saying inconsistent use of tabs and whitespace inside metrics.py file

However the git version does not seem to have this issue.

I had to do some very dirty workarounds to get it working in an automated way...

Could you please check what the problem is?

Regards.

SyntaxError

Also, the 0.5 package on pypi has broken our build, please fix ASAP.

On a fresh clone I get:

In [1]: import logentries
  File "logentries/utils.py", line 187
    finally:
          ^
SyntaxError: invalid syntax

Incompatibilty with gunicorn.

We have a web app using django and gunicorn, I don't appreciate how gunicorn handles its workers but after the recent changes we're getting:

2013-10-08 12:28:31 [ERROR] gunicorn.error: Error handling request
Traceback (most recent call last):
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/gunicorn/workers/async.py", line 55, in handle
    self.handle_error(req, client, addr, e)
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 177, in handle_error
    self.log.exception("Error handling request")
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/gunicorn/glogging.py", line 219, in exception
    self.error_log.exception(msg, *args)
  File "/usr/lib/python2.7/logging/__init__.py", line 1172, in exception
    self.error(msg, exc_info=1, *args)
  File "/usr/lib/python2.7/logging/__init__.py", line 1166, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1258, in _log
    self.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1268, in handle
    self.callHandlers(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1308, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 748, in handle
    self.emit(record)
  File "/home/ubuntu/venv/src/logentries/logentries/utils.py", line 122, in emit
    self._thread.start()
  File "/usr/lib/python2.7/threading.py", line 488, in start
    raise RuntimeError("threads can only be started once")
RuntimeError: threads can only be started once

If there's any further information I can provide that might help please let me know, also apologies if this is not an issue for le_python, however when we moved to commit 1726b2271b0fa6d9da4332e165f4ae394e4ffd47 it seems to have resolved the problem. We're using gunicorn 18.0, python 2.7, ubuntu, and we're monkey patching gunicorn. from gevent import monkey; monkey.patch_all(subprocess=False)

No package 0.2

Your documentation suggests to install version 0.2 but I kept getting this error below. I've already installed 0.2.1, but just wanted you to be aware. Thanks! Keep up the great work!

Command

pip install logentries==0.2

Result

Downloading/unpacking logentries==0.2
  Could not find a version that satisfies the requirement logentries==0.2 (from versions: 0.2.1)
Cleaning up...
No distributions matching the version for logentries==0.2

Logs

Downloading/unpacking logentries==0.2

  Getting page https://pypi.python.org/simple/logentries/
  URLs to search for versions for logentries==0.2:
  * https://pypi.python.org/simple/logentries/0.2
  * https://pypi.python.org/simple/logentries/
  Getting page https://pypi.python.org/simple/logentries/0.2
  Could not fetch URL https://pypi.python.org/simple/logentries/0.2: HTTP Error 404: Not Found
  Will skip URL https://pypi.python.org/simple/logentries/0.2 when looking for download links for logentries==0.2
  Analyzing links from page https://pypi.python.org/simple/logentries/
    Found link https://pypi.python.org/packages/source/L/Logentries/Logentries-0.2.1.tar.gz#md5=82a91dbd932a66d9c006659bf520bcd5 (from https://pypi.python.org/simple/logentries/), version: 0.2.1
  Ignoring link https://pypi.python.org/packages/source/L/Logentries/Logentries-0.2.1.tar.gz#md5=82a91dbd932a66d9c006659bf520bcd5 (from https://pypi.python.org/simple/logentries/), version 0.2.1 doesn't match ==0.2
  Could not find a version that satisfies the requirement logentries==0.2 (from versions: 0.2.1)

v0.16 on pypi broken for Windows

pip install logentries breaks on Windows. v0.15 installed fine for me, but installing v0.16 results in:

(.venv) C:\Work\external\le_python>python setup.py install
running install
running bdist_egg
error: error in 'egg_base' option: '/tmp' does not exist or is not a directory

License information is absent

setup.py point to LICENSE.txt file which is absent.
Please add information about license on which this code can be used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.