@dhieru singhYou are correct. When running NiFi in an Ambari managed cluster, you need to restart NiFi so the changes made in the Ambari UI are pushed out the the logback.xml file.
If you make the changes directly to the logback,xml, then NiFi will pick up those changes the next time it does the refresh. But, the next time you restart NiFi via Ambari those changes would be over written if you didn't also make the changes via the Ambari UI.