Replies: 3 comments
-
This looks like one of the queries run when getting the schema for the table. If you don't want it logged, you can set the log level higher than info, or use a custom log filter. |
Beta Was this translation helpful? Give feedback.
-
The issue is, both useful log and those schema logs all same log level. I, [2021-12-03T13:25:06.212175 #259110] INFO -- : (0.000975s) SELECT "pg_attribute"."attname" AS "name", CAST("pg_attribute"."atttypid" AS integer) AS "oid", CAST("basetype"."oid" AS integer) AS "base_oid", format_type("basetype"."oid", "pg_type"."typtypmod") AS "db_base_type", format_type("pg_type"."oid", "pg_attribute"."atttypmod") AS "db_type", pg_get_expr("pg_attrdef"."adbin", "pg_class"."oid") AS "default", NOT "pg_attribute"."attnotnull" AS "allow_null", COALESCE(("pg_attribute"."attnum" = ANY("pg_index"."indkey")), false) AS "primary_key", "pg_attribute"."attidentity", ("pg_attribute"."attgenerated" != '') AS "generated" FROM "pg_class" INNER JOIN "pg_attribute" ON ("pg_attribute"."attrelid" = "pg_class"."oid") INNER JOIN "pg_type" ON ("pg_type"."oid" = "pg_attribute"."atttypid") LEFT OUTER JOIN "pg_type" AS "basetype" ON ("basetype"."oid" = "pg_type"."typbasetype") LEFT OUTER JOIN "pg_attrdef" ON (("pg_attrdef"."adrelid" = "pg_class"."oid") AND ("pg_attrdef"."adnum" = "pg_attribute"."attnum")) LEFT OUTER JOIN "pg_index" ON (("pg_index"."indrelid" = "pg_class"."oid") AND ("pg_index"."indisprimary" IS TRUE)) WHERE (("pg_attribute"."attisdropped" IS FALSE) AND ("pg_attribute"."attnum" > 0) AND ("pg_class"."oid" = CAST(CAST('"jin10_messages"' AS regclass) AS oid))) ORDER BY "pg_attribute"."attnum" Above log not so useful I, [2021-12-03T13:25:06.717121 #259110] INFO -- : (0.000453s) SELECT * FROM "jin10_messages" WHERE (("title" = '美联储梅斯特:明年至少会支持一次加息,两次加息可能是“合适的”。') AND ("publish_date" = '2021-12-03')) LIMIT 1 But, above log is useful. so, we consider add those log from schema as debug level? then we can ignore schema log. It's seem like when working with ActiveRecord, only see those useful logs, no see schema log. |
Beta Was this translation helpful? Give feedback.
-
All SQL logged by Sequel is logged at the same level, by design. If you want to avoid the schema being logged, a simple approach is not to attach a logger to the Database object until after the model classes have been created. |
Beta Was this translation helpful? Give feedback.
-
I saw some INFO level DB log when i do development with sequel, like this.
I, [2021-12-03T13:25:06.212175 #259110] INFO -- : (0.000975s) SELECT "pg_attribute"."attname" AS "name", CAST("pg_attribute"."atttypid" AS integer) AS "oid", CAST("basetype"."oid" AS integer) AS "base_oid", format_type("basetype"."oid", "pg_type"."typtypmod") AS "db_base_type", format_type("pg_type"."oid", "pg_attribute"."atttypmod") AS "db_type", pg_get_expr("pg_attrdef"."adbin", "pg_class"."oid") AS "default", NOT "pg_attribute"."attnotnull" AS "allow_null", COALESCE(("pg_attribute"."attnum" = ANY("pg_index"."indkey")), false) AS "primary_key", "pg_attribute"."attidentity", ("pg_attribute"."attgenerated" != '') AS "generated" FROM "pg_class" INNER JOIN "pg_attribute" ON ("pg_attribute"."attrelid" = "pg_class"."oid") INNER JOIN "pg_type" ON ("pg_type"."oid" = "pg_attribute"."atttypid") LEFT OUTER JOIN "pg_type" AS "basetype" ON ("basetype"."oid" = "pg_type"."typbasetype") LEFT OUTER JOIN "pg_attrdef" ON (("pg_attrdef"."adrelid" = "pg_class"."oid") AND ("pg_attrdef"."adnum" = "pg_attribute"."attnum")) LEFT OUTER JOIN "pg_index" ON (("pg_index"."indrelid" = "pg_class"."oid") AND ("pg_index"."indisprimary" IS TRUE)) WHERE (("pg_attribute"."attisdropped" IS FALSE) AND ("pg_attribute"."attnum" > 0) AND ("pg_class"."oid" = CAST(CAST('"jin10_messages"' AS regclass) AS oid))) ORDER BY "pg_attribute"."attnum"
jin10_messages is the table name
i consider this log is not so useful for me, at least, for now, i don't understand what it for, and curious what is this?
can i get ride of those logs?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions