Skip to content

Commit

Permalink
Merge pull request #1757 from osulp/embargo-logger-bugfix
Browse files Browse the repository at this point in the history
bugfix for embargo release logging
  • Loading branch information
zhang4952 authored Nov 6, 2018
2 parents 08f1194 + a3ff866 commit d0071c1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/scholars_archive/embargoes/embargo_releaser.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
module ScholarsArchive::Embargoes
class EmbargoReleaser
def self.expire_embargoes

file_name = "#{Date.today}-embargo-release.log"
logger = Logger.new(File.join(Rails.root, 'log', file_name))

expired_embargoes = Hyrax::EmbargoService.assets_with_expired_embargoes
expired_embargoes.each do |embargo|
work = ActiveFedora::Base.find(embargo.solr_document[:id])
logger.warning("Processing work id: #{work.id}")
logger.warn("Processing work id: #{work.id}")
begin
work.embargo_visibility!
work.deactivate_embargo!
Expand All @@ -21,8 +20,8 @@ def self.expire_embargoes
work.copy_visibility_to_files
end
rescue => e
logger.warning("Couldnt process #{work.id}")
logger.warning ([e.message]+e.backtrace).join("\n")
logger.warn("Couldnt process #{work.id}")
logger.warn([e.message]+e.backtrace).join("\n")
end
end
end
Expand Down

0 comments on commit d0071c1

Please sign in to comment.