Java Log Message log(final String file, final String msg)

Here you can find the source of log(final String file, final String msg)

Description

log

License

Open Source License

Declaration

public static void log(final String file, final String msg) 

Method Source Code

//package com.java2s;
/*/*from   w w w  .j av  a2  s  . c o  m*/
   This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 ~ 2010 Patrick Huy <patrick.huy@frz.cc> 
               Matthias Butz <matze@odinms.de>
               Jan Christian Meyer <vimes@odinms.de>
    
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation. You may not use, modify
or distribute this program under any other version of the
GNU Affero General Public License.
    
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 Affero General Public License for more details.
    
You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import java.io.IOException;
import java.io.FileOutputStream;

public class Main {
    public static void log(final String file, final String msg) {
        FileOutputStream out = null;
        try {
            out = new FileOutputStream(file, true);
            out.write(msg.getBytes());
            out.write("\n------------------------\n".getBytes());
        } catch (IOException ess) {
        } finally {
            try {
                if (out != null) {
                    out.close();
                }
            } catch (IOException ignore) {
            }
        }
    }
}

Related

  1. log(boolean console, boolean file)
  2. log(final PrintStream logger, final Object message)
  3. log(final PrintStream logger, final String message)
  4. log(final String message, final String file)
  5. log(int physicalId, String message)
  6. log(Object o, String msg)
  7. LOG(Object... msgs)