-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Append plugin name and id to log #860
Append plugin name and id to log #860
Conversation
Please review after #859. |
71b2363
to
e4bc190
Compare
It looks too much for me to add plugin type and id as attributes on all log lines. |
@log.optional_attrs = { | ||
'plugin_type' => self.class.name, | ||
} | ||
if @_id_configured |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use plugin_id_configured?
method instead of referring @_id_configured
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to use it.
They are added in only optional headers in log. In practice, optional headers is not appended in stdout plugin output like:
Or, we should reduce output against optional headers in log? |
@cosmo0920 Could you rebase on current master? I want to check this change doesn't break anything. |
dc622b6
to
6034412
Compare
Rebased! |
For example, this log line has attributes: Are these attributes added to all lines from this plugin instance in spite of this line's header |
6034412
to
181f48c
Compare
How about latest patch? This patch makes to add plugin inspection into only headers like this:
|
Along with your patch, logger looks not to dump attributes ( |
It's intentional: :< |
@@ -371,6 +387,13 @@ def configure(conf) | |||
@log = PluginLogger.new($log) | |||
end | |||
@log.level = @log_level | |||
@log.optional_header = "[#{self.class.name}#{plugin_id_configured? ? "(" + @id + ")" : ""}] " | |||
@log.optional_attrs = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it needed to set plugin_type
and plugin_id
into optional_attrs
?
This is ignored in actual logging by unless
condition in L287. What's other purpose of these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, this code seems to be useless....
OK, current change is good to me, and CI is green now. |
78b46bc
to
c86cfe9
Compare
c86cfe9
to
750e571
Compare
Squashed! |
Merged. Thanks! |
If users use following config:
Fluentd outputs following log which includes optional headers: