##// END OF EJS Templates
Always log scm stderr and makes the log file path configurable....
Jean-Philippe Lang -
r10979:30801ca96805
parent child
Show More
@@ -133,6 +133,12 default:
133 133 scm_bazaar_command:
134 134 scm_darcs_command:
135 135
136 # Absolute path to the scm commands errors (stderr) log file.
137 # The default is to log in the 'log' directory of your Redmine instance.
138 # Example:
139 # scm_stderr_log_file: /var/log/redmine_scm_stderr.log
140 scm_stderr_log_file:
141
136 142 # Key used to encrypt sensitive data in the database (SCM and LDAP passwords).
137 143 # If you don't want to enable data encryption, just leave it blank.
138 144 # WARNING: losing/changing this key will make encrypted data unreadable.
@@ -218,14 +218,19 module Redmine
218 218 Rails.logger
219 219 end
220 220
221 # Path to the file where scm stderr output is logged
222 def self.stderr_log_file
223 @stderr_log_path ||=
224 Redmine::Configuration['scm_stderr_log_file'].presence ||
225 Rails.root.join("log/#{Rails.env}.scm.stderr.log").to_s
226 end
227
221 228 def self.shellout(cmd, options = {}, &block)
222 229 if logger && logger.debug?
223 230 logger.debug "Shelling out: #{strip_credential(cmd)}"
224 231 end
225 if Rails.env == 'development'
226 # Capture stderr when running in dev environment
227 cmd = "#{cmd} 2>>#{shell_quote(Rails.root.join('log/scm.stderr.log').to_s)}"
228 end
232 # Capture stderr in a log file
233 cmd = "#{cmd} 2>>#{shell_quote(stderr_log_file)}"
229 234 begin
230 235 mode = "r+"
231 236 IO.popen(cmd, mode) do |io|
General Comments 0
You need to be logged in to leave comments. Login now