どうすればエラーを修正できますか?
log4j.properties
# Define the root logger with appender file
log4j.rootLogger = ALL, DB
# Define the DB appender
log4j.appender.DB=org.apache.log4j.jdbc.JDBCAppender
# Set JDBC URL
log4j.appender.DB.URL=jdbc:mysql://localhost/youtube
# Set Database Driver
log4j.appender.DB.driver=com.mysql.jdbc.Driver
# Set database user name and password
log4j.appender.DB.user=root
log4j.appender.DB.password=root
# Set the SQL statement to be executed.
log4j.appender.DB.sql=INSERT INTO logs VALUES('%x','%d','%C','%p','%m')
# Define the layout for file appender
log4j.appender.DB.layout=org.apache.log4j.PatternLayout
jdbcAppender.java
public class jdbcAppender{
/* Get actual class name to be printed on */
static Logger log = Logger.getLogger(jdbcAppender.class.getName());
public static void main(String[] args) throws IOException,SQLException{
log.debug("Debug");
log.info("Info");
}
}
データベース
エラー