Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry alternative ? #43

Open
asmodehn opened this issue Jul 4, 2019 · 5 comments
Open

Sentry alternative ? #43

asmodehn opened this issue Jul 4, 2019 · 5 comments

Comments

@asmodehn
Copy link
Contributor

asmodehn commented Jul 4, 2019

I am having issues setting up sentry (python envs, permission, postgres setup, etc.).
While I can eventually solve that, is there another possibility to store all logs, but maybe with a simpler, quicker setup ?
Like everything in a text file or something?
I m looking for a simple solution to start leaving gryphon running for some time without always having to watch the terminal... but I probably don't need the whole sentry heavyweight...
Thanks !

@garethdmm
Copy link
Owner

I don't think I understand exactly the problem you're trying to fix. Watching the log output over long executions isn't usually the best way to go back and see the recent history, I'd use the strategy dashboard for that. Sentry and papertrail are useful to have around for debugging, if, e.g. your strategy had a failure at 3am and you want to go back and capture the exact log output that occurred just beforehand.

If you want to leave gryphon running for a while without leaving a terminal open you could use screen (manual page). I think you'll still have to leave your computer awake but otherwise this might satisfy your short term goal.

start screen: screen
leave screen: ctrl-a d
re-open screen: screen -DR

@asmodehn
Copy link
Contributor Author

asmodehn commented Jul 7, 2019

I am actually trying to NOT have a terminal open to see what happened with my strategy at 3am.
Sentry setup has been painful (I hit a bunch of issues and the fix is not always obvious) that I eventually gave up (for now at least).
I would appreciate if my log doesn't go travel around the web, and I would prefer to not depend on proprietary software/format/structure to host this kind of critical knowledge.

So I was wondering if there was a way to use some simple, text based, logging framework.
For example, what do I need to do if I just want my strategy log into my local syslog ?

This could be a setup easy to do for newcomers... better than watching the terminal and simple than setting up an external centralize logging service. What do you think ?

@garethdmm
Copy link
Owner

garethdmm commented Jul 7, 2019

It's a good feature idea to have a local log being written. I'm sure that wouldn't be hard to do. I get the concerns with sentry re: setup issues and also security. I haven't set it up myself in a while.

For some reason I'm still not quite sure why you're trying to avoid the terminal in that 3am-issue scenario. Presumably you'd have to open it anyway if you're going in to debug an issue? Maybe you could message me on the slack and we could chat about it.

In the meantime do you think you could do what you're trying to do with simple unix commands? Something like gryphon-exec strategy strategy.py > strategy.log or something like that? That would send all the console output to a file. If you wanted to keep the execution visible in your terminal you could then use tail -f strategy.log, and use something similar to look at the most recent issues

@asmodehn
Copy link
Contributor Author

asmodehn commented Jul 8, 2019

Actually I think I ll try to come up with a python logging configuration, in the strategy module, that works "good enough"... I ll report here when I get something interesting.

@asmodehn
Copy link
Contributor Author

asmodehn commented Jul 8, 2019

I got something 'good enough' for now by doing this at the beginning of my strategy.__init__ :

        self.logger = logging.getLogger(__name__)

        handler = logging.handlers.RotatingFileHandler('dynamic_market_making.' + datetime.datetime.now().strftime("%Y%m%d-%H%M%S") + '.log')
        formatter = logging.Formatter(
            '%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
        handler.setFormatter(formatter)
        self.logger.addHandler(handler)
        self.logger.setLevel(logging.DEBUG)

        self.logger.debug("--Strategy Init--")

so I guess we can close this issue.
Should we make one feature request for syslog handler integration ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants