Git Product home page Git Product logo

Comments (11)

wjo1212 avatar wjo1212 commented on September 24, 2024

收到,我看下,谢谢

from aliyun-log-python-sdk.

wjo1212 avatar wjo1212 commented on September 24, 2024

@007gzs 目前添加了一个新的类UwsgiQueuedLogHandler以便解决线程进程模型问题. 不过这个类需要额外安装一个第三方库uwsgidecorators, SDK并没有默认安装.
https://aliyun-log-python-sdk.readthedocs.io/api.html#aliyun.log.UwsgiQueuedLogHandler

另外, 请注意, 目前添加了2个新功能, 可以在写Log的时候, 自动解析JSON和KV, 你可以参考如下文章简单配置即可:

from aliyun-log-python-sdk.

007gzs avatar 007gzs commented on September 24, 2024

不好意思,换工作了,新公司没用sls

from aliyun-log-python-sdk.

wjo1212 avatar wjo1212 commented on September 24, 2024

收到, 那我先关闭了.

from aliyun-log-python-sdk.

zhanghaofei avatar zhanghaofei commented on September 24, 2024

@wjo1212 启动无报错,但是日志发送不到阿里云

from aliyun-log-python-sdk.

wjo1212 avatar wjo1212 commented on September 24, 2024

@zhanghaofei 配置的AK和Endpoint以及当时的网络是OK的吗?可以先在同样环境下用一个普通程序验证一下?如果是对的,请问用的哪种uwsgi用的哪种环境部署和版本的(操作系统、Web服务器版本)?具体配置参数如何?对应的Python版本?
我这里重现一下,谢谢

from aliyun-log-python-sdk.

007gzs avatar 007gzs commented on September 24, 2024

我刚试了下,好像也不行。

log配置

        'alilog': {
            'level': 'DEBUG',
            # 'class': 'aliyun.log.logger_hanlder.UwsgiQueuedLogHandler',
            'class': 'aliyun.log.logger_hanlder.SimpleLogHandler',
            'end_point': local_settings.SLS_END_POINT,
            'access_key_id': local_settings.SLS_ACCESS_KEY_ID,
            'access_key': local_settings.SLS_ACCESS_KEY_SECRET,
            'project': local_settings.SLS_PROJECT,
            'log_store': local_settings.SLS_LOG_STORE,
        }
       'django.db': {
            'handlers': ['alilog', ],
            'level': 'DEBUG',
            'propagate': False,
        },

uwsgi配置

[uwsgi]
uwsgi-socket=:9090
env = IS_ADMIN=1
chdir=/opt/python/hb2c-django/
module=hb2c.wsgi:application
master=True
processes=4
harakiri=30
pidfile=/opt/config/uwsgi.pid
touch-reload=/opt/config/uwsgi.reload
vacuum=True
max-requests=1000
enable-threads=True
virtualenv = /virtualenv/hb2c
daemonize=/dev/null
#daemonize=/var/log/uwsgi.log
enable-threads=True
reload-on-rss=240
reload-mercy=60
max-worker-lifetime=3600
post-buffering=262144
post-buffering-bufsize=262144
http-socket=:9091
http-websockets=True
gevent=1000

依赖版本

aliyun-log-python-sdk==0.6.30.1
aliyun-python-sdk-core-v3==2.8.5
aliyun-python-sdk-dysmsapi==1.0.0
amqp==2.2.2
billiard==3.5.0.3
celery==4.1.0
certifi==2018.4.16
chardet==3.0.4
crcmod==1.7
diff-match-patch==20121119
Django==1.11.12
django-constance==2.2.0
django-grappelli==2.11.1
django-import-export==1.0.0
django-redis-cache==1.7.1
django-redis-sessions==0.6.1
django-restframework-apiview==1.2.21
djangorestframework==3.8.2
enum34==1.1.6
et-xmlfile==1.0.1
gevent==1.2.2
greenlet==0.4.13
hiredis==0.2.0
idna==2.6
jdcal==1.4
kombu==4.1.0
odfpy==1.3.6
openpyxl==2.5.2
optionaldict==0.1.1
oss2==2.4.0
Pillow==5.0.0
protobuf==3.5.2.post1
pycryptodome==3.5.1
PyMySQL==0.8.0
python-dateutil==2.7.3
pytz==2018.4
PyYAML==3.12
redis==2.10.6
requests==2.18.4
six==1.11.0
tablib==0.12.1
unicodecsv==0.14.1
urllib3==1.22
uWSGI==2.0.17
uwsgidecorators==1.1.0
vine==1.1.4
wechatpy==1.7.0
xlrd==1.1.0
xlwt==1.3.0
xmltodict==0.11.0

from aliyun-log-python-sdk.

007gzs avatar 007gzs commented on September 24, 2024

uwsgidecorators 里的 import uwsgi 是哪个依赖包啊,装了uWSGI,site-packages里没有 uwsgi

>>> import uwsgidecorators
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/virtualenv/hb2c/lib/python3.5/site-packages/uwsgidecorators.py", line 10, in <module>
    import uwsgi
ImportError: No module named 'uwsgi'

from aliyun-log-python-sdk.

zhanghaofei avatar zhanghaofei commented on September 24, 2024

今天来又试可以发送了,但是中间会又丢失日志,例如连续产生三条日志,日志文件中已经看到三条日志,但是阿里云只采集到了两条,少了一条,频繁出现

from aliyun-log-python-sdk.

wjo1212 avatar wjo1212 commented on September 24, 2024

收到,我看下,谢谢

from aliyun-log-python-sdk.

wjo1212 avatar wjo1212 commented on September 24, 2024

@zhanghaofei 不好意思,最近才恢复,看了下,似乎在未退出时并不会有数据丢失,主要是supervisor直接kill的时候,Handler无法捕获到退出信息,因此可能会丢失。目前改进了发送机制,最小100毫秒发送出去,因此丢失几率下降。后续可能会做一个简单的redo-log来放置丢失。
烦请试下最新master看看问题改进如何。后续CI过了,我会上传到PYPI

from aliyun-log-python-sdk.

Related Issues (20)

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.