File tree Expand file tree Collapse file tree
resources/openjdk/diagnostics Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ def initialize(app_dir)
3838 Buildpack . require_component_files
3939 components = Buildpack . components
4040
41- java_home = String . new
41+ java_home = ''
4242 java_opts = Array . new
4343
4444 @jres = components [ 'jres' ] . map do |jre |
@@ -127,6 +127,7 @@ def release
127127 # @param [Hash, String] log_data Data to be logged
128128 def self . log ( log_title , log_data )
129129 File . open ( @@buildpack_log_file , 'a' ) do |log_file |
130+ log_file . sync = true
130131 log_file . write "#{ log_title } @ #{ time_in_millis } ::\n "
131132 log_file . write ( log_data . is_a? ( Hash ) ? log_data . to_yaml : log_data )
132133 end
@@ -147,6 +148,7 @@ def self.create_log_file(app_dir)
147148
148149 # Create new log file and write current time into it.
149150 File . open ( @@buildpack_log_file , 'a' ) do |log_file |
151+ log_file . sync = true
150152 log_file . write "#{ @@buildpack_log_file } @ #{ time_in_millis } \n "
151153 end
152154 end
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ def compile
6969 #
7070 # @return [void]
7171 def release
72- @java_opts << "-XX:OnOutOfMemoryError=#{ @diagnostics_dir } /killjava"
72+ @java_opts << "-XX:OnOutOfMemoryError=$HOME/buildpack-diagnostics /killjava"
7373 @java_opts . concat memory ( @configuration )
7474 end
7575
Original file line number Diff line number Diff line change @@ -20,11 +20,11 @@ $stdout.sync = true
2020
2121module Kill
2222
23- def Kill . log ( log_title , log_data )
23+ def Kill . log ( log_data )
2424 log_file = "#{ File . dirname ( __FILE__ ) } /buildpack.log"
2525 File . open ( log_file , 'a' ) do |log_file |
26- log_file . write " #{ log_title } @ #{ Kill . time_in_millis } :: \n "
27- log_file . write ( log_data )
26+ log_file . sync = true
27+ log_file . write " #{ log_data } @ #{ Kill . time_in_millis } \n "
2828 end
2929 end
3030
@@ -35,10 +35,11 @@ module Kill
3535end
3636
3737begin
38- Kill . log ( "#{ __FILE__ } attempting to kill Java processes" ,
39- `pkill -9 -f .*-XX:OnOutOfMemoryError=.*#{ File . basename ( __FILE__ ) } ` )
38+ command = "pkill -9 -f .*-XX:OnOutOfMemoryError=.*#{ File . basename ( __FILE__ ) } "
39+ Kill . log ( "#{ __FILE__ } attempting to kill Java processes using `#{ command } `" )
40+ `#{ command } `
4041rescue => e
41- Kill . log ( "#{ __FILE__ } failed with exception" , " #{ e . inspect } , #{ e . backtrace } \n ")
42+ Kill . log ( "#{ __FILE__ } failed with exception #{ e . inspect } , #{ e . backtrace } \n " )
4243 abort e . message
4344end
4445
You can’t perform that action at this time.
0 commit comments