torquebox-core 4.0.0.beta1-java → 4.0.0.beta2-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/torquebox-core.jar +0 -0
- data/lib/torquebox/cli/jar.rb +1 -1
- data/lib/torquebox/logger.rb +168 -1
- data/lib/torquebox/version.rb +2 -2
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 064ab706a2d83b43252af08da71d29b9770a95cc
|
4
|
+
data.tar.gz: e63a2845b426855b3ba7fef611558bb759a5273d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eac2bfbda2e5404d0a2bb9fef0ec46b7ad760d9c8a1e79e19765b9a4728ebb0d728842835695a0c3165cc72bfde85e19eaaf3a55890767a632697dcfadaa0d3c
|
7
|
+
data.tar.gz: f8c2cdf6d27a2250742a5d272dc3a389caebe0fc4760703aedd6a6c3a74f6fb8f0706f151cb9f3c9393465892db787f4a61c7450514caa70a21dce4d890d1556
|
data/lib/torquebox-core.jar
CHANGED
Binary file
|
data/lib/torquebox/cli/jar.rb
CHANGED
data/lib/torquebox/logger.rb
CHANGED
@@ -12,16 +12,183 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
require 'logger'
|
16
|
+
require 'stringio'
|
15
17
|
|
16
18
|
module TorqueBox
|
17
19
|
class Logger
|
20
|
+
|
21
|
+
java_import org.projectodd.wunderboss::WunderBoss
|
22
|
+
java_import org.projectodd.wunderboss::LogbackUtil
|
23
|
+
java_import Java::ch.qos.logback.classic.joran.JoranConfigurator
|
24
|
+
java_import Java::ch.qos.logback.core.joran.spi::JoranException
|
25
|
+
|
26
|
+
DEFAULT_CATEGORY = 'TorqueBox'.freeze
|
27
|
+
|
28
|
+
STD_LOGGER_LEVELS = {
|
29
|
+
::Logger::DEBUG => 'DEBUG',
|
30
|
+
::Logger::INFO => 'INFO',
|
31
|
+
::Logger::WARN => 'WARN',
|
32
|
+
::Logger::ERROR => 'ERROR',
|
33
|
+
::Logger::FATAL => 'FATAL'
|
34
|
+
}
|
35
|
+
|
18
36
|
class << self
|
19
37
|
attr_reader :log_level
|
20
38
|
|
21
39
|
def log_level=(level)
|
22
40
|
@log_level = level
|
23
|
-
|
41
|
+
WunderBoss.log_level = level
|
42
|
+
end
|
43
|
+
|
44
|
+
def context
|
45
|
+
@context ||= org.slf4j.LoggerFactory.getILoggerFactory
|
24
46
|
end
|
47
|
+
|
48
|
+
def configure_with_xml(xml)
|
49
|
+
context.reset
|
50
|
+
configurator = JoranConfigurator.new
|
51
|
+
configurator.context = context
|
52
|
+
configurator.do_configure(xml)
|
53
|
+
rescue JoranException
|
54
|
+
configurator.do_configure(StringIO.new(xml).to_inputstream)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
attr_accessor :formatter
|
59
|
+
|
60
|
+
# Wraps a WunderBoss logger
|
61
|
+
#
|
62
|
+
# @param name [Object] Name for the logger
|
63
|
+
def initialize(name = DEFAULT_CATEGORY)
|
64
|
+
@logger = WunderBoss.logger(name.to_s.gsub('::', '.'))
|
65
|
+
end
|
66
|
+
|
67
|
+
# Reports if TRACE level is enabled
|
68
|
+
#
|
69
|
+
# @return [true, false] true if TRACE is enabled
|
70
|
+
def trace?
|
71
|
+
@logger.trace_enabled?
|
72
|
+
end
|
73
|
+
|
74
|
+
# Reports if DEBUG level is enabled
|
75
|
+
#
|
76
|
+
# @return [true, false] true if DEBUG is enabled
|
77
|
+
def debug?
|
78
|
+
@logger.debug_enabled?
|
79
|
+
end
|
80
|
+
|
81
|
+
# Reports if INFO level is enabled
|
82
|
+
#
|
83
|
+
# @return [true, false] true if INFO is enabled
|
84
|
+
def info?
|
85
|
+
@logger.info_enabled?
|
86
|
+
end
|
87
|
+
|
88
|
+
# Reports if WARN level is enabled
|
89
|
+
#
|
90
|
+
# @return [true, false] true if WARN is enabled
|
91
|
+
def warn?
|
92
|
+
@logger.warn_enabled?
|
93
|
+
end
|
94
|
+
|
95
|
+
# Reports if ERROR level is enabled
|
96
|
+
#
|
97
|
+
# @return [true, false] true if ERROR is enabled
|
98
|
+
def error?
|
99
|
+
@logger.error_enabled?
|
100
|
+
end
|
101
|
+
|
102
|
+
# @!method fatal?()
|
103
|
+
#
|
104
|
+
# Reports if FATAL level is enabled
|
105
|
+
#
|
106
|
+
# @return [true, false] true if FATAL is enabled
|
107
|
+
alias_method :fatal?, :error?
|
108
|
+
|
109
|
+
# Logs a message at the TRACE level
|
110
|
+
#
|
111
|
+
# @param message [String] the message to log
|
112
|
+
# @return [void]
|
113
|
+
def trace(*params, &block)
|
114
|
+
add(:trace, *params, &block)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Logs a message at the DEBUG level
|
118
|
+
#
|
119
|
+
# @param message [String] the message to log
|
120
|
+
# @return [void]
|
121
|
+
def debug(*params, &block)
|
122
|
+
add(:debug, *params, &block)
|
123
|
+
end
|
124
|
+
|
125
|
+
# Logs a message at the INFO level
|
126
|
+
#
|
127
|
+
# @param message [String] the message to log
|
128
|
+
# @return [void]
|
129
|
+
def info(*params, &block)
|
130
|
+
add(:info, *params, &block)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Logs a message at the WARN level
|
134
|
+
#
|
135
|
+
# @param message [String] the message to log
|
136
|
+
# @return [void]
|
137
|
+
def warn(*params, &block)
|
138
|
+
add(:warn, *params, &block)
|
139
|
+
end
|
140
|
+
|
141
|
+
# Logs a message at the ERROR level
|
142
|
+
#
|
143
|
+
# @param message [String] the message to log
|
144
|
+
# @return [void]
|
145
|
+
def error(*params, &block)
|
146
|
+
add(:error, *params, &block)
|
147
|
+
end
|
148
|
+
|
149
|
+
# @!method fatal?()
|
150
|
+
#
|
151
|
+
# Logs a message at the FATAL level
|
152
|
+
#
|
153
|
+
# @param message [String] the message to log
|
154
|
+
# @return [void]
|
155
|
+
alias_method :fatal, :error
|
156
|
+
|
157
|
+
# Reports current logger's level
|
158
|
+
#
|
159
|
+
# @return [String] log level
|
160
|
+
def level
|
161
|
+
(@logger.level || @logger.effective_level).to_s
|
162
|
+
end
|
163
|
+
|
164
|
+
# Sets current logger's level
|
165
|
+
#
|
166
|
+
# @params [String] log level
|
167
|
+
# @returns [String] log level
|
168
|
+
def level=(new_level)
|
169
|
+
if new_level.respond_to?(:to_int)
|
170
|
+
new_level = STD_LOGGER_LEVELS[new_level]
|
171
|
+
end
|
172
|
+
|
173
|
+
LogbackUtil.set_log_level(@logger, new_level)
|
174
|
+
end
|
175
|
+
|
176
|
+
# Allow our logger to be used for env['rack.errors']
|
177
|
+
def puts(message)
|
178
|
+
info message.to_s
|
179
|
+
end
|
180
|
+
|
181
|
+
def write(message)
|
182
|
+
info message.strip
|
183
|
+
end
|
184
|
+
|
185
|
+
def flush; end
|
186
|
+
|
187
|
+
private
|
188
|
+
|
189
|
+
def add(severity, *params)
|
190
|
+
message = block_given? ? yield : params.shift
|
191
|
+
@logger.send(severity, message, *params)
|
25
192
|
end
|
26
193
|
end
|
27
194
|
end
|
data/lib/torquebox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torquebox-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.
|
4
|
+
version: 4.0.0.beta2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- The TorqueBox Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jbundler
|
@@ -74,32 +74,32 @@ extensions: []
|
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
76
|
- bin/torquebox
|
77
|
-
- lib/torquebox-core.jar
|
78
77
|
- lib/torquebox-core.rb
|
79
|
-
- lib/torquebox
|
78
|
+
- lib/torquebox-core.jar
|
79
|
+
- lib/wunderboss-jars/wunderboss-wildfly-0.8.0.jar
|
80
|
+
- lib/wunderboss-jars/wunderboss-core-0.8.0.jar
|
81
|
+
- lib/wunderboss-jars/logback-core-1.1.2.jar
|
82
|
+
- lib/wunderboss-jars/logback-classic-1.1.2.jar
|
83
|
+
- lib/wunderboss-jars/slf4j-api-1.7.5.jar
|
84
|
+
- lib/wunderboss-jars/wunderboss-ruby-0.8.0.jar
|
85
|
+
- lib/wunderboss-jars/jboss-logging-3.1.4.GA.jar
|
86
|
+
- lib/resources/logback-cli.xml
|
80
87
|
- lib/torquebox/spec_helpers.rb
|
81
|
-
- lib/torquebox/codecs.rb
|
82
|
-
- lib/torquebox/option_utils.rb
|
83
88
|
- lib/torquebox/logger.rb
|
84
89
|
- lib/torquebox/cli.rb
|
90
|
+
- lib/torquebox/codecs.rb
|
91
|
+
- lib/torquebox/option_utils.rb
|
92
|
+
- lib/torquebox/version.rb
|
93
|
+
- lib/torquebox/cli/jar.rb
|
94
|
+
- lib/torquebox/cli/war.rb
|
95
|
+
- lib/torquebox/cli/archive_cleaner.rb
|
96
|
+
- lib/torquebox/cli/archive.rb
|
85
97
|
- lib/torquebox/codecs/marshal_smart.rb
|
86
98
|
- lib/torquebox/codecs/marshal.rb
|
87
|
-
- lib/torquebox/codecs/edn.rb
|
88
99
|
- lib/torquebox/codecs/json.rb
|
100
|
+
- lib/torquebox/codecs/edn.rb
|
89
101
|
- lib/torquebox/codecs/marshal_base64.rb
|
90
102
|
- lib/torquebox/codecs/text.rb
|
91
|
-
- lib/torquebox/cli/archive_cleaner.rb
|
92
|
-
- lib/torquebox/cli/war.rb
|
93
|
-
- lib/torquebox/cli/jar.rb
|
94
|
-
- lib/torquebox/cli/archive.rb
|
95
|
-
- lib/wunderboss-jars/wunderboss-ruby-0.8.0.jar
|
96
|
-
- lib/wunderboss-jars/logback-classic-1.1.2.jar
|
97
|
-
- lib/wunderboss-jars/logback-core-1.1.2.jar
|
98
|
-
- lib/wunderboss-jars/wunderboss-core-0.8.0.jar
|
99
|
-
- lib/wunderboss-jars/jboss-logging-3.1.4.GA.jar
|
100
|
-
- lib/wunderboss-jars/slf4j-api-1.7.5.jar
|
101
|
-
- lib/wunderboss-jars/wunderboss-wildfly-0.8.0.jar
|
102
|
-
- lib/resources/logback-cli.xml
|
103
103
|
homepage: http://torquebox.org/4x
|
104
104
|
licenses:
|
105
105
|
- Apache-2.0
|