slf4j 1.5.6.2 → 1.5.6.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,17 +1,21 @@
1
- === 1.5.6.2 / 2009-04-04
2
-
1
+ === 1.5.6.3 (2009-4-25)
2
+ * Added SLF4J::JUL for controlling java.util.logging, including
3
+ JUL.replace_root_handlers which removes all existing handlers and
4
+ add SLF4JBridgeHandler for exclusive routing to SLF4J for use with
5
+ 'jul-to-slf4j'.
6
+ * Added require 'slf4j' to each adapter loader.
7
+ * Use rdoc 2.4.3 and hoe 1.12.2 for build.
8
+
9
+ === 1.5.6.2 (2009-4-4)
3
10
  * Fixed previously lost rdoc due to base vs slf4j.rb manifest order.
4
11
 
5
- === 1.5.6.1 / 2008-12-06
6
-
12
+ === 1.5.6.1 (2008-12-6)
7
13
  * Upgraded to SLF4J 1.5.6
8
14
  * SLF4JBase -rename-> SLF4J
9
15
 
10
- === 1.5.5.1 / 2008-11-01
11
-
16
+ === 1.5.5.1 (2008-11-1)
12
17
  * Upgraded to SLF4J 1.5.5
13
18
 
14
- === 1.5.3.1 / 2008-10-08
15
-
19
+ === 1.5.3.1 (2008-10-8)
16
20
  * Initial release based on SLF4J 1.5.3
17
21
 
@@ -6,8 +6,9 @@ pom.xml
6
6
  assembly.xml
7
7
  lib/slf4j/base.rb
8
8
  lib/slf4j.rb
9
- test/test_slf4j.rb
10
9
  lib/slf4j/jul-to-slf4j.rb
10
+ lib/slf4j/jul.rb
11
+ test/test_slf4j.rb
11
12
  lib/slf4j/jdk14.rb
12
13
  lib/slf4j/jcl-over-slf4j.rb
13
14
  lib/slf4j/jcl.rb
data/Rakefile CHANGED
@@ -34,6 +34,7 @@ ENV['NODOT'] = "no thank you"
34
34
  require 'slf4j/base'
35
35
 
36
36
  loaders = SLF4J::ADAPTERS.flatten.compact
37
+ loaders.delete( "jul-to-slf4j" ) # exception: maintained as source
37
38
  loader_files = loaders.map { |adp| "lib/slf4j/#{adp}.rb" }
38
39
 
39
40
  jars = [ 'slf4j-api' ]
@@ -55,6 +56,8 @@ pom.xml
55
56
  assembly.xml
56
57
  lib/slf4j/base.rb
57
58
  lib/slf4j.rb
59
+ lib/slf4j/jul-to-slf4j.rb
60
+ lib/slf4j/jul.rb
58
61
  test/test_slf4j.rb
59
62
  END
60
63
  out.puts loader_files
@@ -68,6 +71,7 @@ loaders.each do |adapter|
68
71
  file "lib/slf4j/#{adapter}.rb" do
69
72
  out = File.new( "lib/slf4j/#{adapter}.rb", 'w' )
70
73
  begin
74
+ out.puts "require 'slf4j'"
71
75
  out.puts "SLF4J.require_adapter( '#{adapter}' )"
72
76
  ensure
73
77
  out.close
@@ -108,9 +112,7 @@ task :tag do
108
112
  sh %{git tag -s -f -m "tag [#{tag}]" "#{tag}"}
109
113
  end
110
114
 
111
-
112
115
  hoe = Hoe.new( "slf4j", SLF4J::VERSION ) do |p|
113
116
  p.developer( "David Kellum", "dek-ruby@gravitext.com" )
114
117
  p.rubyforge_name = "rjack"
115
- p.rdoc_pattern = /^(lib.*\.(rb|txt))|[^\/]*\.txt$/
116
118
  end
@@ -37,26 +37,34 @@ require 'java'
37
37
  #
38
38
  # == Adapters
39
39
  #
40
- # All of the following output adapters are available via +require+:
40
+ # An output adapter must be required before the first log call. All
41
+ # of the following output adapters are available via +require+ from
42
+ # the slf4j gem:
41
43
  #
42
44
  # require 'slf4j/jcl' # Output to Jakarta Commons Logging
43
- # require 'slf4j/jdk14' # JDK java.util.logging
45
+ # require 'slf4j/jdk14' # JDK java.util.logging (JUL)
44
46
  # require 'slf4j/log4j12' # Log4j (provided elsewhere)
45
47
  # require 'slf4j/nop' # NOP null logger (provided)
46
48
  # require 'slf4j/simple' # Simple logger (provided)
47
49
  #
48
- # The first loaded output adapter wins (as with mulitple adapters on
50
+ # The Logback[http://rjack.rubyforge.org/logback/index.html] gem may
51
+ # also be be used as the output adapter:
52
+ #
53
+ # require 'logback'
54
+ #
55
+ # The first loaded output adapter wins (as with multiple adapters on
49
56
  # the classpath). A warning will be logged to "slf4j" if an attempt is
50
57
  # made to require a second output adapter.
51
58
  #
52
- # And the following input adapters will intercept JCL,
53
- # java.util.logging (jdk14), or log4j log output and direct it through
54
- # SLF4J:
59
+ # The following input adapters will intercept JCL, java.util.logging
60
+ # (JUL), or log4j log output and direct it through SLF4J:
55
61
  #
56
62
  # require 'slf4j/jcl-over-slf4j' # Route Jakarta Commons Logging to SLF4J
57
- # require 'slf4j/jul-to-slf4j' # JDK java.util.logging to SLF4J
58
63
  # require 'slf4j/log4j-over-slf4j' # Log4j to SLF4J
59
64
  #
65
+ # require 'slf4j/jul-to-slf4j' # JDK java.util.logging (JUL) to SLF4J
66
+ # SLF4J::JUL.replace_root_handlers # Special case setup for JUL
67
+ #
60
68
  # Multiple input adapters may be require'd. However, a RuntimeError
61
69
  # will be raised in the attempt to require both an output adapter and
62
70
  # input adapter from/to the same interface, for example
@@ -101,11 +109,6 @@ module SLF4J
101
109
  require_jar( name )
102
110
  end
103
111
 
104
- # Special case, requires explicit 'install'
105
- if name == 'jul-to-slf4j'
106
- org.slf4j.bridge.SLF4JBridgeHandler.install
107
- end
108
-
109
112
  @@loaded[ name ] = true
110
113
  end
111
114
 
@@ -28,7 +28,7 @@ module SLF4J
28
28
  # SLF4J-java version
29
29
  SLF4J_VERSION = '1.5.6'
30
30
  # SLF4J gem version
31
- VERSION = SLF4J_VERSION + '.2'
31
+ VERSION = SLF4J_VERSION + '.3'
32
32
 
33
33
  SLF4J_DIR = File.dirname(__FILE__) # :nodoc:
34
34
 
@@ -1 +1,2 @@
1
+ require 'slf4j'
1
2
  SLF4J.require_adapter( 'jcl-over-slf4j' )
@@ -1 +1,2 @@
1
+ require 'slf4j'
1
2
  SLF4J.require_adapter( 'jcl' )
@@ -1 +1,2 @@
1
+ require 'slf4j'
1
2
  SLF4J.require_adapter( 'jdk14' )
@@ -1 +1,21 @@
1
+ require 'slf4j'
2
+ require 'slf4j/jul'
3
+
1
4
  SLF4J.require_adapter( 'jul-to-slf4j' )
5
+
6
+ module SLF4J::JUL
7
+
8
+ # Replace any existing configured root java.util.Logger Handlers with
9
+ # the org.slf4j.bridge.SLF4JBridgeHandler
10
+ def self.replace_root_handlers
11
+ root_logger = root
12
+ root_logger.handlers.each do |handler|
13
+ root_logger.remove_handler( handler )
14
+ end
15
+ handler = Java::org.slf4j.bridge.SLF4JBridgeHandler.new
16
+
17
+ root_logger.add_handler( handler )
18
+ end
19
+
20
+ end
21
+
@@ -0,0 +1,76 @@
1
+ #--
2
+ # Copyright (C) 2009 David Kellum
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person
5
+ # obtaining a copy of this software and associated documentation files
6
+ # (the "Software"), to deal in the Software without restriction,
7
+ # including without limitation the rights to use, copy, modify, merge,
8
+ # publish, distribute, sublicense, and/or sell copies of the Software,
9
+ # and to permit persons to whom the Software is furnished to do so,
10
+ # subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19
+ # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20
+ # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
23
+ #++
24
+
25
+ require 'java'
26
+
27
+ # Utilities for finer grain control of the JDK java.util.logging
28
+ # (JUL). In particular, unlike other logging API's reimplemented by
29
+ # slf4j adapters, JUL log levels remain significant for enabling output
30
+ # or avoiding log message generation cycles. For a particular
31
+ # level to be output, both JUL and the destination SLF4J output adapter
32
+ # must enable it.
33
+ #
34
+ # == Usage
35
+ #
36
+ # Adjust JUL levels (in conjunction with 'slf4j/jul-to-slf4j' or
37
+ # 'slf4j/jdk14', see SLF4J.)
38
+ #
39
+ # require 'slf4j/jul'
40
+ # SLF4J::JUL[ "my.jul.logger" ].level = SLF4J::JUL::FINER
41
+ #
42
+ # Direct all output to SLF4J (output adapter != 'jdk14')
43
+ #
44
+ # require 'slf4j/jul-to-slf4j'
45
+ # SLF4J::JUL.replace_root_handlers
46
+ #
47
+ module SLF4J::JUL
48
+ LogManager = Java::java.util.logging.LogManager
49
+ Logger = Java::java.util.logging.Logger
50
+ Level = Java::java.util.logging.Level
51
+
52
+ SEVERE = Level::SEVERE
53
+ WARNING = Level::WARNING
54
+ INFO = Level::INFO
55
+ CONFIG = Level::CONFIG
56
+ FINE = Level::FINE
57
+ FINER = Level::FINER
58
+ FINEST = Level::FINEST
59
+ ALL = Level::ALL
60
+
61
+ # Global java.util.logging.LogManager reset: close any handlers and
62
+ # set root level to INFO.
63
+ def self.reset
64
+ LogManager.log_manager.reset
65
+ end
66
+
67
+ # Get java.util.logging.Logger by name (responds to level=, etc.)
68
+ def self.[]( name )
69
+ Logger.get_logger( name )
70
+ end
71
+
72
+ # Get the root logger (empty string name)
73
+ def self.root
74
+ Logger.get_logger( "" )
75
+ end
76
+ end
@@ -1 +1,2 @@
1
+ require 'slf4j'
1
2
  SLF4J.require_adapter( 'log4j-over-slf4j' )
@@ -1 +1,2 @@
1
+ require 'slf4j'
1
2
  SLF4J.require_adapter( 'log4j12' )
@@ -1 +1,2 @@
1
+ require 'slf4j'
1
2
  SLF4J.require_adapter( 'nop' )
@@ -1 +1,2 @@
1
+ require 'slf4j'
1
2
  SLF4J.require_adapter( 'simple' )
metadata CHANGED
@@ -43,8 +43,9 @@ files:
43
43
  - assembly.xml
44
44
  - lib/slf4j/base.rb
45
45
  - lib/slf4j.rb
46
- - test/test_slf4j.rb
47
46
  - lib/slf4j/jul-to-slf4j.rb
47
+ - lib/slf4j/jul.rb
48
+ - test/test_slf4j.rb
48
49
  - lib/slf4j/jdk14.rb
49
50
  - lib/slf4j/jcl-over-slf4j.rb
50
51
  - lib/slf4j/jcl.rb
@@ -74,12 +75,12 @@ requirements: []
74
75
 
75
76
  authors:
76
77
  - David Kellum
77
- date: 2009-04-04 08:00:00 +00:00
78
+ date: 2009-04-26 08:00:00 +00:00
78
79
  platform: ruby
79
80
  test_files:
80
81
  - test/test_slf4j.rb
81
82
  version: !ruby/object:Gem::Version
82
- version: 1.5.6.2
83
+ version: 1.5.6.3
83
84
  require_paths:
84
85
  - lib
85
86
  dependencies:
@@ -88,7 +89,7 @@ dependencies:
88
89
  requirements:
89
90
  - - '>='
90
91
  - !ruby/object:Gem::Version
91
- version: 1.8.2
92
+ version: 1.12.2
92
93
  version:
93
94
  type: :development
94
95
  version_requirement: