You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+116-1Lines changed: 116 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,12 +3,116 @@
3
3
4
4
Rails Semantic Logger replaces the Rails default logger with [Semantic Logger](https://logger.rocketjob.io/)
5
5
6
+
When any large Rails application is deployed to production one of the first steps is to move to centralized logging, so that logs can be viewed and searched from a central location.
7
+
8
+
Centralized logging quickly falls apart when trying to consume the current human readable log files:
9
+
- Log entries often span multiple lines, resulting in unrelated log lines in the centralized logging system. For example, stack traces.
10
+
- Complex Regular Expressions are needed to parse the text lines and make them machine readable. For example to build queries, or alerts that are looking for specific elements in the message.
11
+
- Writing searches, alerts, or dashboards based on text logs is incredibly brittle, since a small change to the text logged can often break the parsing of those logs.
12
+
- Every log entry often has a completely different format, making it difficult to make consistent searches against the data.
13
+
14
+
For these and many other reasons switching to structured logging, or logs in JSON format, in testing and production makes centralized logging incredibly powerful.
15
+
16
+
For example, adding these lines to `config/application.rb` and removing any other log overrides from other environments, will switch automatically to structured logging when running inside Kubernetes:
For complete documentation see: https://logger.rocketjob.io/rails
11
98
99
+
## Upgrading to Semantic Logger V4.16 - Sidekiq Metrics Support
100
+
101
+
Rails Semantic Logger now supports Sidekiq metrics.
102
+
Below are the metrics that are now available when the JSON logging format is used:
103
+
-`sidekiq.job.perform`
104
+
- The duration of each Sidekiq job.
105
+
-`duration` contains the time in milliseconds that the job took to run.
106
+
-`sidekiq.queue.latency`
107
+
- The time between when a Sidekiq job was enqueued and when it was started.
108
+
-`metric_amount` contains the time in milliseconds that the job was waiting in the queue.
109
+
110
+
## Upgrading to Semantic Logger v4.15 & V4.16 - Sidekiq Support
111
+
112
+
Rails Semantic Logger introduces direct support for Sidekiq v4, v5, v6, and v7.
113
+
Please remove any previous custom patches or configurations to make Sidekiq work with Semantic Logger.
114
+
To see the complete list of patches being made, and to contribute your own changes, see: [Sidekiq Patches](https://github.com/reidmorrison/rails_semantic_logger/blob/master/lib/rails_semantic_logger/extensions/sidekiq/sidekiq.rb)
115
+
12
116
## Upgrading to Semantic Logger v4.4
13
117
14
118
With some forking frameworks it is necessary to call `reopen` after the fork. With v4.4 the
@@ -19,7 +123,18 @@ I.e. Please remove the following line if being called anywhere:
The primary purpose of the Rails Semantic Logger gem is to patch other gems, primarily Rails, to make them support structured logging though Semantic Logger.
129
+
130
+
When new versions of Rails and other gems are published they often make changes to the internals, so the existing patches stop working.
131
+
132
+
Rails Semantic Logger survives only when someone in the community upgrades to a newer Rails or other supported libraries, runs into problems,
133
+
and then contributes the fix back to the community by means of a pull request.
134
+
135
+
Additionally, when new popular gems come out, we rely only the community to supply the necessary patches in Rails Semantic Logger to make those gems support structured logging.
136
+
137
+
## Supported Platforms
23
138
24
139
For the complete list of supported Ruby and Rails versions, see the [Testing file](https://github.com/reidmorrison/rails_semantic_logger/blob/master/.github/workflows/ci.yml).
0 commit comments