Comments (3)
I debugged a little bit more and somehow when configuring the broadcast log with logs without the tagged logger. It works fine.
And also when I use just a log with tagged logger, it works fine.
The problem is with tagged logger and broadcast logger.
Also I debugged the ActionDispatch::RequestId and the problems seems that when configuring the
TaggedLoggingand
BroadcastLogger` it changes the arguments of the block.
@app.call(env).tap do |_status, headers, _body|
headers[@header] = req.request_id
end
With the TaggedLogging
and BroadcastLogger
the both the _status
and headers
is the Array
composed of [status, headers]
that why the line that set the request_id throw the error. headers
is an array and @header
is the key for the header "x-request-id"
Without hte TaggedLogging
, the arguments of the block are correctly decomposed.
I could try to fix it if someone can guide me a little bit more.
from rails.
Hey @ruyrocha thanks for your respose.
I tested with the stable branch and, it doesn't work.
There is a problem in your sample file.
When you use:
environment_logger = ActiveSupport::Logger.new(env_logger_file).tap { |logger| ActiveSupport::TaggedLogging.new(logger) }
You are using tap
but tap
doesn't return the block result. So the environment_logger
isn't configured with the TaggedLogging
, that why it works fine in your sample.
I replaced the tap
for then
so the environment_logger
variable is also a TaggedLogging
instance and it throws the same error.
TypeError: no implicit conversion of String into Integer
from rails.
The headers are correctly set as Rack::Headers
, not an Array
, while running your reproduction script against the main branch
.
This is the passing script for 7-1-stable
branch:
class TestApp < Rails::Application
config.root = __dir__
config.hosts << "example.org"
config.secret_key_base = "secret_key_base"
tagged_logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT))
config.logger = tagged_logger
env_logger_file = Rails.root.join("tmp", "#{Rails.env}.log")
environment_logger = ActiveSupport::Logger.new(env_logger_file).tap { |logger| ActiveSupport::TaggedLogging.new(logger) }
config.log_tags = [:request_id]
Rails.logger = ActiveSupport::BroadcastLogger.new(config.logger, environment_logger)
routes.draw do
get "/" => "test#index"
end
end
Can you please give it a try?
from rails.
Related Issues (20)
- No number_to_rounded method present HOT 5
- ruby fails to load active_support/core_ext/array/conversions: undefined method `deprecator' for module ActiveSupport HOT 1
- Uniqueness validation throws postgres error when enum with incorrect value is used as a scope HOT 8
- Malformed request causes exception "invalid byte sequence in UTF-8" HOT 2
- NumericalityValidator - only_integer option should allow to use values like 4.0 HOT 1
- Upgrade from rails 6.1 to 7.0 - cookie rotator doesn't make it possible to read old cookies. HOT 5
- ActionController::InvalidAuthenticityToken when submitting a form via button with `formmethod: :delete` HOT 5
- ActionController::Parameters#values returns an array of ActionController::Parameters objects for nested hashes HOT 3
- Rails 7.1 Error when reading active record model from redis cache HOT 6
- [BUG since 2016] cookies.delete does not remove cookies for subsequent requests (ActionController::TestCase) HOT 2
- "Polymorphic associations do not support computing the class." error when creating a record with a `has_one :through` HOT 4
- Null error in DB on relation `belongs_to` HOT 1
- Relax the sqlite3 dependency for Rails 7.1 HOT 4
- [DOC] active record basic guide said `create` would return `false` if failed
- ActiveRecord `attribute :foo, :bar` requires an active connection
- enable_extension in schema dump doesn't contain schema name HOT 6
- PostgreSQL array not decrypting HOT 2
- Behaviour of `autosave` associations has changed on edge HOT 5
- [ActiveRecord] delete_all on has_many with dependent: :restrict_with_error results with nullify HOT 2
- ActiveRecord::AttributeMethods::Serialization::ClassMethods.serialize is not backwards compatible 7.0 -> 7.1 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rails.