The violation of any ordinance or law of the town shall be punishable by a fine not exceeding fifty dollars ($50.00), recoverable before the mayor of the town upon warrant issued as for the recovery of the debt before a judge of the court of general sessions. The judgment, when so recovered, shall constitute a lien on the realty of the defendant situate within the corporate limits of the town.