aliyun / aliyun-odps-jdbc

JDBC Driver for ODPS
Other
125 stars 38 forks source link

Add file handler only once to each OdpsLogger #86

Closed cornmonster closed 4 years ago

cornmonster commented 4 years ago

What do these changes do?

Fix #84

Related issue number

84

lyman commented 4 years ago

Since new implementation is to assign new logger to each connection, it is better to show connection id in log text.

Also, it is better to replace connection id from 24 bytes uuid to a self-increase integer.

sanluan commented 4 years ago

并没有解决日志重复打印的bug

cornmonster commented 4 years ago

并没有解决日志重复打印的bug

如果发现还有问题的话,贴下验证代码和日志吧

sanluan commented 4 years ago

日志重复打印,每创建一次连接多打印一次日志 OdpsDriver. connect(url, info);方法中调用new OdpsConnection(url, info) ; 每次都会实例化一个log log = new OdpsLogger(getClass().getName(), null, logConfFile, false, connRes.isEnableOdpsLogger()); 在OdpsLogger中 odpsLogger= Logger.getLogger(name); 每次实例会追加一个fileHanlder到odpsLogger; odpsLogger.addHandler(fileHandler); 导致创建一万次连接后,一条日志会在jdbc.log中打印一万遍