 <p>sawa's answer is ok, and also you can use a method like <a href="https://github.com/bestmike007/log4rails/blob/master/lib/log4rails/railtie.rb#L66" rel="nofollow">this</a> to dynamically create logger for each class.</p> <p>However, I prefer not to get all classes under a module. In able to create logger for every single class, you can do things as follow.</p> <pre class="lang-rb prettyprint-override"><code>module Kernel ####### private ####### def logger Log4r::Logger[logger_name] end def logger_name clazz = self.class unless clazz.respond_to? :logger_name name = clazz.module_eval 'self.name' clazz.define_singleton_method(:logger_name) { name } end clazz.logger_name end end module A module B class C def hello logger.debug logger_name end end end end A::B::C.new.hello </code></pre> <p>For classes within a specific module you can write a filter in the <code>logger_name</code> method, for example:</p> <pre class="lang-rb prettyprint-override"><code>module Kernel ####### private ####### def logger Log4r::Logger[logger_name] end def logger_name clazz = self.class unless clazz.respond_to? :logger_name name = clazz.module_eval 'self.name' name = 'root' unless name.start_with?('A::B') clazz.define_singleton_method(:logger_name) { name } end clazz.logger_name end end module A module B class C def hello logger.debug logger_name end class &lt;&lt; self def hello logger.debug logger_name end end end end class D def hello logger.debug logger_name end end end A::B::C.new.hello # A::B::C A::B::C.hello # A::B::C A::D.new.hello # root </code></pre> <p>And also, you can cache the logger:</p> <pre class="lang-rb prettyprint-override"><code>def logger _logger = Log4r::Logger[logger_name] self.class.send(:define_method, :logger) { _logger } self.class.define_singleton_method(:logger) { _logger } return _logger end </code></pre> <p>Hope it helps.</p>