Adding fixes for CARBON-14867

Only merge this when logging related fixed are merged to wso2/carbon4-kernel


This reverts commit fb453bfe92a5fd3e01547570b3c244c17572140d.