govuk_app_config 4.12.0 → 4.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7906015f743285fadae37a3b4c0754fcb3ef5d6c6d59ff5b8f67d0f0b43ce970
4
- data.tar.gz: da302c7be0424e4b4b476669468e8cbb1b6a3f5b38a017ddac4999ec14e0b622
3
+ metadata.gz: 19626391e07dadef9dce3abc326901bd86952b34532628b3ca0690d2cff2c314
4
+ data.tar.gz: 996320aff2dbeb2eae7d4fdd961461e33c39e2688ede77eaf7d5a92e5e6b9f84
5
5
  SHA512:
6
- metadata.gz: fac4b8128b250e74a9e71f165e6ca5eb431bd3f364a2efea18ceb696ce55d9e772fe73a04020811d6cbdd68341bd711fe07bc99e3f37d4ad371ea57b5446360d
7
- data.tar.gz: adef9932375e8c63f002a99ef759e1a301fdfbd1f4ad21a7b089fcda8b33acf83dcb4b6c658e5ccf9872171fac6cf58c2e0a0bbfd2a31dd2fbf7323669ea746b
6
+ metadata.gz: 880a5141ae35cbff8b463c49526fe9b41163fdf2c4a9fec6e1e6717a43f633f602e569449271be1609415b1d4f36b1c51782190ed40ced692ebd6daa722e7f73
7
+ data.tar.gz: 6b5e893f9abc787e20510f0e2a38565224df5902197f90a07cf861ca4fe7cc49ca306ea12e2440d858e888f1121d1c800767e2b774711749a8c7ea29a30955e4
@@ -30,6 +30,6 @@ jobs:
30
30
  if: ${{ github.ref == 'refs/heads/main' }}
31
31
  permissions:
32
32
  contents: write
33
- uses: alphagov/govuk-infrastructure/.github/workflows/publish-rubygem.yaml@main
33
+ uses: alphagov/govuk-infrastructure/.github/workflows/publish-rubygem.yml@main
34
34
  secrets:
35
35
  GEM_HOST_API_KEY: ${{ secrets.ALPHAGOV_RUBYGEMS_API_KEY }}
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 4.13.0
2
+
3
+ - Flush log writes to stdout immediately so that structured (JSON) logs are not lost on crash or delayed indefinitely.
4
+
1
5
  # 4.12.0
2
6
 
3
7
  * Allow `https://img.youtube.com` as a CSP image source
@@ -12,36 +12,37 @@ module GovukLogging
12
12
  # `Rails.logger` calls or 'puts' statements. However these are not in a
13
13
  # JSON format which causes problems for the log file parsers.
14
14
  #
15
- # To resolve this we've directed stdout to stderr, to cover any Rails
15
+ # To resolve this we redirect stdout to stderr, to cover any Rails
16
16
  # writing. This frees up the normal stdout for the logstasher logs.
17
+ #
18
+ # We also disable buffering, so that logs aren't lost on crash or delayed
19
+ # indefinitely while troubleshooting.
17
20
 
18
21
  # rubocop:disable Style/GlobalVars
19
22
  $real_stdout = $stdout.clone
23
+ $real_stdout.sync = true
20
24
  $stdout.reopen($stderr)
25
+ $stdout.sync = true
21
26
  # rubocop:enable Style/GlobalVars
22
27
 
23
28
  # Send Rails' logs to STDERR because they're not JSON formatted.
24
29
  Rails.logger = ActiveSupport::TaggedLogging.new(Logger.new($stderr, level: Rails.logger.level))
25
30
 
26
- # Custom that will be added to the Rails request logs
27
31
  LogStasher.add_custom_fields do |fields|
28
- # Mirrors Nginx request logging, e.g GET /path/here HTTP/1.1
32
+ # Mirrors Nginx request logging, e.g. GET /path/here HTTP/1.1
29
33
  fields[:request] = "#{request.request_method} #{request.fullpath} #{request.headers['SERVER_PROTOCOL']}"
30
34
 
31
- # Pass request Id to logging
32
35
  fields[:govuk_request_id] = request.headers["GOVUK-Request-Id"]
33
-
34
36
  fields[:varnish_id] = request.headers["X-Varnish"]
35
-
36
37
  fields[:govuk_app_config] = GovukAppConfig::VERSION
37
38
  end
38
39
 
39
40
  Rails.application.config.logstasher.enabled = true
40
41
 
41
- # Log controller actions so that we can graph response times
42
+ # Log controller actions so that we can graph response times.
42
43
  Rails.application.config.logstasher.controller_enabled = true
43
44
 
44
- # The other loggers are not that interesting in production
45
+ # The other loggers are not that interesting in production.
45
46
  Rails.application.config.logstasher.mailer_enabled = false
46
47
  Rails.application.config.logstasher.record_enabled = false
47
48
  Rails.application.config.logstasher.view_enabled = false
@@ -59,11 +60,9 @@ module GovukLogging
59
60
  if defined?(GdsApi::Base)
60
61
  GdsApi::Base.default_options ||= {}
61
62
 
62
- # The GDS API Adapters gem logs JSON to describe the requests it
63
- # makes and the responses it gets, so direct this to the
64
- # logstasher logger
65
- GdsApi::Base.default_options[:logger] =
66
- Rails.application.config.logstasher.logger
63
+ # The gds-api-adapters gem logs JSON to describe the requests it makes and
64
+ # the responses it gets, so direct this to the logstasher logger.
65
+ GdsApi::Base.default_options[:logger] = Rails.application.config.logstasher.logger
67
66
  end
68
67
 
69
68
  RailsExt::ActionDispatch.monkey_patch_log_error if RailsExt::ActionDispatch.should_monkey_patch_log_error?
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "4.12.0".freeze
2
+ VERSION = "4.13.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_app_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.12.0
4
+ version: 4.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-03 00:00:00.000000000 Z
11
+ date: 2023-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstasher
@@ -336,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
336
336
  - !ruby/object:Gem::Version
337
337
  version: '0'
338
338
  requirements: []
339
- rubygems_version: 3.4.2
339
+ rubygems_version: 3.4.3
340
340
  signing_key:
341
341
  specification_version: 4
342
342
  summary: Base configuration for GOV.UK applications