diff --git a/lib/ews/connection.rb b/lib/ews/connection.rb index 9dd2b831..ad526a99 100644 --- a/lib/ews/connection.rb +++ b/lib/ews/connection.rb @@ -39,7 +39,7 @@ class Connection # @option opts [Array] :trust_ca an array of hashed dir paths or a file # @option opts [String] :user_agent the http user agent to use in all requests def initialize(endpoint, opts = {}) - @log = Logging.logger[self.class.name.to_s.to_sym] + @log = Viewpoint::EWS.root_logger httpclient_opts = opts.slice(*SUPPORTED_HTTPCLIENT_OPTS) @httpcli = HTTPClient.new(**httpclient_opts) diff --git a/lib/ews/connection_helper.rb b/lib/ews/connection_helper.rb index fa4954b6..4c50d41b 100644 --- a/lib/ews/connection_helper.rb +++ b/lib/ews/connection_helper.rb @@ -21,7 +21,7 @@ module EWS # Helpers for building authenticated HTTP connections. module ConnectionHelper def init_logging! - @log = Logging.logger[self.class.name.to_s.to_sym] + @log = Viewpoint::EWS.root_logger end # @param [String] xml to parse the errors from. diff --git a/lib/ews/soap.rb b/lib/ews/soap.rb index c15930ab..3a3d7fd0 100644 --- a/lib/ews/soap.rb +++ b/lib/ews/soap.rb @@ -57,7 +57,7 @@ module SOAP MOVE_TO_DELETED_ITEMS = 'MoveToDeletedItems' def initialize - @log = Logging.logger[self.class.name.to_s.to_sym] + @log = Viewpoint::EWS.root_logger @default_ns = NAMESPACES["xmlns:#{NS_EWS_MESSAGES}"] end end diff --git a/lib/viewpoint.rb b/lib/viewpoint.rb index 4d858f62..4e9f8f2d 100644 --- a/lib/viewpoint.rb +++ b/lib/viewpoint.rb @@ -21,7 +21,7 @@ require 'base64' require 'nokogiri' require 'ostruct' -require 'logging' +require 'logger' unless defined?(Logger) # String utilities require 'viewpoint/string_utils' diff --git a/lib/viewpoint/logging.rb b/lib/viewpoint/logging.rb index 82d5f4d0..3e4797b5 100644 --- a/lib/viewpoint/logging.rb +++ b/lib/viewpoint/logging.rb @@ -16,13 +16,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +require 'logger' unless defined?(Logger) + module Viewpoint # Exchange Web Services (EWS) client namespace. module EWS attr_reader :logger + @root_logger = Logger.new($stdout) + @root_logger.level = Logger::WARN + def self.root_logger - Logging.logger.root + @root_logger end end end diff --git a/lib/viewpoint/logging/config.rb b/lib/viewpoint/logging/config.rb index b1709d35..509ea8e5 100644 --- a/lib/viewpoint/logging/config.rb +++ b/lib/viewpoint/logging/config.rb @@ -19,7 +19,6 @@ module Viewpoint # Exchange Web Services (EWS) client namespace. module EWS - Logging.logger.root.level = :debug - Logging.logger.root.appenders = Logging.appenders.stdout + root_logger.level = Logger::DEBUG end end diff --git a/viewpoint.gemspec b/viewpoint.gemspec index a11c6890..de9ca2f7 100644 --- a/viewpoint.gemspec +++ b/viewpoint.gemspec @@ -26,7 +26,8 @@ Gem::Specification.new do |s| s.extra_rdoc_files = %w[README.md] s.add_runtime_dependency 'httpclient' - s.add_runtime_dependency 'logging' + # logger is no longer a bundled gem on Ruby 4.0 + s.add_runtime_dependency 'logger' s.add_runtime_dependency 'mutex_m' s.add_runtime_dependency 'nokogiri', '!=1.12.3', '!=1.12.2', '!=1.12.1', '!=1.12.0' s.add_runtime_dependency 'rubyntlm'