de.mhus.lib.core.logging.Log.getLog()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(238)

本文整理了Java中de.mhus.lib.core.logging.Log.getLog()方法的一些代码示例,展示了Log.getLog()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Log.getLog()方法的具体详情如下:
包路径:de.mhus.lib.core.logging.Log
类名称:Log
方法名:getLog

Log.getLog介绍

暂无

代码示例

代码示例来源:origin: de.mhus.lib/mhu-lib-vaadin

@Override
public synchronized Log log() {
  if (log == null) {
    log = Log.getLog(this);
  }
  return log;
}

代码示例来源:origin: de.mhus.lib/mhu-lib-core

public DefaultMonitor(Class<?> owner) {
  log = Log.getLog(owner);
}

代码示例来源:origin: de.mhus.lib/mhu-lib-core

public synchronized static Log log() {
  if (log == null) {
    try {
      log = Log.getLog(MLogUtil.class);
    } catch (Throwable t) {
      t.printStackTrace();
    }
  }
  return log;
}

代码示例来源:origin: de.mhus.lib/mhu-lib-core

public static void configure() {
    
    String config = "handlers = " + JavaLoggerHandler.class.getCanonicalName() + "\n" + 
            ".level = ALL"+"\n"+
            JavaLoggerHandler.class.getCanonicalName() + ".level = ALL";
    InputStream ins = new ByteArrayInputStream(config.getBytes());
    try {
      LogManager.getLogManager().readConfiguration(ins);
    } catch (Throwable t) {
      Log.getLog(JavaLoggerHandler.class).e("configure",t);
    }
    
//        Handler handler = new JavaLoggerHandler();
//        handler.setLevel(Level.ALL);
//        Logger root = LogManager.getLogManager().getLogger("");
//        if (root != null) {
//            root.addHandler(handler);
//        }
  }

代码示例来源:origin: de.mhus.lib/mhu-lib-logging

/**
   * <p>configure.</p>
   */
  public static void configure() {
    
    String config = "handlers = " + JavaLoggerHandler.class.getCanonicalName() + "\n" + 
            ".level = ALL"+"\n"+
            JavaLoggerHandler.class.getCanonicalName() + ".level = ALL";
    InputStream ins = new ByteArrayInputStream(config.getBytes());
    try {
      LogManager.getLogManager().readConfiguration(ins);
    } catch (Throwable t) {
      Log.getLog(JavaLoggerHandler.class).e("configure",t);
    }
    
//        Handler handler = new JavaLoggerHandler();
//        handler.setLevel(Level.ALL);
//        Logger root = LogManager.getLogManager().getLogger("");
//        if (root != null) {
//            root.addHandler(handler);
//        }
  }

代码示例来源:origin: de.mhus.lib/mhu-lib-persistence

/** Main method takes arguments for connection to JDBC etc. 
   * @param args 
   */
  public static void main(String[] args) {

    if (args.length != 1) {
      System.err.println("usage: db2sql <property file>");
    }
    // Right so there's one argument, we assume it's a property file
    // so lets open it
    Properties props = new Properties();
    try {
      props.load(new FileInputStream(args[0]));
      PrintWriter pw = new PrintWriter(System.out);
      dumpDB(props,pw);
      pw.flush();
    } catch (IOException e) {
      Log.getLog("main").e("Unable to open property file",args[0],e);
    }

  }
}

代码示例来源:origin: de.mhus.lib/mhu-lib-core

public static void updateLoggers() {
    Log.getLog(MApi.class);
    get().updateLog();
//        try {
//            synchronized (loggers) {
//                for (UUID logId : loggers.keySet().toArray(new UUID[loggers.size()]))
//                    loggers.get(logId).update();
//            }
//        } catch(Throwable t) {
//            if (MApi.isDirtyTrace()) t.printStackTrace();
//        }
  }

代码示例来源:origin: de.mhus.lib/mhu-lib-persistence

/** Dump the whole database to an SQL string 
 * @param props 
 * @param writer 
 * @return x */
public static boolean dumpDB(Properties props, PrintWriter writer) {
  String driverClassName = props.getProperty("driver.class");
  String driverURL = props.getProperty("driver.url");
  // Default to not having a quote character
  Connection dbConn = null;
  try {
    Class.forName(driverClassName);
    dbConn = DriverManager.getConnection(driverURL, props);
  }
  catch( Exception e ) {
    Log.getLog(MySqlDatabaseExport.class).e("Unable to connect to database",e);
    return false;
  }
  boolean ret = dumpDB(dbConn, props, writer);
  try {
    dbConn.close();
  } catch (SQLException e) {
    Log.getLog(MySqlDatabaseExport.class).e("Unable to close database",e);
  }
  return ret;
}

代码示例来源:origin: de.mhus.lib/mhu-lib-core

@Override
public void publish(LogRecord record) {
  Level level = record.getLevel();
  String loggerName = record.getLoggerName();
  String msg = record.getMessage();
  String srcClass = record.getSourceClassName();
  String srcMethod = record.getSourceMethodName();
  Throwable t = record.getThrown();
  Log logger = Log.getLog(loggerName);
  
  String method = srcClass + "." + srcMethod;
  
  if (level.intValue() == Level.INFO.intValue())
    logger.i(method,msg,t);
  else
  if (level.intValue() == Level.WARNING.intValue())
    logger.w(method,msg,t);
  else
  if (level.intValue() == Level.SEVERE.intValue())
    logger.e(method,msg,t);
  else
  if (level.intValue() == Level.FINE.intValue())
    logger.d(method,msg,t);
  else
  if (level.intValue() == Level.FINER.intValue())
    logger.t(method,msg,t);
  else
    logger.t(method,msg,t);
}

代码示例来源:origin: de.mhus.lib/mhu-lib-logging

/** {@inheritDoc} */
@Override
public void publish(LogRecord record) {
  Level level = record.getLevel();
  String loggerName = record.getLoggerName();
  String msg = record.getMessage();
  String srcClass = record.getSourceClassName();
  String srcMethod = record.getSourceMethodName();
  Throwable t = record.getThrown();
  Log logger = Log.getLog(loggerName);
  
  String method = srcClass + "." + srcMethod;
  
  if (level.intValue() == Level.INFO.intValue())
    logger.i(method,msg,t);
  else
  if (level.intValue() == Level.WARNING.intValue())
    logger.w(method,msg,t);
  else
  if (level.intValue() == Level.SEVERE.intValue())
    logger.e(method,msg,t);
  else
  if (level.intValue() == Level.FINE.intValue())
    logger.d(method,msg,t);
  else
  if (level.intValue() == Level.FINER.intValue())
    logger.t(method,msg,t);
  else
    logger.t(method,msg,t);
}

代码示例来源:origin: de.mhus.lib/mhu-lib-persistence

stmt.close();
} catch (SQLException e) {
  Log.getLog(MySqlDatabaseExport.class).e("Unable to dump table "+tableName+" because",e);

代码示例来源:origin: de.mhus.lib/mhu-lib-persistence

ResultSet rs = dbMetaData.getTables(catalog, schema, tables, null);
if (! rs.next()) {
  Log.getLog(MySqlDatabaseExport.class).e("Unable to find any tables matching: catalog="+catalog+" schema="+schema+" tables="+tables);
  rs.close();
} else {
        Log.getLog(MySqlDatabaseExport.class).e("Unable to get primary keys for table "+tableName+" because ",e);
Log.getLog(MySqlDatabaseExport.class).e(e);  //To change body of catch statement use Options | File Templates.

代码示例来源:origin: de.mhus.lib/mhu-lib-vaadin

private Log log = Log.getLog(this);
private String sortedColumn;
private boolean sortedAscending;

代码示例来源:origin: de.mhus.lib/mhu-lib-core

t = throwableInfo.getThrowable();
Log logger = Log.getLog(loggerName);

代码示例来源:origin: de.mhus.lib/mhu-lib-logging

t = throwableInfo.getThrowable();
Log logger = Log.getLog(loggerName);

相关文章