File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5353)
5454
5555logger .setLevel (buildpackutil .get_buildpack_loglevel ())
56- logger .info ("Started Mendix Cloud Foundry Buildpack v2.2.2 " )
56+ logger .info ("Started Mendix Cloud Foundry Buildpack v2.2.3 " )
5757logging .getLogger ("m2ee" ).propagate = False
5858
5959
@@ -802,6 +802,38 @@ def set_up_m2ee_client(vcap_data):
802802 return m2ee
803803
804804
805+ class LogFilterThread (threading .Thread ):
806+ def __init__ (self , log_ratelimit ):
807+ super ().__init__ ()
808+ self .log_ratelimit = log_ratelimit
809+
810+ def run (self ):
811+ try :
812+ while True :
813+ proc = subprocess .Popen (
814+ [
815+ "./bin/mendix-logfilter" ,
816+ "-r" ,
817+ self .log_ratelimit ,
818+ "-f" ,
819+ "log/out.log" ,
820+ ]
821+ )
822+ proc .wait ()
823+ logger .warning (
824+ "MENDIX LOGGING: Mendix logfilter crashed with return code "
825+ "%s. This is nothing to worry about, we are restarting the "
826+ "logfilter now." ,
827+ proc .returncode ,
828+ )
829+ except Exception :
830+ logger .warning (
831+ "MENDIX LOGGING: Logging pipeline failed completely. To "
832+ "restore log availibility, restart your application." ,
833+ exc_info = True ,
834+ )
835+
836+
805837def set_up_logging_file ():
806838 buildpackutil .lazy_remove_file ("log/out.log" )
807839 os .mkfifo ("log/out.log" )
@@ -816,15 +848,9 @@ def set_up_logging_file():
816848 ]
817849 )
818850 else :
819- subprocess .Popen (
820- [
821- "./bin/mendix-logfilter" ,
822- "-r" ,
823- log_ratelimit ,
824- "-f" ,
825- "log/out.log" ,
826- ]
827- )
851+ log_filter_thread = LogFilterThread (log_ratelimit )
852+ log_filter_thread .daemon = True
853+ log_filter_thread .start ()
828854
829855
830856def service_backups ():
You can’t perform that action at this time.
0 commit comments