b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

log4j appender自定义_log4j routingappender_fileappender log4j(10)

电脑杂谈  发布时间:2017-01-30 04:04:43  来源:网络整理

9 private boolean locationInfo = false;

10

11 public void append(LoggingEvent event) {

12event.getNDC();

13event.getThreadName();

14event.getMDCCopy();

15if (locationInfo) {

16event.getLocationInformation();

17}

18event.getRenderedMessage();

19event.getThrowableStrRep();

20buffer.add(event);

21if (buffer.size() >= bufferSize)

22flushBuffer();

23 }

24 public void flushBuffer() {

25removes.ensureCapacity(buffer.size());

26for (Iterator i = buffer.iterator(); i.hasNext();) {

27try {

28LoggingEvent logEvent = (LoggingEvent) i.next();

29String sql = getLogStatement(logEvent);

30execute(sql);

31removes.add(logEvent);

32} catch (SQLException e) {

33errorHandler.error("Failed to excute sql", e,

34ErrorCode.FLUSH_FAILURE);

35}

36}

37buffer.removeAll(removes);

38removes.clear();

39 }

40 protected String getLogStatement(LoggingEvent event) {

41return getLayout().format(event);

42 }

43 protected void execute(String sql) throws SQLException {

44Connection con = null;

45Statement stmt = null;

46try {

47con = getConnection();

48stmt = con.createStatement();

49stmt.executeUpdate(sql);

50} catch (SQLException e) {

51if (stmt != null)

52stmt.close();

53throw e;

54}

55stmt.close();

56closeConnection(con);

57 }

58 protected Connection getConnection() throws SQLException {

59if (!DriverManager.getDrivers().hasMoreElements())

60setDriver("sun.jdbc.odbc.JdbcOdbcDriver");

61if (connection == null) {

62connection = DriverManager.getConnection(databaseURL, databaseUser,

63databasePassword);


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-29497-10.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 胡馨月
      胡馨月

      想吃芝麻糊就搞个豆浆机自己打正好趁双十一搞一个

      • 周玮
        周玮

        就是有人先知道要双降啊

    热点图片
    拼命载入中...