comparison src/luan/modules/lucene/PostgresBackup.java @ 1454:219f2b937f2b

remove log4j
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 08 Mar 2020 14:11:30 -0600
parents 928be2a4d565
children 3bd4d7963456
comparison
equal deleted inserted replaced
1453:928be2a4d565 1454:219f2b937f2b
22 import goodjava.logging.Logger; 22 import goodjava.logging.Logger;
23 import goodjava.logging.LoggerFactory; 23 import goodjava.logging.LoggerFactory;
24 24
25 25
26 final class PostgresBackup { 26 final class PostgresBackup {
27 private static final Logger sysLogger = LoggerFactory.getLogger(PostgresBackup.class); 27 private static final Logger logger = LoggerFactory.getLogger(PostgresBackup.class);
28
29 private final Logger luanLogger;
30 28
31 final boolean wasCreated; 29 final boolean wasCreated;
32 private final String url; 30 private final String url;
33 private final Properties props = new Properties(); 31 private final Properties props = new Properties();
34 private final Connection con; 32 private final Connection con;
40 38
41 PostgresBackup(Luan luan,LuanTable spec) 39 PostgresBackup(Luan luan,LuanTable spec)
42 throws ClassNotFoundException, SQLException, LuanException 40 throws ClassNotFoundException, SQLException, LuanException
43 { 41 {
44 spec = new LuanTable(spec); 42 spec = new LuanTable(spec);
45 this.luanLogger = luan.getLogger(PostgresBackup.class);
46 /* 43 /*
47 Class.forName("org.postgresql.Driver"); 44 Class.forName("org.postgresql.Driver");
48 url = "jdbc:postgresql://localhost:5432/luan"; 45 url = "jdbc:postgresql://localhost:5432/luan";
49 props.setProperty("user","postgres"); 46 props.setProperty("user","postgres");
50 props.setProperty("password",""); 47 props.setProperty("password","");
118 String data = luanToString.toString(doc); 115 String data = luanToString.toString(doc);
119 updateStmt.setString(1,data); 116 updateStmt.setString(1,data);
120 updateStmt.setLong(2,id); 117 updateStmt.setLong(2,id);
121 int n = updateStmt.executeUpdate(); 118 int n = updateStmt.executeUpdate();
122 if( n==0 ) { 119 if( n==0 ) {
123 luanLogger.error("update not found for id="+id+", trying add"); 120 logger.error("update not found for id="+id+", trying add");
124 add(doc); 121 add(doc);
125 } else if( n!=1 ) 122 } else if( n!=1 )
126 throw new RuntimeException(); 123 throw new RuntimeException();
127 } 124 }
128 125