@@ -0,0 +1,2703 @@
+/*%0A * Copyright 2014-2015 the original author or authors.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, %0A * either express or implied. See the License for the specific language%0A * governing permissions and limitations under the License.%0A */%0Apackage org.dbflute.tomcat.logging;%0A%0Aimport java.io.PrintWriter;%0Aimport java.io.StringWriter;%0Aimport java.text.SimpleDateFormat;%0Aimport java.util.Date;%0Aimport java.util.logging.Formatter;%0Aimport java.util.logging.LogRecord;%0A%0A/**%0A * @author jflute%0A */%0Apublic class LinerLogFormatter extends Formatter %7B%0A%0A    protected static Date cachedDate = new Date();%0A    protected static SimpleDateFormat cachedFormat = new SimpleDateFormat(%22yyyy-MM-dd HH:mm:ss,SSS%22);%0A%0A    // e.g.%0A    //  2015-10-23 01:59:12,746 %5Bmain%5D INFO (AbstractProtocol@start()) - ...%0A    @Override%0A    public synchronized String format(LogRecord record) %7B%0A        cachedDate.setTime(record.getMillis());%0A        final StringBuilder sb = new StringBuilder();%0A        sb.append(cachedFormat.format(cachedDate));%0A        sb.append(%22 %5B%22).append(Thread.currentThread().getName()).append(%22%5D%22);%0A        sb.append(%22 %22).append(record.getLevel().getName());%0A        sb.append(%22 (%22);%0A        final String className = record.getSourceClassName();%0A        if (className != null) %7B%0A            if (className.contains(%22.%22)) %7B%0A                sb.append(className.substring(className.lastIndexOf(%22.%22) + %22.%22.length()));%0A            %7D else %7B%0A                sb.append(className);%0A            %7D%0A            final String methodName = record.getSourceMethodName();%0A            if (methodName != null) %7B%0A                sb.append(%22@%22).append(methodName).append(%22()%22);%0A            %7D%0A        %7D else %7B%0A            sb.append(record.getLoggerName());%0A        %7D%0A        sb.append(%22) - %22).append(formatMessage(record));%0A        final Throwable thrown = record.getThrown();%0A        if (thrown != null) %7B%0A            final StringWriter stringWriter = new StringWriter();%0A            final PrintWriter printWriter = new PrintWriter(stringWriter);%0A            try %7B%0A                printWriter.println();%0A                thrown.printStackTrace(printWriter);%0A            %7D finally %7B%0A                printWriter.close();%0A            %7D%0A            sb.append(stringWriter.toString());%0A        %7D%0A        sb.append(%22%5Cn%22);%0A        return sb.toString();%0A    %7D%0A%7D%0A

make liner log