Module: Logback
- Defined in:
- lib/logback.rb,
lib/logback/base.rb
Overview
– Copyright © 2008 David Kellum
Logback Ruby is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Logback Ruby is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. ++
Defined Under Namespace
Modules: AppenderUtil, Util Classes: ConsoleAppender, FileAppender, Logger, PatternLayout
Constant Summary collapse
- TRACE =
Level::TRACE
- DEBUG =
Level::DEBUG
- INFO =
Level::INFO
- WARN =
Level::WARN
- ERROR =
Level::ERROR
- DEFAULT_PATTERN =
"%date [%thread] %-5level %logger{35} - %msg %ex%n"
- LOGBACK_VERSION =
'0.9.14'
- VERSION =
LOGBACK_VERSION + '.1'
- LOGBACK_DIR =
:nodoc:
File.dirname(__FILE__)
- @@context =
SLF4J.linked_factory
Class Method Summary collapse
-
.[](name) ⇒ Object
Synonym for logger(name).
-
.configure {|context| ... } ⇒ Object
Configure Logback with the specified block.
-
.context ⇒ Object
Returns the LoggerContext.
-
.load_xml_config(file) ⇒ Object
Load the specified Logback (Joran) XML configuration file.
-
.logger(name) ⇒ Object
Returns the named Logger.
- .require_jar(name) ⇒ Object
-
.root ⇒ Object
Returns the special “root” Logger.
Class Method Details
.[](name) ⇒ Object
Synonym for logger(name)
256 257 258 |
# File 'lib/logback.rb', line 256 def self.[](name) logger( name ) end |
.configure {|context| ... } ⇒ Object
Configure Logback with the specified block. The Logback context is reset
before yielding, and then started after return from the block.
:call-seq:
configure { |context| ... } -> nil
241 242 243 244 245 246 247 248 |
# File 'lib/logback.rb', line 241 def self.configure @@context.reset yield( context ) Util.start( context ) nil end |
.context ⇒ Object
Returns the LoggerContext
97 98 99 |
# File 'lib/logback.rb', line 97 def self.context @@context end |
.load_xml_config(file) ⇒ Object
Load the specified Logback (Joran) XML configuration file. Should be called within a configure … block.
135 136 137 138 139 |
# File 'lib/logback.rb', line 135 def self.load_xml_config( file ) cfger = JoranConfigurator.new cfger.context = @@context cfger.doConfigure( file ) end |
.logger(name) ⇒ Object
Returns the named Logger
251 252 253 |
# File 'lib/logback.rb', line 251 def self.logger( name ) Logger.new( @@context.getLogger( name ) ) end |
.require_jar(name) ⇒ Object
77 78 79 |
# File 'lib/logback.rb', line 77 def self.require_jar( name ) require File.join( LOGBACK_DIR, "#{name}-#{ LOGBACK_VERSION }.jar" ) end |
.root ⇒ Object
Returns the special “root” Logger
261 262 263 |
# File 'lib/logback.rb', line 261 def self.root logger( "root" ) end |