Git Product home page Git Product logo

Comments (7)

reidmorrison avatar reidmorrison commented on June 3, 2024

Are you using Semantic Logger or Rails Semantic Logger?
Rails Version?
Semantic Logger Version?
Rails Semantic Logger Version?
Ruby Version?
Rails configuration, specifically all settings related to Rails Semantic Logger and Semantic Logger.

from semantic_logger.

gingerlime avatar gingerlime commented on June 3, 2024

Rails 4.2.8
Rails Semantic Logger 4.0.1
Semantic Logger 4.0.0
Ruby 2.3.1

# config/environments/production.rb

#...
config.log_level = :info
config.log_errors_to_sentry = true
config.paths['log'] = "/var/log/our-project/#{Rails.env}.log"
config.colorize_logging = false
config.rails_semantic_logger.quiet_assets = true
# config/initializers/logging.rb
include SemanticLogger::Loggable

# based on https://github.com/rocketjob/semantic_logger/blob/0f047df6019a14dcd2c05cac9cbfbf38f0a24461/lib/semantic_logger/formatters/default.rb
# only small modification of log level to show DEBUG/WARN instead of D/W/...
module SemanticLogger
  module Formatters
    class Kenhub < Base
      # Default text log format
      #  Generates logs of the form:
      #    2011-07-19 14:36:15.660235 D [1149:ScriptThreadProcess] Rails -- Hello World
      def call(log, logger)
        # Date & time
        message = time_format.nil? ? '' : "#{format_time(log.time)} "

        # Log level and process info
        message << "#{log.level.upcase} [#{log.process_info}]"

        # Tags
        message << ' ' << log.tags.collect { |tag| "[#{tag}]" }.join(' ') if log.tags && (log.tags.size > 0)

        # Named Tags
        if (named_tags = log.named_tags) && !named_tags.empty?
          list = []
          named_tags.each_pair { |name, value| list << "[#{name}: #{value}]" }
          message << ' ' << list.join(' ')
        end

        # Duration
        message << " (#{log.duration_human})" if log.duration

        # Class / app name
        message << " #{log.name}"

        # Log message
        message << " -- #{log.message}" if log.message

        # Payload
        if payload = log.payload_to_s
          message << ' -- ' << payload
        end

        # Exceptions
        if log.exception
          message << " -- Exception: #{log.exception.class}: #{log.exception.message}\n"
          message << log.backtrace_to_s
        end
        message
      end
    end
  end
end

if Kenhub.config.log_errors_to_sentry
  SemanticLogger.add_appender(:appender => :sentry, :level => :error)
end

unless Kenhub.config.colorize_logging
  appender = SemanticLogger.appenders.find{ |a| a.is_a?(SemanticLogger::Appender::File) }
  appender.formatter = SemanticLogger::Formatters::Kenhub.new
end

from semantic_logger.

reidmorrison avatar reidmorrison commented on June 3, 2024

Should be fixed in Rails Semantic Logger v4.1 that will be released as soon as reidmorrison/rails_semantic_logger#36 has been merged. The fragment logging is now controlled by ActionController::Base.enable_fragment_cache_logging.

from semantic_logger.

reidmorrison avatar reidmorrison commented on June 3, 2024

Give v4.1 a try. Please re-open this ticket if it still logs the above messages.

from semantic_logger.

gingerlime avatar gingerlime commented on June 3, 2024

Will do. Thanks @reidmorrison. So 4.1 is officially out ?

from semantic_logger.

gingerlime avatar gingerlime commented on June 3, 2024

hmmm... I'm getting this error

NoMethodError: undefined method `enable_fragment_cache_logging=' for ActionController::Base:Class

from semantic_logger.

gingerlime avatar gingerlime commented on June 3, 2024

seeing other errors after upgrading... check out reidmorrison/rails_semantic_logger#38

from semantic_logger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.