Sentry 是一個開源的實時錯誤報告工具,支持 web 前后端、移動應用以及游戲,支持 Python、OC、Java、Go、Node、Django、RoR 等主流編程語言和框架 ,還提供了 GitHub、Slack、Trello 等常見開發(fā)工具的集成。
10年積累的成都做網(wǎng)站、網(wǎng)站設計、外貿(mào)營銷網(wǎng)站建設經(jīng)驗,可以快速應對客戶對網(wǎng)站的新想法和需求。提供各種問題對應的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡服務。我雖然不認識你,你也不認識我。但先制作網(wǎng)站后付款的網(wǎng)站建設流程,更有稱多免費網(wǎng)站建設讓你可以放心的選擇與我們合作。
github地址
環(huán)境 | 說明 |
---|---|
ubuntu16.04 | ip: 10.211.55.14 |
sudo apt-get -y install postgresql postgresql-contrib
> sudo su
> su - postgres
> psql
輸入:
postgres =# \password #修改當前用戶密碼
Enter new password:
Enter it again:
postgres =# \q # 退出
運行exit離開postgres用戶
> sudo wget http://download.redis.io/releases/redis-3.2.6.tar.gz
> sudo tar -zxvf redis-3.2.6.tar.gz
> sudo cp -rf redis-3.2.6 /usr/local/redis
> cd /usr/local/redis
> sudo apt install gcc
> sudo make
> sudo make install
如果提示make test, 則輸入make test
運行redis-server 啟動redis
sudo apt install python-setuptools python-dev libxslt1-dev gcc libffi-dev libjpeg-dev libxml2-dev libxslt-dev libyaml-dev libpq-dev
下載get-pip.py
> wget "https://bootstrap.pypa.io/get-pip.py"
> sudo python get-pip.py
> pip install -U virtualenv
> sudo mkdir /var/www
> sudo chmod -R 777 /var/www
> cd /var/www/
> mkdir sentry
> cd sentry
> virtualenv venv
> source venv/bin/activate
> pip install -U sentry
> sentry
Usage: sentry [OPTIONS] COMMAND [ARGS]...
Sentry is cross-platform crash reporting built with love.
The configuration file is looked up in the `~/.sentry` config directory but this can
be overridden with the `SENTRY_CONF` environment variable or be explicitly provided
through the `--config` parameter.
Options:
--config PATH Path to configuration files.
--version Show the version and exit.
--help Show this message and exit.
Commands:
celery DEPRECATED see `sentry run` instead.
cleanup Delete a portion of trailing data based on...
config Manage runtime config options.
createuser Create a new user.
devserver Starts a lightweight web server for...
django Execute Django subcommands.
dsym Manage system symbols in Sentry.
export Exports core metadata for the Sentry...
files Manage files from filestore.
help Show this message and exit.
import Imports data from a Sentry export.
init Initialize new configuration directory.
plugins Manage Sentry plugins.
queues Manage Sentry queues.
repair Attempt to repair any invalid data.
run Run a service.
shell Run a Python interactive interpreter.
start DEPRECATED see `sentry run` instead.
tsdb Tools for interacting with the time series...
upgrade Perform any pending database migrations and...
sentry init 配置文件路徑
> sentry init /var/www/sentry/conf
打開/var/www/sentry/conf/sentry.conf.py
修改下面這段
DATABASES = {
'default': {
'ENGINE': 'sentry.db.postgres',
'NAME': 'sentry',
'USER': 'postgres',
'PASSWORD': '123123', # 剛才安裝完postgreSQL 后你設置的密碼
'HOST': '',
'PORT': '',
'AUTOCOMMIT': True,
'ATOMIC_REQUESTS': False,
}
}
> createdb -E utf-8 sentry
如果提示createdb: could not connect to database template1: FATAL: role "lin" does not exist
則切換到postgre用戶執(zhí)行
執(zhí)行
SENTRY_CONF=/var/www/sentry/conf/ sentry upgrade
如果提示OperationalError: FATAL: Peer authentication failed for user "postgres"
解決方案:
local all postgres peer
local all all peer
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
為
local all postgres md5
local all all peer
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
3. 重啟postgresql
sudo service postgresql restart
再次執(zhí)行
SENTRY_CONF=/var/www/sentry/conf/ sentry upgrade
如果提示`sentry.exceptions.InvalidConfiguration: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.`
解決方案:
1. 進入redis redis-cli
2. 執(zhí)行
config set stop-writes-on-bgsave-error no
再次執(zhí)行
再次執(zhí)行 SENTRY_CONF=/var/www/sentry/conf/ sentry upgrade
在這一步執(zhí)行完成后可能提示你是否要創(chuàng)建用戶,則按照要求創(chuàng)建用戶即可, 沒有提示的話執(zhí)行以下語句創(chuàng)建
SENTRY_CONF=/var/www/sentry/conf/ sentry createuser
## 五、運行服務
SENTRY_CONF=/var/www/sentry/conf/ sentry run web # 運行web服務
SENTRY_CONF=/var/www/sentry/conf/ sentry run worker # 運行日志搜集進程SENTRY_CONF=/var/www/sentry/conf/ sentry run cron # 啟動cron進程
<?php
require_once 'vendor/autoload.php';
Raven_Autoloader::register();
$client = new Raven_Client('http://f2c047b856bb41fcbf486f467b7fcf5b:aa2a33c7176d4c1fb86a3aa8cb4728aa@10.211.55.14:9000/1');
$error_handler = new Raven_ErrorHandler($client);
$error_handler->registerExceptionHandler();
$error_handler->registerErrorHandler();
$error_handler->registerShutdownFunction();
set_error_handler(array($error_handler, 'handleError'));
set_exception_handler(array($error_handler, 'handleException'));
$client->captureMessage("這里發(fā)生了一個錯誤");
$i = 1 / 0;
運行以后, 查看web端, 就會看到傳輸回來的錯誤了。
-----
![](/upload/otherpic60/29755.jpg)
網(wǎng)站欄目:sentry日志管理系統(tǒng)安裝以及使用教程
分享鏈接:http://bm7419.com/article32/jcigpc.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供、靜態(tài)網(wǎng)站、網(wǎng)站收錄、商城網(wǎng)站、網(wǎng)站設計、定制開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)