Here you can find the source of logFormat(String msg)
public static String logFormat(String msg)
//package com.java2s; /*/*from ww w .jav a2 s. c o m*/ * Universal Media Server, for streaming any medias to DLNA * compatible renderers based on the http://www.ps3mediaserver.org. * Copyright (C) 2012 UMS developers. * * This program is a free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; version 2 * of the License only. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static String logFormat(String msg) { DateFormat dateFormat = new SimpleDateFormat("MM-dd HH:mm:ss"); Date date = new Date(); String[] messageDisplay = msg.replaceFirst("]", "string that should never match").split( "string that should never match"); return dateFormat.format(date) + " " + messageDisplay[1]; } }