Skip to content

Instantly share code, notes, and snippets.

@fmstefanini
Created December 7, 2015 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fmstefanini/9f69903ad2e0a35d0a24 to your computer and use it in GitHub Desktop.
Save fmstefanini/9f69903ad2e0a35d0a24 to your computer and use it in GitHub Desktop.
Rails Server log when accessing Discourse's topic with a logged user
D, [2015-12-07T19:26:57.569623 #3118] DEBUG -- : SQL (3.0ms) UPDATE "users" SET "last_seen_at" = '2015-12-07 19:26:57.545642' WHERE "users"."id" = 168964 [["id", 168964]]
D, [2015-12-07T19:26:57.576431 #3118] DEBUG -- : Draft Load (0.9ms) SELECT "drafts".* FROM "drafts" WHERE "drafts"."user_id" = 168964 AND "drafts"."draft_key" = 'new_topic' LIMIT 1 [["user_id", 168964], ["draft_key", "new_topic"]]
D, [2015-12-07T19:26:57.580172 #3118] DEBUG -- : TopicUser Load (1.0ms) SELECT "topic_users".* FROM "topic_users" WHERE "topic_users"."user_id" = 168964 AND "topic_users"."topic_id" IN (8, 10, 9, 7, 6, 5, 4, 295883, 23349, 142710, 142709, 291299, 23352, 295882, 35948, 76827, 222553, 94613, 237990, 237993, 94658, 94648, 94649, 23353, 94654, 142708, 295876, 94652, 94656, 94650) [["user_id", 168964]]
D, [2015-12-07T19:26:57.584594 #3118] DEBUG -- : User Load (1.5ms) SELECT "users"."id", "users"."email", "users"."username", "users"."uploaded_avatar_id" FROM "users" WHERE "users"."id" IN (-1, 40438, 167289, 23850, 121687, 155350, 139792, 109963, 126125, 43599, 164717, 130754, 119889, 57389, 167252, 166669, 133806, 132259, 146591, 8208, 168116, 8769, 113312, 41768, 32973, 121963, 108505, 138122, 10954, 110239, 168526, 128917, 151871, 168388, 21868, 57664, 1258, 163217, 21868, 131515, 147815, 139792, 47295, 14030, 139792, 57389, 50803, 14030)
D, [2015-12-07T19:26:57.590964 #3118] DEBUG -- : UserStat Load (1.0ms) SELECT "user_stats".* FROM "user_stats" WHERE "user_stats"."user_id" = 168964 LIMIT 1 [["user_id", 168964]]
I, [2015-12-07T19:26:57.607309 #3118] INFO -- : Completed 200 OK in 64ms (Views: 0.2ms | ActiveRecord: 11.7ms)
D, [2015-12-07T19:27:06.712353 #3118] DEBUG -- :
D, [2015-12-07T19:27:06.712451 #3118] DEBUG -- :
I, [2015-12-07T19:27:06.712707 #3118] INFO -- : Started GET "/t/295883.json?track_visit=true&forceLoad=true&_=1449516157901" for 177.139.156.225 at 2015-12-07 19:27:06 +0000
I, [2015-12-07T19:27:06.769631 #3118] INFO -- : Processing by TopicsController#show as JSON
I, [2015-12-07T19:27:06.771245 #3118] INFO -- : Parameters: {"track_visit"=>"true", "forceLoad"=>"true", "_"=>"1449516157901", "id"=>"295883"}
D, [2015-12-07T19:27:06.774160 #3118] DEBUG -- : User Load (1.4ms) SELECT "users".* FROM "users" WHERE "users"."auth_token" = 'acaad7a5ade98688e3b1ea7678263c41' LIMIT 1 [["auth_token", "acaad7a5ade98688e3b1ea7678263c41"]]
D, [2015-12-07T19:27:06.777923 #3118] DEBUG -- : UserStat Load (1.0ms) SELECT "user_stats".* FROM "user_stats" WHERE "user_stats"."user_id" = 168964 LIMIT 1 [["user_id", 168964]]
D, [2015-12-07T19:27:06.781835 #3118] DEBUG -- : Topic Load (1.0ms) SELECT "topics".* FROM "topics" WHERE "topics"."id" = 295883 ORDER BY "topics"."id" ASC LIMIT 1 [["id", "295883"]]
D, [2015-12-07T19:27:06.785212 #3118] DEBUG -- : Category Load (1.0ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" IN (13)
D, [2015-12-07T19:27:06.788952 #3118] DEBUG -- : Post Exists (0.8ms) SELECT 1 AS one FROM "posts" WHERE "posts"."topic_id" = 295883 AND (user_id = 168964 OR post_type IN (1,2,3,4)) AND (posts.deleted_at IS NOT NULL) AND (posts.post_number > 1) LIMIT 1 [["topic_id", 295883]]
D, [2015-12-07T19:27:06.791367 #3118] DEBUG -- : (0.8ms) SELECT "posts"."id" FROM "posts" WHERE "posts"."topic_id" = 295883 AND (user_id = 168964 OR post_type IN (1,2,3,4)) ORDER BY "posts"."sort_order" ASC [["topic_id", 295883]]
D, [2015-12-07T19:27:06.794287 #3118] DEBUG -- : Post Load (1.0ms) SELECT "posts".* FROM "posts" WHERE "posts"."topic_id" = 295883 AND "posts"."id" = 1612397 AND (user_id = 168964 OR post_type IN (1,2,3,4)) ORDER BY sort_order [["topic_id", 295883]]
D, [2015-12-07T19:27:06.797692 #3118] DEBUG -- : User Load (1.0ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (40438)
D, [2015-12-07T19:27:06.800846 #3118] DEBUG -- : (0.8ms) SELECT "post_custom_fields"."post_id", "post_custom_fields"."name", "post_custom_fields"."value" FROM "post_custom_fields" WHERE "post_custom_fields"."post_id" = 1612397 AND "post_custom_fields"."name" IN ('polls', 'polls-votes')
D, [2015-12-07T19:27:06.804245 #3118] DEBUG -- : Draft Load (0.9ms) SELECT "drafts".* FROM "drafts" WHERE "drafts"."user_id" = 168964 AND "drafts"."draft_key" = 'topic_295883' LIMIT 1 [["user_id", 168964], ["draft_key", "topic_295883"]]
D, [2015-12-07T19:27:06.806170 #3118] DEBUG -- : SQL (1.5ms) UPDATE "topic_users" SET "last_visited_at" = '2015-12-07 19:27:06.803420' WHERE "topic_users"."topic_id" = 295883 AND "topic_users"."user_id" = 295883 [["topic_id", 295883], ["user_id", 295883]]
D, [2015-12-07T19:27:06.809308 #3118] DEBUG -- : (1.1ms) SELECT categories.id FROM "categories" WHERE "categories"."read_restricted" = 't' [["read_restricted", true]]
D, [2015-12-07T19:27:06.811125 #3118] DEBUG -- : TopicUser Load (0.3ms) SELECT "topic_users".* FROM "topic_users" WHERE "topic_users"."topic_id" = 295883 AND "topic_users"."user_id" = 295883 [["topic_id", 295883], ["user_id", 295883]]
D, [2015-12-07T19:27:06.814961 #3118] DEBUG -- : TopicUser Load (1.0ms) SELECT "topic_users".* FROM "topic_users" WHERE "topic_users"."topic_id" = 295883 AND "topic_users"."user_id" = 168964 LIMIT 1 [["topic_id", 295883], ["user_id", 168964]]
D, [2015-12-07T19:27:06.818078 #3118] DEBUG -- : PostAction Load (1.0ms) SELECT "post_actions".* FROM "post_actions" WHERE ("post_actions"."deleted_at" IS NULL) AND "post_actions"."user_id" = 168964 AND "post_actions"."post_id" = 1612397 [["user_id", 168964]]
D, [2015-12-07T19:27:06.821360 #3118] DEBUG -- : PostAction Load (1.0ms) SELECT "post_actions".* FROM "post_actions" WHERE ("post_actions"."deleted_at" IS NULL) AND "post_actions"."disagreed_at" IS NULL AND "post_actions"."deferred_at" IS NULL AND "post_actions"."agreed_at" IS NULL AND "post_actions"."deleted_at" IS NULL AND "post_actions"."post_action_type_id" IN (3, 4, 7, 8) AND "post_actions"."post_id" = 1612397
D, [2015-12-07T19:27:06.824004 #3118] DEBUG -- : CACHE (0.0ms) SELECT "topic_users".* FROM "topic_users" WHERE "topic_users"."topic_id" = 295883 AND "topic_users"."user_id" = 168964 LIMIT 1 [["topic_id", 295883], ["user_id", 168964]]
D, [2015-12-07T19:27:06.825748 #3118] DEBUG -- : CACHE (0.0ms) SELECT "topic_users".* FROM "topic_users" WHERE "topic_users"."topic_id" = 295883 AND "topic_users"."user_id" = 168964 LIMIT 1 [["topic_id", 295883], ["user_id", 168964]]
D, [2015-12-07T19:27:06.827471 #3118] DEBUG -- : CACHE (0.0ms) SELECT "topic_users".* FROM "topic_users" WHERE "topic_users"."topic_id" = 295883 AND "topic_users"."user_id" = 168964 LIMIT 1 [["topic_id", 295883], ["user_id", 168964]]
D, [2015-12-07T19:27:06.830329 #3118] DEBUG -- : User Load (1.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 40438 LIMIT 1 [["id", 40438]]
D, [2015-12-07T19:27:06.832462 #3118] DEBUG -- : CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 40438 LIMIT 1 [["id", 40438]]
D, [2015-12-07T19:27:06.835635 #3118] DEBUG -- : (1.0ms) SELECT COUNT(*) AS count_all, user_id AS user_id FROM "posts" WHERE ("posts"."deleted_at" IS NULL) AND "posts"."topic_id" = 295883 AND (user_id IS NOT NULL) GROUP BY "posts"."user_id" ORDER BY count_all DESC LIMIT 24 [["topic_id", 295883]]
D, [2015-12-07T19:27:06.838316 #3118] DEBUG -- : User Load (0.9ms) SELECT "users".* FROM "users" WHERE "users"."id" = 40438
D, [2015-12-07T19:27:06.841032 #3118] DEBUG -- : (0.8ms) SELECT "categories"."topic_id" FROM "categories"
D, [2015-12-07T19:27:06.844752 #3118] DEBUG -- : Topic Load (1.5ms) SELECT "topics".* FROM "topics" LEFT OUTER JOIN topic_users AS tu ON (topics.id = tu.topic_id AND tu.user_id = 168964) WHERE (topics.archetype <> 'private_message') AND (topics.deleted_at IS NULL) AND (tu.last_read_post_number < topics.highest_post_number) AND (COALESCE(tu.notification_level, 1) >= 2) AND (topics.id NOT IN (295883)) AND "topics"."visible" = 't' ORDER BY CASE WHEN topics.user_id = tu.user_id THEN 1 ELSE 2 END, CASE WHEN topics.category_id = 13 THEN 0 ELSE 1 END, topics.bumped_at DESC LIMIT 5 [["visible", true]]
D, [2015-12-07T19:27:06.867931 #3118] DEBUG -- : SQL (2.6ms) SELECT "topics"."id" AS t0_r0, "topics"."title" AS t0_r1, "topics"."last_posted_at" AS t0_r2, "topics"."created_at" AS t0_r3, "topics"."updated_at" AS t0_r4, "topics"."views" AS t0_r5, "topics"."posts_count" AS t0_r6, "topics"."user_id" AS t0_r7, "topics"."last_post_user_id" AS t0_r8, "topics"."reply_count" AS t0_r9, "topics"."featured_user1_id" AS t0_r10, "topics"."featured_user2_id" AS t0_r11, "topics"."featured_user3_id" AS t0_r12, "topics"."avg_time" AS t0_r13, "topics"."deleted_at" AS t0_r14, "topics"."highest_post_number" AS t0_r15, "topics"."image_url" AS t0_r16, "topics"."off_topic_count" AS t0_r17, "topics"."like_count" AS t0_r18, "topics"."incoming_link_count" AS t0_r19, "topics"."bookmark_count" AS t0_r20, "topics"."category_id" AS t0_r21, "topics"."visible" AS t0_r22, "topics"."moderator_posts_count" AS t0_r23, "topics"."closed" AS t0_r24, "topics"."archived" AS t0_r25, "topics"."bumped_at" AS t0_r26, "topics"."has_summary" AS t0_r27, "topics"."vote_count" AS t0_r28, "topics"."archetype" AS t0_r29, "topics"."featured_user4_id" AS t0_r30, "topics"."notify_moderators_count" AS t0_r31, "topics"."spam_count" AS t0_r32, "topics"."illegal_count" AS t0_r33, "topics"."inappropriate_count" AS t0_r34, "topics"."pinned_at" AS t0_r35, "topics"."score" AS t0_r36, "topics"."percent_rank" AS t0_r37, "topics"."notify_user_count" AS t0_r38, "topics"."subtype" AS t0_r39, "topics"."slug" AS t0_r40, "topics"."auto_close_at" AS t0_r41, "topics"."auto_close_user_id" AS t0_r42, "topics"."auto_close_started_at" AS t0_r43, "topics"."deleted_by_id" AS t0_r44, "topics"."participant_count" AS t0_r45, "topics"."word_count" AS t0_r46, "topics"."excerpt" AS t0_r47, "topics"."pinned_globally" AS t0_r48, "topics"."auto_close_based_on_last_post" AS t0_r49, "topics"."auto_close_hours" AS t0_r50, "topics"."pinned_until" AS t0_r51, "topics"."fancy_title" AS t0_r52, "categories"."id" AS t1_r0, "categories"."name" AS t1_r1, "categories"."color" AS t1_r2, "categories"."topic_id" AS t1_r3, "categories"."topic_count" AS t1_r4, "categories"."created_at" AS t1_r5, "categories"."updated_at" AS t1_r6, "categories"."user_id" AS t1_r7, "categories"."topics_year" AS t1_r8, "categories"."topics_month" AS t1_r9, "categories"."topics_week" AS t1_r10, "categories"."slug" AS t1_r11, "categories"."description" AS t1_r12, "categories"."text_color" AS t1_r13, "categories"."read_restricted" AS t1_r14, "categories"."auto_close_hours" AS t1_r15, "categories"."post_count" AS t1_r16, "categories"."latest_post_id" AS t1_r17, "categories"."latest_topic_id" AS t1_r18, "categories"."position" AS t1_r19, "categories"."parent_category_id" AS t1_r20, "categories"."posts_year" AS t1_r21, "categories"."posts_month" AS t1_r22, "categories"."posts_week" AS t1_r23, "categories"."email_in" AS t1_r24, "categories"."email_in_allow_strangers" AS t1_r25, "categories"."topics_day" AS t1_r26, "categories"."posts_day" AS t1_r27, "categories"."logo_url" AS t1_r28, "categories"."background_url" AS t1_r29, "categories"."allow_badges" AS t1_r30, "categories"."name_lower" AS t1_r31, "categories"."auto_close_based_on_last_post" AS t1_r32, "categories"."topic_template" AS t1_r33, "categories"."suppress_from_homepage" AS t1_r34 FROM "topics" LEFT OUTER JOIN "categories" ON "categories"."id" = "topics"."category_id" LEFT OUTER JOIN topic_users AS tu ON (topics.id = tu.topic_id AND tu.user_id = 168964) WHERE (topics.archetype <> 'private_message') AND (topics.deleted_at IS NULL) AND (topics.created_at >= '2015-12-07 17:33:17.521154') AND (tu.last_read_post_number IS NULL) AND (COALESCE(tu.notification_level, 2) >= 2) AND (
NOT EXISTS (
SELECT 1
FROM category_users cu
WHERE cu.user_id = 168964
AND cu.category_id = topics.category_id
AND cu.notification_level = 0
AND cu.category_id <> -1
AND (tu.notification_level IS NULL OR tu.notification_level < 2)
)) AND (topics.id NOT IN (295883)) AND "topics"."visible" = 't' ORDER BY CASE WHEN topics.category_id = 13 THEN 0 ELSE 1 END, topics.bumped_at DESC LIMIT 5 [["visible", true]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment