Skip to content

Commit

Permalink
Add variable control log output path
Browse files Browse the repository at this point in the history
  • Loading branch information
chushenmeshile authored and huiguangjun committed Jun 24, 2020
1 parent de9406f commit 814c9a8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/aliyun/common/logging.rb
Expand Up @@ -11,7 +11,6 @@ module Common
# logger.info(xxx)
module Logging

DEFAULT_LOG_FILE = "./aliyun_sdk.log"
MAX_NUM_LOG = 100
ROTATE_SIZE = 10 * 1024 * 1024

Expand All @@ -34,11 +33,8 @@ def logger

def self.logger
unless @logger
@log_file = nil
# Environment parameter ALIYUN_OSS_SDK_LOG_PATH used to control whether output log to a file
if ENV['ALIYUN_OSS_SDK_LOG_PATH']
@log_file ||= DEFAULT_LOG_FILE
end
# Environment parameter ALIYUN_OSS_SDK_LOG_PATH used to set output log to a file,do not output log if not set
@log_file ||= ENV["ALIYUN_OSS_SDK_LOG_PATH"]
@logger = Logger.new(
@log_file, MAX_NUM_LOG, ROTATE_SIZE)
@logger.level = Logger::INFO
Expand Down

0 comments on commit 814c9a8

Please sign in to comment.