Module: Backstage

Defined in:
lib/resource.rb,
lib/util.rb,
lib/helpers.rb,
lib/has_mbean.rb,
lib/apps/routes.rb,
lib/pools/routes.rb,
lib/authentication.rb,
lib/apps/models/app.rb,
lib/jobs/models/job.rb,
lib/logs/models/log.rb,
lib/resource_helpers.rb,
lib/pools/models/pool.rb,
lib/torquebox_managed.rb,
lib/caches/models/cache.rb,
lib/destinations/routes.rb,
lib/groups/models/group.rb,
lib/services/models/service.rb,
lib/destinations/models/queue.rb,
lib/destinations/models/topic.rb,
lib/destinations/models/message.rb,
lib/destinations/models/destination.rb,
lib/message_processors/models/message_processor.rb

Overview

Copyright 2011 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Defined Under Namespace

Modules: Authentication, HasMBean, Resource, TorqueBoxManaged, Util Classes: App, Application, Cache, Destination, Group, Job, Log, Message, MessageProcessor, Pool, Queue, Service, Topic

Class Method Summary collapse

Class Method Details

.jboss_app_nameObject



25
26
27
# File 'lib/helpers.rb', line 25

def self.jboss_app_name
  App.find( "torquebox.apps:name=torquebox-backstage" ) ? 'torquebox-backstage' : 'backstage'
end

.jboss_log_dirObject



21
22
23
# File 'lib/helpers.rb', line 21

def self.jboss_log_dir
  java.lang.System.get_property( 'jboss.server.log.dir' )
end

.loggerObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/helpers.rb', line 29

def self.logger
  return @logger if @logger
  
  # log to <jboss log dir>/torquebox/<RACK_ENV>.log if you can,
  # otherwise do <app dir>/log/<RACK_ENV>.log
  if Backstage.jboss_log_dir && File.directory?( Backstage.jboss_log_dir )
    log_dir = File.join( Backstage.jboss_log_dir, Backstage.jboss_app_name )
  else
    log_dir = File.join( File.dirname( __FILE__ ), '..', 'log' )
  end
  FileUtils.mkdir_p( log_dir )
  
  @logger = Logger.new( File.join( log_dir, "#{ENV['RACK_ENV']}.log" ) )
end