0
以下更改log4j的JDBC適配器分貝的位置是我的log4j的JDBC適配器,如何在運行時更改dblocation如何在運行時
log4j.appender.DB=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.DB.driver=org.sqlite.JDBC
log4j.appender.DB.URL=jdbc:sqlite:{To change}
log4j.appender.DB.user=
log4j.appender.JDBC.commit=true
log4j.appender.DB.threshold=trace
log4j.appender.DB.sql=INSERT INTO sfLog(UserID,UserName,IPAddress,Port,UserAgent,Type,Status,Message,Date) VALUES('%X{UserID}','%X{UserName}','%X{IP}','%X{Port}','%X{Agent}','%X{Type}','%X{Status}','%m','%d{dd-MM-yyyy HH:mm:ss}')
log4j.appender.DB.layout=org.apache.log4j.PatternLayout
但我可以在運行時只獲取位置如何設置。 – MohanMaverick
使用System.setProperty? – davidfrancis