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

Adjust logging levels #401

Open
alexiskattan opened this issue May 4, 2014 · 4 comments
Open

Adjust logging levels #401

alexiskattan opened this issue May 4, 2014 · 4 comments

Comments

@alexiskattan
Copy link

Hi there,

Is there a way to adjust the logging levels of what is outputted from the database.

On my local machine and on heroku the logs have a lot of this:

2014-05-04T21:43:01.113622+00:00 app[web.1]: SELECT * FROM "People" WHERE "id" = 123 LIMIT 1 [3 ms]

Which is fine for some things, but it would be really nice to be able to reduce the log level s so I can find another bug from the logs.

Is there a way to do this?

Thanks for your help. I really like this platform.

@alexiskattan
Copy link
Author

btw, I tried the app.enable 'log actions'
I also saw, this
Logger support (app.set('quiet', true) now forces logger to log in log/ENV.log here but I couldn't figure out what to do to test that out.

@randunel
Copy link
Collaborator

randunel commented May 6, 2014

Later edit: The following only apply if you are also using compoundjs:

Have you tried adding app.set('quiet', true); in config/environment.js?
Anyway, if you only want to suppress the database logs, you can add log: false in your database config in config/database.js

@alexiskattan
Copy link
Author

@randunel Hi again. Been a while. Wheew! Im still looking to get not log all the db queries. I tried adding log: false in config/database.coffee but it is still logging...

module.exports =

development:
    driver: 'postgres'
    host:   'XXX'
    port:   111
    username: 'XXX'
    password: 'XXX'
    database: 'XXX'
    log: false

test:
    driver: "memory"
    database: 1
    log: false

production:
    driver: 'postgres'
    host: 'XXX'
    database: 'XXX'
    username: 'XXX'
    port: 111
    password: 'XXX'
    log: false

@alexiskattan
Copy link
Author

After a bit of playing with it, this seems to work. If anyone is interested:

my_log = (str, startTime) ->
    m = Date.now() - startTime
    console.log "#{str} [#{m}ms]"

c.models.[YourModel].schema.log = my_log

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