elasticsearch-jdbc
elasticsearch-jdbc copied to clipboard
The java.io.FileNotFoundException: logs/jdbc.log error with simple example.
Hi, all, I run this easy example with local mysql, which is used to index all rows in the table to elasticsearch.
echo '{
"type" : "jdbc",
"jdbc": {
"url":"jdbc:mysql://localhost:3306/tutorials",
"user":"root",
"password":"1234",
"sql":"select * from uuu",
"index" : "myindex",
"type" : "mytype"
}
}' | java
-cp "${lib}/*"
-Dlog4j.configurationFile=${bin}/log4j2.xml
org.xbib.tools.Runner \
It seems works, the data can be queried in elasticsearch. However, after run this script, there is a java error
RROR StatusLogger FileManager (logs/jdbc.log) java.io.FileNotFoundException: logs/jdbc.log (No such file or directory)
ERROR StatusLogger Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.FileAppender for element File. java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:766)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:706)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:698)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:358)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:161)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:359)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:420)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:138)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:207)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:160)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:492)
at org.xbib.tools.Importer.
ERROR StatusLogger Null object returned for File in appenders. ERROR StatusLogger Unable to locate appender File for logger
I really want to fix this error and see someone can help me
Do not use bold letters. This is impolite.
Either you change your log configuration, create a log directory, or you can disable logging by removing the line -Dlog4j.configurationFile=${bin}/log4j2.xml \ (which is not recommended
@jprante My apologies
Thanks, It works for me
@jprante @steven1227 hello, i got this problem issue too, but i want to ask where i can removing line -Dlog4j.configurationFile=${bin}/log4j2.xml is ? i dont know the config location is, i mean which one of file ?
regards, Adit
It could be a Anti-Virus issue, I couldn't run my Spigot MC Server because Comodo added it to "VT Root" which deleted the files before it created.
Hey, How can I fix this same error without removing line "Dlog4j.configurationFile=${bin}/log4j2.xml" as it is not recommended.