Sec. 51. Penalties for violation of ordinances generally.
   That for the violation of any ordinance or by-law made by said board of commissioners they may prescribe penalties not exceeding fifty dollars for each offense, to be recovered before the mayor without stay of process, mesne or final; and when judgment shall be given for any such penalty the party convicted may, unless the penalty and cost be paid, be immediately committed to jail for the space of thirty days or until payment thereof be made.