log4jruby 2.0.0.rc3-java → 2.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e08e6f11c96bbf03b26bad478e93323c326f6c88
4
- data.tar.gz: e4dd8ee67b8ed0ab344a208e23859eee67f9de69
3
+ metadata.gz: 8355e0417b5b8fa90580b2b5d47380ed4c70d634
4
+ data.tar.gz: 1a981572aafc5d7350c2aa0c2975bcec80a39976
5
5
  SHA512:
6
- metadata.gz: 2bd9e0c102ab901c70a072b5e9b8d77b094a7ae1d242b723e9e7f189c9d87e77c1ac5b17e57e0ffe5554cc4ebf159c27be2723d99b6bafe9d446155d8a3b2cbf
7
- data.tar.gz: aa40158379e0b483da052794623a22669213542026d439b4f88cedd35bc4a9176ccc9681bda1e76950577de3c3903c56c07d3bc2160686347de58e538913e781
6
+ metadata.gz: 2100d066da86f23d7a5a7d818d5e46bbb6811630d853def7c869acb0930e2c23e913039e8b5e63a56aba7fa0683c21d8f97f3310b788988a151dceb7b9af9442
7
+ data.tar.gz: abe6cbfceb161761850e867c5f9df6d339f7e3807ba9bb104822fca7db2b380c9fdd147c22f713e1678b6a1c919936ba5b04f9ce71980e1da7154b1f0c61be85
@@ -1,5 +1,13 @@
1
1
  # log4jruby Changelog
2
2
 
3
+ ## v2.0.1
4
+
5
+ * JRuby 9K compatibility - https://github.com/lenny/log4jruby/issues/14
6
+
7
+ ## v2.0.0
8
+
9
+ * Documentation additions, corrections.
10
+
3
11
  ## v2.0.0.rc3
4
12
 
5
13
  * Add Logger#silence for ActiveSupport::Logger compatibility - https://github.com/lenny/log4jruby/pull/11
@@ -1,26 +1,26 @@
1
1
 
2
2
 
3
- = Log4jruby
3
+ # Log4jruby
4
4
 
5
5
  * https://github.com/lenny/log4jruby
6
6
 
7
- == Description:
7
+ ## Description:
8
8
 
9
9
  Log4jruby is a thin wrapper around the {Log4j Logger}[http://logging.apache.org/log4j/1.2/apidocs/index.html].
10
10
  It is geared more toward those who are using JRuby to integrate with and build on top of Java code that uses Log4j.
11
- The <tt>Log4jruby::Logger</tt> provides an interface much like the standard ruby {Logger}[http://ruby-doc.org/core/classes/Logger.html].
11
+ The ```Log4jruby::Logger``` provides an interface much like the standard ruby [Logger](http://ruby-doc.org/core/classes/Logger.html).
12
12
  Logging is configured via traditional Log4j methods.
13
13
 
14
- The primary use case(i.e. mine) for this library is that you are already up and running with Log4j and now you want
14
+ The primary use case (i.e., mine) for this library is that you are already up and running with Log4j and now you want
15
15
  to use it for your Ruby code too. There is not much help here for configuration. In our environment, we deploy Rails
16
16
  apps that call and extend Java code into Tomcat as WARs and use a log4j.properties to configure. For the most part,
17
17
  all there is to using log4jruby is making sure the log4j jar is <tt>required</tt> and that Log4j is at least minimally
18
- configured(e.g. log4j.properties in the CLASSPATH). The examples should give you the idea.
18
+ configured (e.g., log4j.properties in the CLASSPATH). The examples should give you the idea.
19
19
 
20
- === Features
20
+ ### Features
21
21
 
22
- * Filename, line number, and method name are available(if tracing is on) to your appender layout via {MDC}[http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/MDC.html].
23
- * Exceptions can be logged directly and are output with backtraces. Java Exceptions(i.e. NativeExceptions)
22
+ * Filename, line number, and method name are available (if tracing is on) to your appender layout via [MDC](http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/MDC.html).
23
+ * Exceptions can be logged directly and are output with backtraces. Java Exceptions (i.e., NativeExceptions)
24
24
  are logged with full java backtrace(including nested exceptions).
25
25
  * Logging config for your ruby code can be added to your existing configuration. Ruby logger names are mapped to dot separated names prefixed with <tt>.jruby</tt>
26
26
 
@@ -31,7 +31,26 @@ configured(e.g. log4j.properties in the CLASSPATH). The examples should give you
31
31
  log4j.logger.jruby=info,Ruby
32
32
  log4j.logger.jruby.MyClass=debug
33
33
 
34
- === Examples
34
+ ### Configuration
35
+
36
+ As noted above, configuring log4j is left to the client. **You must load and configure log4j before requiring log4jruby**.
37
+ There are multiple ways to do so.
38
+ In our environment, we deploy Rails apps that call and extend Java code to Tomcat as WAR files.
39
+ We provision our app servers with ```log4j.jar``` and a ```log4j.properties``` file in in ```$TOMCAT_HOME/lib```.
40
+ You may also add log4j.jar and path to config file into CLASSPATH via environment variables, JAVA_OPTS, JAVA_OPTS, etc...
41
+ Or add them into ```$CLASSPATH``` at runtime before loading log4jruby. See [examples/setup.rb](examples/setup.rb).
42
+
43
+ Note: If you're using bundler, you can specify ```gem 'log4jruby', require: false``` in your Gemfile to delay loading the gem too early.
44
+
45
+ In a Rails application, add the following in ```config/application.rb``` or the appropriate ```config/environments``` file.
46
+
47
+ config.logger = ActiveSupport::TaggedLogging.new(Log4jruby::Logger.get('MyApp'))
48
+
49
+ or older versions of Rails
50
+
51
+ config.logger = Log4jruby::Logger.get('MyApp')
52
+
53
+ ### Examples
35
54
 
36
55
  def foo
37
56
  logger.debug("hello from foo")
@@ -49,13 +68,9 @@ configured(e.g. log4j.properties in the CLASSPATH). The examples should give you
49
68
  examples/simple.rb:18:in `foo'
50
69
  examples/simple.rb:35:in `(root)'
51
70
 
52
- See more in {log4jruby/examples}[http://github.com/lenny/log4jruby/tree/master/examples/].
71
+ See more in [log4jruby/examples](examples).
53
72
 
54
- === Installation
55
-
56
- gem install log4jruby
57
-
58
- === Usage
73
+ ### Usage
59
74
 
60
75
  class MyClass
61
76
  enable_logger
@@ -74,14 +89,6 @@ gem install log4jruby
74
89
  INFO jruby.MyModule.A my_class_method:14 - hello from class method
75
90
  INFO jruby.MyModule.A my_method:19 - hello from instance method
76
91
 
77
- See more in {log4jruby/examples}[http://github.com/lenny/log4jruby/tree/master/examples/].
92
+ See more in [log4jruby/examples](examples)..
78
93
  They should be runnable from the source.
79
94
 
80
- === Rails
81
-
82
- Add the following to one of your config/environment* files.
83
-
84
- require 'log4jruby'
85
- config.logger = Log4jruby::Logger.get('MyApp')
86
-
87
- You must ensure the log4j jar is required before requiring log4jruby.
@@ -16,3 +16,10 @@ Java::org.apache.log4j.Logger.class_eval do
16
16
  end
17
17
  end
18
18
  end
19
+
20
+ # https://github.com/lenny/log4jruby/issues/14
21
+ # https://github.com/jruby/jruby/wiki/Persistence
22
+ if Java::org.apache.log4j.Logger.respond_to?(:__persistent__)
23
+ Java::org.apache.log4j.Logger.__persistent__ = true
24
+ end
25
+
@@ -1,3 +1,3 @@
1
1
  module Log4jruby
2
- VERSION = '2.0.0.rc3'
2
+ VERSION = '2.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log4jruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc3
4
+ version: 2.0.1
5
5
  platform: java
6
6
  authors:
7
7
  - Lenny Marks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-22 00:00:00.000000000 Z
11
+ date: 2016-05-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby Logger using Log4j, geared toward those who use JRuby to write Ruby code using/extending Java code. Ruby and Java are configured together using traditional Log4j methods.
14
14
  email:
@@ -18,7 +18,7 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - CHANGELOG.md
21
- - README.rdoc
21
+ - README.md
22
22
  - lib/log4jruby.rb
23
23
  - lib/log4jruby/logger.rb
24
24
  - lib/log4jruby/logger_for_class.rb
@@ -35,17 +35,17 @@ require_paths:
35
35
  - lib
36
36
  required_ruby_version: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  requirements:
43
- - - '>'
43
+ - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 1.3.1
45
+ version: '0'
46
46
  requirements: []
47
47
  rubyforge_project:
48
- rubygems_version: 2.4.5
48
+ rubygems_version: 2.4.8
49
49
  signing_key:
50
50
  specification_version: 4
51
51
  summary: Log4jruby is a thin wrapper around the Log4j Logger. It is geared more toward those who are using JRuby to integrate with and build on top of Java code that uses Log4j. The Log4jruby::Logger provides an interface much like the standard ruby Logger. Your ruby loggers are given a .jruby prefix and can be configured along with the loggers for your Java code.