lib/mizuno/logger.rb in mizuno-0.6.6 vs lib/mizuno/logger.rb in mizuno-0.6.7
- old
+ new
@@ -22,35 +22,37 @@
# Default logging threshold.
limit = options[:warn] ? "WARN" : "ERROR"
limit = "DEBUG" if ($DEBUG or options[:debug])
- # Base logging configuration.
- config = <<-END
- log4j.rootCategory = #{limit}, default
- log4j.logger.org.eclipse.jetty.util.log = #{limit}, default
- log4j.appender.default.Threshold = #{limit}
- log4j.appender.default.layout = org.apache.log4j.PatternLayout
- END
+ if !options[:log4j]
+ # Base logging configuration.
+ config = <<-END
+ log4j.rootCategory = #{limit}, default
+ log4j.logger.org.eclipse.jetty.util.log = #{limit}, default
+ log4j.appender.default.Threshold = #{limit}
+ log4j.appender.default.layout = org.apache.log4j.PatternLayout
+ END
- # Should we log to the console?
- config.concat(<<-END) unless options[:log]
- log4j.appender.default = org.apache.log4j.ConsoleAppender
- log4j.appender.default.layout.ConversionPattern = %m\\n
- END
+ # Should we log to the console?
+ config.concat(<<-END) unless options[:log]
+ log4j.appender.default = org.apache.log4j.ConsoleAppender
+ log4j.appender.default.layout.ConversionPattern = %m\\n
+ END
- # Are we logging to a file?
- config.concat(<<-END) if options[:log]
- log4j.appender.default = org.apache.log4j.FileAppender
- log4j.appender.default.Append = true
- log4j.appender.default.File = #{options[:log]}
- log4j.appender.default.layout.ConversionPattern = %d %p %m\\n
- END
+ # Are we logging to a file?
+ config.concat(<<-END) if options[:log]
+ log4j.appender.default = org.apache.log4j.FileAppender
+ log4j.appender.default.Append = true
+ log4j.appender.default.File = #{options[:log]}
+ log4j.appender.default.layout.ConversionPattern = %d %p %m\\n
+ END
- # Set up Log4J via Properties.
- properties = Properties.new
- properties.load(ByteArrayInputStream.new(config.to_java_bytes))
- PropertyConfigurator.configure(properties)
+ # Set up Log4J via Properties.
+ properties = Properties.new
+ properties.load(ByteArrayInputStream.new(config.to_java_bytes))
+ PropertyConfigurator.configure(properties)
+ end
# Create the default logger that gets used everywhere.
@logger = new
end