memory - Creating a separate log for each Passenger process in a Rails app -


i'm trying determine cause of high app server instance memory usage , need separate log each running passenger process (e.g., production_18204.log). there simple way configure in rails app? thanks.

to log memory used process in each request use following code.

def log_memory_usage   mem_usage = `ps -o rss= -p #{ process.pid }`.to_i   if logger     logger.info("[memory usage]: #{ number_to_human_size(mem_usage) } | pid: #{ process.pid } | controller: #{ controller_name } | action: #{ action_name }")   end end 

use before action in base or application controller. include actionview::helpers::numberhelper make number_to_human_size work.

courtesy: https://github.com/binarylogic/memorylogic


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -