trinidad_logging_extension 0.2.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/LICENSE +1 -0
- data/README +16 -4
- data/lib/trinidad_logging_extension.rb +46 -7
- data/lib/trinidad_logging_extension/jars.rb +33 -0
- data/trinidad-libs/jcl-over-slf4j-1.6.1.jar +0 -0
- data/trinidad-libs/jul-to-slf4j-1.6.1.jar +0 -0
- data/trinidad-libs/logback-classic-0.9.29.jar +0 -0
- data/trinidad-libs/logback-core-0.9.29.jar +0 -0
- data/trinidad-libs/slf4j-api-1.6.1.jar +0 -0
- data/trinidad-libs/slf4j-jdk14-1.6.1.jar +0 -0
- data/trinidad-libs/slf4j-log4j12-1.6.1.jar +0 -0
- data/trinidad_logging_extension.gemspec +10 -2
- metadata +64 -78
data/History.txt
CHANGED
data/LICENSE
CHANGED
data/README
CHANGED
@@ -3,7 +3,12 @@ Trinidad Logging Extension
|
|
3
3
|
|
4
4
|
# DESCRIPTION
|
5
5
|
|
6
|
-
Extension to enhance the Trinidad's logging
|
6
|
+
Extension to enhance the Trinidad's logging by routing it through one of:
|
7
|
+
- Log4j (http://logging.apache.org/log4j/index.html)
|
8
|
+
- Logback (http://logback.qos.ch/)
|
9
|
+
- java.util.logging
|
10
|
+
|
11
|
+
SLF4J and the jruby-rack slf4j RackLogger are used to abstract the different implementations
|
7
12
|
|
8
13
|
# INSTALLATION
|
9
14
|
|
@@ -11,9 +16,14 @@ jruby -S gem install trinidad_logging_extension
|
|
11
16
|
|
12
17
|
# CONFIGURATION
|
13
18
|
|
14
|
-
The extension needs a configuration file for
|
15
|
-
|
16
|
-
|
19
|
+
The extension needs a configuration file for the chosen logging system. This file can be overridden in config
|
20
|
+
- Log4j (Default)
|
21
|
+
Default configuration file: 'config/trinidad-logging.properties'
|
22
|
+
- Logback
|
23
|
+
Default configuration file: 'config/trinidad-logging.xml'
|
24
|
+
- java.util.logging
|
25
|
+
Default configuration file: 'config/trinidad-logging.properties'
|
26
|
+
|
17
27
|
|
18
28
|
To enable the extension add this to your trinidad.yml:
|
19
29
|
|
@@ -21,6 +31,7 @@ To enable the extension add this to your trinidad.yml:
|
|
21
31
|
extensions:
|
22
32
|
logging:
|
23
33
|
config: other_properties.properties # This field is optional
|
34
|
+
logging_system: log4j # This field is optional defaulting to 'log4j'. 'logback', and 'jul' are also valid choices
|
24
35
|
|
25
36
|
This is an example of configuration file extracted from the Tomcat's documentation:
|
26
37
|
|
@@ -37,3 +48,4 @@ You can find further information on how to write your own extension in the wiki:
|
|
37
48
|
# Copyright
|
38
49
|
|
39
50
|
Copyright (c) 2010 David Calavera. See LICENSE for details.
|
51
|
+
Copyright (c) 2011 Michael Leinartas. See LICENSE for details.
|
@@ -1,18 +1,57 @@
|
|
1
1
|
module Trinidad
|
2
2
|
module Extensions
|
3
3
|
module Logging
|
4
|
-
VERSION = '0.
|
4
|
+
VERSION = '1.0.0'
|
5
5
|
end
|
6
6
|
|
7
|
-
|
8
|
-
require File.expand_path('../trinidad-libs/juli-adapters', __DIR__)
|
9
|
-
require File.expand_path('../trinidad-libs/log4j-1.2.16', __DIR__)
|
7
|
+
require 'trinidad_logging_extension/jars'
|
10
8
|
|
11
9
|
class LoggingServerExtension < ServerExtension
|
10
|
+
include Trinidad::Extensions::LoggingJars
|
11
|
+
|
12
12
|
def configure(tomcat)
|
13
|
-
@options[:
|
14
|
-
|
15
|
-
|
13
|
+
@options[:logging_system] ||= 'log4j'
|
14
|
+
@options[:config] ||= @options[:logging_system].eql? 'logback' ?
|
15
|
+
'config/trinidad-logging.xml' : 'config/trinidad-logging.properties'
|
16
|
+
|
17
|
+
require_common_jars
|
18
|
+
|
19
|
+
case @options[:logging_system]
|
20
|
+
when 'log4j'
|
21
|
+
set_config_property 'log4j.configuration'
|
22
|
+
require_log4j_jars
|
23
|
+
configure_jul_bridge
|
24
|
+
when 'logback'
|
25
|
+
set_config_property 'logback.configurationFile'
|
26
|
+
require_logback_jars
|
27
|
+
configure_jul_bridge
|
28
|
+
when 'jul', 'jdk14', 'util'
|
29
|
+
set_config_property('java.util.logging.config.file', false)
|
30
|
+
require_jul_jars
|
31
|
+
java_import 'java.util.logging.LogManager'
|
32
|
+
java.util.logging.LogManager.getLogManager.readConfiguration
|
33
|
+
else
|
34
|
+
return
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def configure_jul_bridge
|
39
|
+
java_import 'org.slf4j.bridge.SLF4JBridgeHandler'
|
40
|
+
org.slf4j.bridge.SLF4JBridgeHandler.install
|
41
|
+
end
|
42
|
+
|
43
|
+
def set_config_property(property_name, url=true)
|
44
|
+
config_file = File.expand_path(@options[:config])
|
45
|
+
if url
|
46
|
+
config_file = java.io.File.new(config_file).to_url.to_s
|
47
|
+
end
|
48
|
+
java.lang.System.set_property(property_name, config_file)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class LoggingWebAppExtension < WebAppExtension
|
53
|
+
def configure(tomcat, app_context)
|
54
|
+
app_context.add_parameter('jruby.rack.logging', 'slf4j')
|
16
55
|
end
|
17
56
|
end
|
18
57
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
$:.unshift(File.expand_path"../../trinidad-libs", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
module Trinidad
|
4
|
+
module Extensions
|
5
|
+
module LoggingJars
|
6
|
+
SLF4J_VERSION = '1.6.1'
|
7
|
+
LOG4J_VERSION = '1.2.16'
|
8
|
+
LOGBACK_VERSION = '0.9.29'
|
9
|
+
|
10
|
+
def require_common_jars
|
11
|
+
require "slf4j-api-#{SLF4J_VERSION}.jar"
|
12
|
+
require "juli-adapters.jar"
|
13
|
+
require "jcl-over-slf4j-#{SLF4J_VERSION}.jar"
|
14
|
+
end
|
15
|
+
|
16
|
+
def require_log4j_jars
|
17
|
+
require "slf4j-log4j12-#{SLF4J_VERSION}.jar"
|
18
|
+
require "log4j-#{LOG4J_VERSION}"
|
19
|
+
require "jul-to-slf4j-#{SLF4J_VERSION}.jar"
|
20
|
+
end
|
21
|
+
|
22
|
+
def require_logback_jars
|
23
|
+
require "logback-core-#{LOGBACK_VERSION}.jar"
|
24
|
+
require "logback-classic-#{LOGBACK_VERSION}.jar"
|
25
|
+
require "jul-to-slf4j-#{SLF4J_VERSION}.jar"
|
26
|
+
end
|
27
|
+
|
28
|
+
def require_jul_jars
|
29
|
+
require "slf4j-jdk14-#{SLF4J_VERSION}.jar"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'trinidad_logging_extension'
|
16
|
-
s.version = '0.
|
17
|
-
s.date = '
|
16
|
+
s.version = '1.0.0'
|
17
|
+
s.date = '2011-08-18'
|
18
18
|
s.rubyforge_project = 'trinidad_logging_extension'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
@@ -57,8 +57,16 @@ Gem::Specification.new do |s|
|
|
57
57
|
README
|
58
58
|
Rakefile
|
59
59
|
lib/trinidad_logging_extension.rb
|
60
|
+
lib/trinidad_logging_extension/jars.rb
|
61
|
+
trinidad-libs/jcl-over-slf4j-1.6.1.jar
|
62
|
+
trinidad-libs/jul-to-slf4j-1.6.1.jar
|
60
63
|
trinidad-libs/juli-adapters.jar
|
61
64
|
trinidad-libs/log4j-1.2.16.jar
|
65
|
+
trinidad-libs/logback-classic-0.9.29.jar
|
66
|
+
trinidad-libs/logback-core-0.9.29.jar
|
67
|
+
trinidad-libs/slf4j-api-1.6.1.jar
|
68
|
+
trinidad-libs/slf4j-jdk14-1.6.1.jar
|
69
|
+
trinidad-libs/slf4j-log4j12-1.6.1.jar
|
62
70
|
trinidad_logging_extension.gemspec
|
63
71
|
]
|
64
72
|
# = MANIFEST =
|
metadata
CHANGED
@@ -1,67 +1,51 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trinidad_logging_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 1
|
10
|
-
version: 0.2.1
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
|
-
- David Calavera
|
8
|
+
- David Calavera
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date:
|
13
|
+
date: 2011-08-18 00:00:00 -07:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
|
-
requirements:
|
57
|
-
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
hash: 3
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
version: "0"
|
63
|
-
type: :development
|
64
|
-
version_requirements: *id003
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: trinidad
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.9.1
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0"
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: mocha
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id003
|
65
49
|
description: Configure logging service for Trinidad
|
66
50
|
email: calavera@apache.org
|
67
51
|
executables: []
|
@@ -69,48 +53,50 @@ executables: []
|
|
69
53
|
extensions: []
|
70
54
|
|
71
55
|
extra_rdoc_files:
|
72
|
-
- README
|
73
|
-
- LICENSE
|
56
|
+
- README
|
57
|
+
- LICENSE
|
74
58
|
files:
|
75
|
-
- History.txt
|
76
|
-
- LICENSE
|
77
|
-
- README
|
78
|
-
- Rakefile
|
79
|
-
- lib/trinidad_logging_extension.rb
|
80
|
-
-
|
81
|
-
- trinidad-libs/
|
82
|
-
-
|
59
|
+
- History.txt
|
60
|
+
- LICENSE
|
61
|
+
- README
|
62
|
+
- Rakefile
|
63
|
+
- lib/trinidad_logging_extension.rb
|
64
|
+
- lib/trinidad_logging_extension/jars.rb
|
65
|
+
- trinidad-libs/jcl-over-slf4j-1.6.1.jar
|
66
|
+
- trinidad-libs/jul-to-slf4j-1.6.1.jar
|
67
|
+
- trinidad-libs/juli-adapters.jar
|
68
|
+
- trinidad-libs/log4j-1.2.16.jar
|
69
|
+
- trinidad-libs/logback-classic-0.9.29.jar
|
70
|
+
- trinidad-libs/logback-core-0.9.29.jar
|
71
|
+
- trinidad-libs/slf4j-api-1.6.1.jar
|
72
|
+
- trinidad-libs/slf4j-jdk14-1.6.1.jar
|
73
|
+
- trinidad-libs/slf4j-log4j12-1.6.1.jar
|
74
|
+
- trinidad_logging_extension.gemspec
|
83
75
|
has_rdoc: true
|
84
76
|
homepage: http://github.com/calavera/trinidad_logging_extension
|
85
77
|
licenses: []
|
86
78
|
|
87
79
|
post_install_message:
|
88
80
|
rdoc_options:
|
89
|
-
- --charset=UTF-8
|
81
|
+
- --charset=UTF-8
|
90
82
|
require_paths:
|
91
|
-
- lib
|
83
|
+
- lib
|
92
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
85
|
none: false
|
94
86
|
requirements:
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
segments:
|
99
|
-
- 0
|
100
|
-
version: "0"
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
101
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
91
|
none: false
|
103
92
|
requirements:
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
segments:
|
108
|
-
- 0
|
109
|
-
version: "0"
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: "0"
|
110
96
|
requirements: []
|
111
97
|
|
112
98
|
rubyforge_project: trinidad_logging_extension
|
113
|
-
rubygems_version: 1.
|
99
|
+
rubygems_version: 1.5.1
|
114
100
|
signing_key:
|
115
101
|
specification_version: 2
|
116
102
|
summary: Logging extension for Trinidad
|