# Sentry Integration

**URL:** https://discuss.tryton.org/t/sentry-integration/6575
**Category:** System Administrator
**Created:** [October 10, 2023, 7:07am UTC](https://discuss.tryton.org/t/sentry-integration/6575 "2023-10-10T07:07:17Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Xavi](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/x/8e8cbc/32.png) [@Xavi](https://discuss.tryton.org/u/Xavi)
#### Post date: [October 10, 2023, 7:07am UTC](https://discuss.tryton.org/t/sentry-integration/6575/1 "2023-10-10T07:07:18Z")

</div>

Im trying to integrate sentry in tryton, but when I start the service with `trytond --logconf trytond-logconf.cfg` as says in: [sentry-tryton · PyPI](https://pypi.org/project/sentry-tryton/) I have the following problem:

```auto
ERROR:tryton.common.common:Traceback (most recent call last):
  File "/home/user/.local/lib/python3.10/site-packages/tryton/gui/main.py", line 249, in do_activate
    common.Login()
  File "/home/user/.local/lib/python3.10/site-packages/tryton/common/common.py", line 978, in __init__
    func(parameters)
  File "/home/user/.local/lib/python3.10/site-packages/tryton/rpc.py", line 85, in login
    result = connection.common.db.login(username, parameters, language)
  File "/usr/lib/python3.10/xmlrpc/client.py", line 1122, in __call__
    return self.__send(self.__name, args)
  File "/home/user/.local/lib/python3.10/site-packages/tryton/jsonrpc.py", line 296, in __request
    raise Fault(*response['error'])
tryton.jsonrpc.Fault: Database '/home/user/db/mydatabase.sqlite' doesn't exist!

Fault: Database '/home/user/db/mydatabase.sqlite' doesn't exist!

```

Usually I start the service by calling the `trytond.conf` file:

```auto
[database]
uri = postgresql://tryton:tryton@localhost:5432/mydatabase
[web]
root = /home/user/repository/sao/
listen = 0.0.0.0:8000
hostname = localhost:8000

```

And now as I dont specify this file tryton is looking for a sqlite database for default,  
So, how could I start tryton calling both files? or how could I tell tryton which is my database in `trytond-logconf.cfg`?  
I already tried to call `trytond-logconf.cfg` in `trytond.conf` with something like this:

```auto
[logconf]
#File where the server print logs
logconf = /home/user/repository/trytond-logconf.cfg

```

But it doesn’t work.  
Thanks.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [October 10, 2023, 7:09am UTC](https://discuss.tryton.org/t/sentry-integration/6575/2 "2023-10-10T07:09:47Z")

</div>

> [@Xavi](#):
>
> So, how could I start tryton calling both files? or how could I tell tryton which is my database in `trytond-logconf.cfg`?

You must start tryton with both options: `trytond -c trytond.conf --logconf trytond-logconf.cfg`

---

<div class="post-metadata">

### Author: ![Xavi](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/x/8e8cbc/32.png) [@Xavi](https://discuss.tryton.org/u/Xavi)
#### Post date: [October 10, 2023, 7:14am UTC](https://discuss.tryton.org/t/sentry-integration/6575/3 "2023-10-10T07:14:47Z")

</div>

I already tried but it looks like this:

 ![image](https://discuss-cdn.tryton.org/uploads/default/original/2X/7/767321b3fd91e3b0a191051e139514f24ebc16af.png)  
I have no database if I try to start tryton this way.  
Console:

```auto
Traceback (most recent call last):
  File "/home/user/repository/trytond/trytond/wsgi.py", line 118, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/home/user/repository/trytond/trytond/protocols/dispatcher.py", line 86, in root
    return methods[request.rpc_method](request, *request.rpc_params)
  File "/home/user/repository/trytond/trytond/protocols/dispatcher.py", line 107, in db_list
    with Transaction().start(
  File "/home/user/repository/trytond/trytond/transaction.py", line 105, in start
    database = backend.Database().connect()
  File "/home/user/repository/trytond/trytond/backend/sqlite/database.py", line 350, in connect
    self._conn = sqlite.connect(
sqlite3.OperationalError: unable to open database file

```

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [October 10, 2023, 7:27am UTC](https://discuss.tryton.org/t/sentry-integration/6575/4 "2023-10-10T07:27:19Z")

</div>

It still use the default sqlite backend. So I guess the `trytond.cfg` file is not loaded (should see in the log which configuration files are loaded). This may be because the path is wrong or the syntax is wrong.

---

<div class="post-metadata">

### Author: ![Xavi](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/x/8e8cbc/32.png) [@Xavi](https://discuss.tryton.org/u/Xavi)
#### Post date: [October 10, 2023, 7:38am UTC](https://discuss.tryton.org/t/sentry-integration/6575/5 "2023-10-10T07:38:13Z")

</div>

trytond.conf is fine as I can start tryton with `trytond -c trytond.conf` and it works fine, but when I add `--logconf` option, it becomes the only loaded file:  
`236825 140276763607488 [2023-10-10 07:31:10,284] INFO server using /home/user/repository/trytond-logconf.cfg as logging configuration file`  
Im also using tryton 6.0 I dont know if it matters.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [October 10, 2023, 7:52am UTC](https://discuss.tryton.org/t/sentry-integration/6575/6 "2023-10-10T07:52:33Z")

</div>

So I think there is a problem in `sentry_tryton` package.  
I see that it is importing the `trytond.backend` at the start so probably the module is loaded before the tryton configuration is activated so it sets to the default backend to SQLite (even if the configuration is loaded later).
