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

summaries of rails log with lograge gem #108

Closed
kikicarbonell opened this issue Feb 2, 2015 · 6 comments
Closed

summaries of rails log with lograge gem #108

kikicarbonell opened this issue Feb 2, 2015 · 6 comments

Comments

@kikicarbonell
Copy link

I'm using lograge to build summarize log from rails app, but when I follow Readme indication of version [v0.3.1][1] the result it's: full rails log + summarize log.

For example:

Connecting to database specified by database.yml 
Connecting to database specified by database.yml 
{"@source":"unknown","@tags":[],"@fields":{},"method":"GET","path":"/","format":"html","controller":"home/summaries","action":"index","status":0,"duration":6.85,"product":"beesor-log","@timestamp":"2015-02-02T18:05:19.514583+00:00","@message":"[0] GET / (home/summaries#index)"} 
{"@source":"unknown","@tags":[],"@fields":{},"method":"GET","path":"/login","format":"html","controller":"devise/sessions","action":"new","status":200,"duration":155.42,"view":87.71,"db":8.29,"product":"beesor-log","@timestamp":"2015-02-02T18:05:19.850720+00:00","@message":"[200] GET /login (devise/sessions#new)"} 
Served asset /final_calls-b2b9d4899d488cafd9cbf55362f51edd.js - 200 OK (0ms) Served asset /i18n-a014c1078d4f5a62e1459afd80ef048b.js - 200 OK (0ms) Served asset /login-6e9b4528e684cf7f6bc276da58753af0.css - 200 OK (0ms) Served asset /devise/sessions - 200 OK (0ms) [1m[36mUser Load (2.2ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."username" = 'tenant_admin' AND "users"."status" = 'enabled' LIMIT 1[0m [1m[35m (1.0ms)[0m BEGIN [1m[36m (1.4ms)[0m [1mUPDATE "users" SET "last_sign_in_at" = '2015-02-02 17:03:35.791483', "current_sign_in_at" = '2015-02-02 18:05:25.525736', "sign_in_count" = 8, "updated_at" = '2015-02-02 18:05:25.528094' WHERE "users"."id" = 1[0m [1m[35m (13.9ms)[0m COMMIT [1m[36m (0.8ms)[0m [1mBEGIN[0m [1m[35m (1.2ms)[0m UPDATE "users" SET "unique_session_id" = 'jyzQTvsZKJiTye1a5RFQ', "updated_at" = '2015-02-02 18:05:25.546695' WHERE "users"."id" = 1 [1m[36m (4.4ms)[0m [1mCOMMIT[0m {"@source":"unknown","@tags":[],"@fields":{},"method":"POST","path":"/login","format":"html","controller":"devise/sessions","action":"create","status":302,"duration":141.81,"view":0.0,"db":0.0,"location":"http://localhost:3000/","product":"beesor-log","@timestamp":"2015-02-02T18:05:25.567320+00:00","@message":"[302] POST /login (devise/sessions#create)"}

This behavior is normal? I'm been understand that with this gems the rails log result will be: summarized log like:

{"@source":"unknown","@tags":[],"@fields":{},"method":"GET","path":"/","format":"html","controller":"home/summaries","action":"index","status":0,"duration":6.85,"product":"beesor-log","@timestamp":"2015-02-02T18:05:19.514583+00:00","@message":"[0] GET / (home/summaries#index)"} 
{"@source":"unknown","@tags":[],"@fields":{},"method":"GET","path":"/login","format":"html","controller":"devise/sessions","action":"new","status":200,"duration":155.42,"view":87.71,"db":8.29,"product":"beesor-log","@timestamp":"2015-02-02T18:05:19.850720+00:00","@message":"[200] GET /login (devise/sessions#new)"} 
{"@source":"unknown","@tags":[],"@fields":{},"method":"POST","path":"/login","format":"html","controller":"devise/sessions","action":"create","status":302,"duration":141.81,"view":0.0,"db":0.0,"location":"http://localhost:3000/","product":"beesor-log","@timestamp":"2015-02-02T18:05:25.567320+00:00","@message":"[302] POST /login (devise/sessions#create)"}

[1] https://github.com/roidrage/lograge/tree/v0.3.1

@pxlpnk
Copy link
Collaborator

pxlpnk commented Feb 3, 2015

What rails version are you using? Can you also pleace include how exactly you set up lograge?

@kikicarbonell
Copy link
Author

@pxlpnk I'm using rails 3.2.19 but I can upgrade to rails 4. I set on my config/enviroments/staging.rb:

  config.log_level = :info
  config.lograge.enabled = true
  config.lograge.formatter = Lograge::Formatters::Logstash.new

And on my Gemfile:

gem 'lograge', '0.3.1'

Thks for your time

@pxlpnk
Copy link
Collaborator

pxlpnk commented Feb 3, 2015

It looks somehow that you have set a config variable in your staging env that overrides the way the asset system is logging.

@kikicarbonell
Copy link
Author

@pxlpnk I don't understand, please explain more.

@pxlpnk
Copy link
Collaborator

pxlpnk commented Feb 3, 2015

I could reproduce your output now in development mode, but not in production mode.
I fiddled a bit around with the settings and when using config.assets.debug = false I get the desired output.

@kikicarbonell
Copy link
Author

@pxlpnk thanks for all, the solution it's as you say on previous comment, setting config.assets.debug = false

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