Skip to content

Commit

Permalink
Merge pull request #2361 from fluent/add-more-debug-log
Browse files Browse the repository at this point in the history
Add debug log to in_tail / buf_file.
  • Loading branch information
repeatedly authored Apr 2, 2019
2 parents 0e37e68 + 3338d5e commit a084565
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/fluent/plugin/buf_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ def resume
Dir.glob(patterns) do |path|
next unless File.file?(path)

log.debug { "restoring buffer file: path = #{path}" }

m = new_metadata() # this metadata will be overwritten by resuming .meta file content
# so it should not added into @metadata_list for now
mode = Fluent::Plugin::Buffer::FileChunk.assume_chunk_state(path)
Expand Down
7 changes: 5 additions & 2 deletions lib/fluent/plugin/in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def configure_encoding

@encoding = parse_encoding_param(@encoding) if @encoding
@from_encoding = parse_encoding_param(@from_encoding) if @from_encoding
if @encoding == @from_encoding
if @encoding && (@encoding == @from_encoding)
log.warn "'encoding' and 'from_encoding' are same encoding. No effect"
end
end
Expand Down Expand Up @@ -239,6 +239,7 @@ def expand_paths
false
end
rescue Errno::ENOENT
log.debug("#{p} is missing after refresh file list")
false
end
}
Expand All @@ -260,6 +261,8 @@ def refresh_watchers
target_paths = expand_paths
existence_paths = @tails.keys

log.debug { "tailing paths: target = #{target_paths.join(",")} | existing = #{existence_paths.join(",")}" }

unwatched = existence_paths - target_paths
added = target_paths - existence_paths

Expand Down Expand Up @@ -337,7 +340,7 @@ def close_watcher_handles
def update_watcher(path, pe)
if @pf
unless pe.read_inode == @pf[path].read_inode
log.trace "Skip update_watcher because watcher has been already updated by other inotify event"
log.debug "Skip update_watcher because watcher has been already updated by other inotify event"
return
end
end
Expand Down

0 comments on commit a084565

Please sign in to comment.