exception_file_notifier 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +8 -6
- data/README.md +57 -4
- data/exception_file_notifier.gemspec +5 -6
- data/lib/exception_notifier/exception_file_notifier/version.rb +1 -1
- data/lib/exception_notifier/file_notifier.rb +1 -1
- metadata +36 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a39d7fbe09f2d70a19b359cf7459280f3b07f3008ef2ab3ed7c017d81cbd9adf
|
4
|
+
data.tar.gz: 8d8bc317654ccd897a3c9414877712c704e2f2b5dc022992b009bc67cff5a0e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f9d25f53345e4e6b57a2a9a883f4c0dddd5cbe5d25b4ed69cd92cab42359f8e3487e519c27ba42df0d27a20f7288db1d4e70734fa7b374a62abbd813df38f59
|
7
|
+
data.tar.gz: 001004461e2964383bb4357811f6b6446db308d2cdafed4e4e982fe8f78216f5ed92d1257bc40b32ca814ba7ddf598457e86595b01e59d782b5142a9c6ea0011
|
data/.travis.yml
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
sudo: false
|
2
1
|
language: ruby
|
3
2
|
rvm:
|
4
|
-
|
5
|
-
- 2.
|
6
|
-
- 2.
|
7
|
-
- 2.
|
8
|
-
|
3
|
+
- 2.3.8
|
4
|
+
- 2.4.9
|
5
|
+
- 2.5.7
|
6
|
+
- 2.6.5
|
7
|
+
- 2.7.0
|
8
|
+
before_install: gem install bundler
|
9
|
+
install:
|
10
|
+
- "bundle install --jobs=3 --retry=3 --path=vendor/bundle"
|
data/README.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
-
#
|
1
|
+
# Exception File Notifier
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/exception_file_notifier.svg)](https://badge.fury.io/rb/exception_file_notifier)
|
4
|
+
[![Travis](https://api.travis-ci.org/fursich/exception_file_notifier.png)](http://travis-ci.org/fursich/exception_file_notifier)
|
5
|
+
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)
|
4
6
|
|
5
|
-
|
7
|
+
**Exception File Notifier** is a custom notifier for [Exception Notification](https://github.com/smartinez87/exception_notification), that records notifications onto a log file when errors occur in a Rack/Rails application.
|
8
|
+
|
9
|
+
All the error logs are converted into JSON format. This would be useful typically when you wish to monitor an app with monitoring tools - e.g. Kibana + ElasticSearch + Fluentd, or anything alike.
|
6
10
|
|
7
11
|
## Installation
|
8
12
|
|
@@ -22,7 +26,53 @@ Or install it yourself as:
|
|
22
26
|
|
23
27
|
## Usage
|
24
28
|
|
25
|
-
|
29
|
+
Set proper configs in *config/initializers/exception_notification.rb*
|
30
|
+
|
31
|
+
To get started, use the simplest settings:
|
32
|
+
|
33
|
+
```ruby:config/initializers/exception_notification.rb
|
34
|
+
ExceptionNotification.configure do |config|
|
35
|
+
|
36
|
+
config.add_notifier :file, {
|
37
|
+
filename: "#{Rails.root}/log/exceptions.log"
|
38
|
+
}
|
39
|
+
```
|
40
|
+
|
41
|
+
That works in all the environment (including test).
|
42
|
+
|
43
|
+
You could also customize settings like so:
|
44
|
+
|
45
|
+
```ruby:config/initializers/exception_notification.rb
|
46
|
+
ExceptionNotification.configure do |config|
|
47
|
+
|
48
|
+
# disable all the notifiers in certain environment
|
49
|
+
config.ignore_if do |exception, options|
|
50
|
+
Rails.env.test?
|
51
|
+
end
|
52
|
+
|
53
|
+
config.add_notifier :file, {
|
54
|
+
filename: "#{Rails.root}/log/exceptions_#{Rails.env}.log", # generate different log files depending on environments
|
55
|
+
shift_age: 'daily' # use shift_age/shift_size options to rotate log files
|
56
|
+
}
|
57
|
+
```
|
58
|
+
|
59
|
+
You could also pass as many original values as you like, which will be evaluated JSON-ified at the time when an exception occurs. For detailed setting you may wish to consult with the Exception Notification [original readme](https://github.com/smartinez87/exception_notification).
|
60
|
+
|
61
|
+
#### available options:
|
62
|
+
|
63
|
+
- filename: specify the log file (preferablly with its absolute path)
|
64
|
+
|
65
|
+
- shift_age: option for log file rotation: directly passed to Ruby Logger
|
66
|
+
|
67
|
+
- shift_size: option for log file rotation: directly passed to Ruby Logger
|
68
|
+
|
69
|
+
(for the latter options see also: https://docs.ruby-lang.org/ja/latest/method/Logger/s/new.html)
|
70
|
+
|
71
|
+
#### Note
|
72
|
+
|
73
|
+
Due to [a bug](https://bugs.ruby-lang.org/issues/12948) with ruby Logger discovered in ruby 2.2 - 2.3, it might happen that you cannot rotate logs by using shift_age. (for those who come up with any workaround for this, please let us know / PR are welcomed)
|
74
|
+
|
75
|
+
Meanwhile you could cope with either 1) upgrading your ruby version upto 2.4, or 2) rotate logs by size, not date
|
26
76
|
|
27
77
|
## Development
|
28
78
|
|
@@ -34,6 +84,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
34
84
|
|
35
85
|
Bug reports and pull requests are welcome on GitHub at https://github.com/fursich/exception_file_notifier.
|
36
86
|
|
87
|
+
## Special Thanks To
|
88
|
+
|
89
|
+
All the folks who have given supports, especially @motchang and @katsurak for great advises and reviews.
|
37
90
|
|
38
91
|
## License
|
39
92
|
|
@@ -32,12 +32,11 @@ Gem::Specification.new do |spec|
|
|
32
32
|
|
33
33
|
spec.required_ruby_version = '>= 2.1'
|
34
34
|
spec.required_rubygems_version = '>= 1.8.11'
|
35
|
-
|
35
|
+
spec.add_dependency "exception_notification", ">= 4.0"
|
36
|
+
spec.add_dependency("activesupport", ">= 4.0", "<7")
|
36
37
|
|
37
|
-
spec.add_development_dependency "bundler", "
|
38
|
-
spec.add_development_dependency "rake", "
|
39
|
-
spec.add_development_dependency "rspec", "
|
40
|
-
spec.add_development_dependency "rails", ">= 4.0", "< 6"
|
38
|
+
spec.add_development_dependency "bundler", ">= 2"
|
39
|
+
spec.add_development_dependency "rake", ">= 10.0"
|
40
|
+
spec.add_development_dependency "rspec", ">= 3.0"
|
41
41
|
spec.add_development_dependency "pry"
|
42
|
-
spec.add_dependency "exception_notification", ">= 4.0"
|
43
42
|
end
|
@@ -145,7 +145,7 @@ module ExceptionNotifier
|
|
145
145
|
end
|
146
146
|
|
147
147
|
def encode_to_utf8(str)
|
148
|
-
quick_sanitization(str).encode(::Encoding.find('UTF-8'),
|
148
|
+
quick_sanitization(str).encode(::Encoding.find('UTF-8'), invalid: :replace, undef: :replace, replace: '?')
|
149
149
|
end
|
150
150
|
|
151
151
|
def quick_sanitization(str) # stringify any random objects in a safe (and convenient) manner
|
metadata
CHANGED
@@ -1,105 +1,105 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exception_file_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koji Onishi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: exception_notification
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
type: :
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
|
33
|
+
version: '4.0'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '7'
|
37
|
+
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
43
|
+
version: '4.0'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '7'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
48
|
+
name: bundler
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - "
|
51
|
+
- - ">="
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
53
|
+
version: '2'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - "
|
58
|
+
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
60
|
+
version: '2'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
62
|
+
name: rake
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - ">="
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
62
|
-
- - "<"
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: '6'
|
67
|
+
version: '10.0'
|
65
68
|
type: :development
|
66
69
|
prerelease: false
|
67
70
|
version_requirements: !ruby/object:Gem::Requirement
|
68
71
|
requirements:
|
69
72
|
- - ">="
|
70
73
|
- !ruby/object:Gem::Version
|
71
|
-
version: '
|
72
|
-
- - "<"
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '6'
|
74
|
+
version: '10.0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: rspec
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0'
|
81
|
+
version: '3.0'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0'
|
88
|
+
version: '3.0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
90
|
+
name: pry
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
96
|
-
type: :
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
102
|
+
version: '0'
|
103
103
|
description: " Exception File Notifier records exception logs in JSON format, helping
|
104
104
|
you track errors in the production environment. "
|
105
105
|
email:
|
@@ -140,8 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: 1.8.11
|
142
142
|
requirements: []
|
143
|
-
|
144
|
-
rubygems_version: 2.5.1
|
143
|
+
rubygems_version: 3.0.3
|
145
144
|
signing_key:
|
146
145
|
specification_version: 4
|
147
146
|
summary: A custom notifier for ExceptionNotification that generates exception log
|