Package java.util.logging

Examples of java.util.logging.SimpleFormatter


  if (m_Filename != null) {
    m_Logger = Logger.getLogger(m_Filename);
    Handler fh = null;
    try{      
      fh = new FileHandler(m_Filename, m_Size, m_NumFiles);
      fh.setFormatter(new SimpleFormatter());
      m_Logger.addHandler(fh);     
      m_LoggerInitFailed = false;
    }
    catch(Exception e) {
      System.out.println("Cannot init fileHandler for logger:" + e.toString());
View Full Code Here


    log.setLevel(Level.ALL);//Log all events
   
    try {
      FileHandler fileHandler = new FileHandler(ConfigurationManager.LOGS_DIR+File.separator+"JMule%u.log",(int)ConfigurationManager.LOG_FILE_SIZE,ConfigurationManager.LOG_FILES_NUMBER);
     
      fileHandler.setFormatter(new SimpleFormatter());
     
      log.addHandler(fileHandler);
     
    } catch (Throwable e) {
     
View Full Code Here

public final class ConsoleOutHandler extends StreamHandler {

    public ConsoleOutHandler() {
        setLevel(Level.FINEST);
        setFormatter(new SimpleFormatter());
        setOutputStream(System.out);       
    }
View Full Code Here

        Formatter f = null;
        try {
            final Class<?> c = Class.forName(name);
            f = (Formatter)c.newInstance();
        } catch (final Exception e) {
            f = new SimpleFormatter();
        }
        return f;
    }   
View Full Code Here

        Formatter f = null;
        try {
            final Class<?> c = Class.forName(name);
            f = (Formatter)c.newInstance();
        } catch (final Exception e) {
            f = new SimpleFormatter();
        }
        return f;
    }
View Full Code Here

            Level.FINE.getLocalizedName(),
            Level.CONFIG.getLocalizedName(),
            Level.INFO.getLocalizedName(),
            Level.WARNING.getLocalizedName(),
            Level.SEVERE.getLocalizedName()};
        logFormatter = new SimpleFormatter();
        logOpt = new  StringParam(
            Strings.get("LoggerCmdLineHandler.logOpt.tag"),
            Strings.get("LoggerCmdLineHandler.logOpt.desc", validVals),
            validVals,
            Parameter.OPTIONAL);
View Full Code Here

        settingsFile = args.length > 0 ? new File(args[0]) : null;
        try {
            Logger.getLogger("").addHandler(new Handler() {
                {
                    setFormatter(new SimpleFormatter());
                }
                @Override public void publish(final LogRecord record) {
                    final String title;
                    final int messageType;
                    if (record.getLevel().equals(Level.SEVERE)) {
View Full Code Here

        settingsFile = args.length > 0 ? new File(args[0]) : null;
        try {
            Logger.getLogger("").addHandler(new Handler() {
                {
                    setFormatter(new SimpleFormatter());
                }
                @Override public void publish(final LogRecord record) {
                    final String title;
                    final int messageType;
                    if (record.getLevel().equals(Level.SEVERE)) {
View Full Code Here

    Logger logger = Logger.getLogger("");
    logger.setLevel(Level.INFO);
    txtFile = new FileHandler("Logging.txt",true);
   
    // Create txt Formatter
    formatterTxt = new SimpleFormatter();
    txtFile.setFormatter(formatterTxt);
    logger.addHandler(txtFile);
   
    }catch(IOException ex)
    {
View Full Code Here

        initializeLogging(Level.INFO);
    }
   
    public static void initializeLogging(Level consoleLevel) {
        LogManager.getLogManager().reset();
        SimpleFormatter sf = new SimpleFormatter() {
            private final long startMillis = System.currentTimeMillis();
            public String format(LogRecord record) {
                StringBuilder sb = new StringBuilder();
                sb.append(record.getMillis() - startMillis);
                sb.append(" ");
View Full Code Here

TOP

Related Classes of java.util.logging.SimpleFormatter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.